#188: regression test — a copied Graphic clip pastes at the playhead

Engine test from #205 (the shortcut half of that PR is superseded by #204).

Co-Authored-By: carlitosteso3 <carlitosteso3@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-07 20:25:19 -04:00
parent a4536bcfed
commit c57541674d
1 changed files with 17 additions and 0 deletions

View File

@ -363,3 +363,20 @@ fn caption_formats_through_the_engine() {
} }
} }
} }
/// #188: a copied Graphic clip pastes at the playhead as a second Graphic clip.
#[test]
fn copy_paste_duplicates_a_graphic_clip() {
let mut s = demo("gt-paste");
let c = clip_of(&s.execute("graphics.newText", json!({"text": "Lyric", "seconds": 2})).unwrap());
s.execute("timeline.select", json!({"clips": [c.0]})).unwrap();
let v = s.execute("edit.copy", json!({})).unwrap();
assert_eq!(v["copied"], 1, "{v}");
s.execute("playhead.set", json!({"seconds": 620})).unwrap();
s.execute("edit.paste", json!({})).unwrap();
let q = s.active_sequence().unwrap();
let pasted: Vec<&TrackItem> = q.all_tracks().flat_map(|t| t.items.iter()).filter(|i| i.id != c && i.item == item(&s, c).item).collect();
assert_eq!(pasted.len(), 1, "one copy");
assert!((pasted[0].start.seconds() - 620.0).abs() < 0.05, "at the playhead: {:?}", pasted[0].start);
assert_eq!(texts(&s, pasted[0].id), vec!["Lyric".to_string()]);
}