mirror of
https://github.com/storytold/filmcraft.git
synced 2026-10-14 11:17:01 -04:00
Media Browser drag test: count the dragged files' clips by name (#1442)
The drop lands inside the demo's long Ambient_Score.wav on A2, and overwriting there splits it, so the total clip count went up by 3, not 2, and the test failed deterministically. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ade0f36544
commit
7c9da91184
1 file changed
+6
-4
@@ -781,16 +781,18 @@ fn media_browser_drag_places_every_selected_file() {
|
||||
d.exec("mediaBrowser.select", json!({"paths": [a, b]}));
|
||||
d.frames(2);
|
||||
let n0 = d.app().session.project.items.len();
|
||||
let clips = |d: &mut Driver| {
|
||||
d.app().session.active_sequence().map(|q| q.video_tracks.iter().chain(&q.audio_tracks).map(|t| t.items.len()).sum::<usize>()).unwrap_or(0)
|
||||
// clips named after each dragged file (a drop inside a long clip also splits that one)
|
||||
let placed = |d: &mut Driver, name: &str| {
|
||||
d.app().session.active_sequence().map_or(0, |q| q.video_tracks.iter().chain(&q.audio_tracks).flat_map(|t| &t.items).filter(|i| i.name == name).count())
|
||||
};
|
||||
let c0 = clips(&mut d);
|
||||
assert_eq!((placed(&mut d, "a-interview.wav"), placed(&mut d, "b-roll.wav")), (0, 0));
|
||||
let e = d.rect("mediaBrowser.entry.b-roll.wav");
|
||||
let tl = d.rect("panel.Timeline");
|
||||
d.ok("ui.drag", json!({"from": {"x": e[0] + 40.0, "y": e[1] + e[3] / 2.0}, "to": {"x": tl[0] + tl[2] * 0.6, "y": tl[1] + tl[3] * 0.75}, "steps": 20}));
|
||||
d.frames(6);
|
||||
assert_eq!(d.app().session.project.items.len(), n0 + 1, "only the new file is imported");
|
||||
assert_eq!(clips(&mut d), c0 + 2, "both files are placed; status: {}", d.app().ui.status);
|
||||
let status = d.app().ui.status.clone();
|
||||
assert_eq!((placed(&mut d, "a-interview.wav"), placed(&mut d, "b-roll.wav")), (1, 1), "both files are placed; status: {status}");
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user