forge
Explore
Log in

Don't you dare go Hollow

The paste test pins the caption-untouched law

Browse files at this commit

1027953260d02f858a9a1da68bbc80456efedb1eAhmet Kaan GümüşParent: e045b5e
  • fix
    • the paste test pins the caption-untouched law
Show full message
🐛 fix(engine): the paste test pins the caption-untouched law
crates/engine/tests/lanes.rsmodified+14 -12
@@ -522,11 +522,14 @@ fn a_subtitle_lane_is_a_peer_and_every_media_path_refuses_it() {
522 assert_eq!(project.sub_lane(s1), [caption], "caption and lane restored");522 assert_eq!(project.sub_lane(s1), [caption], "caption and lane restored");
523 }523 }
524 524
525-/// A rippling paste opens its room on the subtitle lanes too -- the desync a525+/// A paste inserts media, the words keep their clock; co-travel is what a
526-/// lane model exists to prevent: a caption that stayed where it was while the526+/// group is for. The rippling insert used to open room on the subtitle lanes
527-/// picture under it moved on says the wrong words over the wrong frames.527+/// too -- splitting the caption it landed inside and sliding the tail behind
528+/// the picture -- so the hand asked for an add and got a cut it never made.
529+/// What goes down at frame 20 is the paste's business; the caption stays
530+/// byte for byte the placement it was given.
528 #[test]531 #[test]
529-fn a_paste_opens_its_room_under_the_captions_too() {532+fn a_paste_never_touches_the_captions() {
530 use engine::project::SubClip;533 use engine::project::SubClip;
531 534
532 let mut project = Project::single(asset("test_av.mp4"), TOTAL);535 let mut project = Project::single(asset("test_av.mp4"), TOTAL);
@@ -546,6 +549,7 @@ fn a_paste_opens_its_room_under_the_captions_too() {
546 },549 },
547 )550 )
548 .expect("a caption over the first two seconds");551 .expect("a caption over the first two seconds");
552+ let before = project.sub_lane(s1).to_vec();
549 553
550 let clip = *project.lane(Lane::V1).first().expect("V1 holds the film");554 let clip = *project.lane(Lane::V1).first().expect("V1 holds the film");
551 let pasted = Clip {555 let pasted = Clip {
@@ -553,15 +557,13 @@ fn a_paste_opens_its_room_under_the_captions_too() {
553 ..clip557 ..clip
554 };558 };
555 assert!(project.paste(20, pasted), "thirty frames go in at frame 20");559 assert!(project.paste(20, pasted), "thirty frames go in at frame 20");
560+ assert_eq!(project.sub_lane(s1), &before[..], "the caption keeps its clock");
561+ assert_eq!(project.sub_lane(s1).len(), 1, "and uncut");
556 assert_eq!(562 assert_eq!(
557- project563+ project.lane(Lane::V1).len(),
558- .sub_lane(s1)564+ 3,
559- .iter()565+ "the media lanes took the split, not the words"
560- .map(|s| (s.start, s.frames, s.in_us, s.out_us))
561- .collect::<Vec<_>>(),
562- [(0, 20, 0, 666_666), (50, 40, 666_666, 2_000_000)],
563- "the caption is split at the insert and its tail moved on with the picture"
564 );566 );
565 assert!(project.undo(), "and the paste is one step for the lot");567 assert!(project.undo(), "and the paste is one step for the lot");
566- assert_eq!(project.sub_lane(s1).len(), 1);568+ assert_eq!(project.sub_lane(s1), &before[..], "the caption never noticed");
567 }569 }