Phase 5: fix broken unit tests; cargo test --lib green again
The lib unit tests had gone stale (time values became newtypes) and no longer compiled. Updated the test code to the current API and fixed the few real issues the now-running tests surfaced. Test-only: - Wrap raw f64 time literals in Beats(...) where the API now takes Beats (automation.rs); pass &TempoMap / Beats where signatures changed (clip.rs, effect_layer.rs). - shape.rs: assert the documented no-fill default (fill_color None) instead of Some. - add_clip_instance / trim_clip_instances tests: register a vector clip with the test's clip_id so the action's get_clip_duration lookup succeeds. Production fix (delete_folder.rs): - DeleteFolderAction(MoveToParent) reparented child subfolders to the deleted folder's parent but never restored them on undo, orphaning them. Track the moved subfolder ids and restore their parent on rollback. Result: daw-backend lib 17 passed; lightningbeam-core lib 264 passed.
This commit is contained in:
@@ -902,7 +902,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_audio_clip_midi() {
|
||||
let clip = AudioClip::new_midi("Piano Melody", 1, 60.0);
|
||||
let clip = AudioClip::new_midi("Piano Melody", 1, daw_backend::Beats(60.0));
|
||||
assert_eq!(clip.name, "Piano Melody");
|
||||
assert_eq!(clip.duration, 60.0);
|
||||
match &clip.clip_type {
|
||||
@@ -952,7 +952,10 @@ mod tests {
|
||||
|
||||
assert_eq!(instance.trim_start, 2.0);
|
||||
assert_eq!(instance.trim_end, Some(8.0));
|
||||
assert_eq!(instance.effective_duration(10.0), 6.0);
|
||||
// At 60 BPM the tempo map is identity (1 beat == 1 second), so the
|
||||
// beats-domain effective duration equals the seconds content window.
|
||||
let tempo_map = crate::tempo_map::TempoMap::constant(60.0);
|
||||
assert_eq!(instance.effective_duration(10.0, &tempo_map), 6.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -963,7 +966,9 @@ mod tests {
|
||||
|
||||
assert_eq!(instance.trim_start, 2.0);
|
||||
assert_eq!(instance.trim_end, None);
|
||||
assert_eq!(instance.effective_duration(10.0), 8.0);
|
||||
// At 60 BPM the tempo map is identity (1 beat == 1 second).
|
||||
let tempo_map = crate::tempo_map::TempoMap::constant(60.0);
|
||||
assert_eq!(instance.effective_duration(10.0, &tempo_map), 8.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user