forge
Explore
Log in

Don't you dare go Hollow

wip(engine): transform table test literals bumped to edith 20, size asserts documented

Browse files at this commit

5984e274c40bbae2705ab2f3c32f1f3eede3ae75Ahmet Kaan GümüşParent: 7ef5618
crates/engine/src/edith.rsmodified+40 -40
@@ -1604,7 +1604,7 @@ mod tests {
16041604 video 1 0 0 30 0 - - - fit 1000\n";
16051605 let old = parse(v9, &dir).expect("v9 still loads");
16061606 assert_eq!(old.subtitles, Vec::new());
1607- assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 19\n"));
1607+ assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 20\n"));
16081608 // ...and the line itself is not a v9 line: a dialect may not be mixed.
16091609 let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir)
16101610 .unwrap_err()
@@ -2082,10 +2082,10 @@ mod tests {
20822082 let bytes = flat(&dir, &sources, &lanes, 12);
20832083 assert_eq!(
20842084 String::from_utf8_lossy(&bytes),
2085- "edith 19\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
2085+ "edith 20\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
20862086 source 2 /elsewhere/b.mp4\n\
2087- video 1 0 0 30 0 0 - - fit 1000 0 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0\n\
2088- audio 1 0 0 30 0 0 - - fit 1000 0 0 0\n",
2087+ video 1 0 0 30 0 0 - - fit 1000 0 0 0 -\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0 -\n\
2088+ audio 1 0 0 30 0 0 - - fit 1000 0 0 0 -\n",
20892089 "the file under the project directory is written relative to it, \
20902090 each with the audio stream it plays"
20912091 );
@@ -2119,9 +2119,9 @@ mod tests {
21192119 let bytes = flat(&dir, &sources, &lanes, 7);
21202120 assert_eq!(
21212121 String::from_utf8_lossy(&bytes),
2122- "edith 19\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\
2123- video 1 0 0 30 0 4 - - fit 1000 0 0 0\naudio 1\n\
2124- video 2 40 0 10 0 - - - fit 1000 0 0 0\naudio 2 0 0 30 0 4 - - fit 1000 0 0 0\n",
2122+ "edith 20\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\
2123+ video 1 0 0 30 0 4 - - fit 1000 0 0 0 -\naudio 1\n\
2124+ video 2 40 0 10 0 - - - fit 1000 0 0 0 -\naudio 2 0 0 30 0 4 - - fit 1000 0 0 0 -\n",
21252125 "an empty lane is a line of its own; everything else is its clips"
21262126 );
21272127 let back = parse(&bytes, &dir).expect("parse");
@@ -2239,12 +2239,12 @@ mod tests {
22392239 let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0);
22402240 assert_eq!(
22412241 String::from_utf8_lossy(&bytes),
2242- "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2242+ "edith 20\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
22432243 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\
22442244 eq 16777215.0:-0.1:3.918315e-39:hs\n\
22452245 eq\n\
2246- video 1 0 0 30 0 0 0 - fit 1000 0 0 0\nvideo 1 30 10 20 0 - 1 - fit 1000 0 0 0\n\
2247- audio 1 0 0 30 0 0 0 - fit 1000 0 0 0\naudio 1 30 0 10 0 - 2 - fit 1000 0 0 0\n",
2246+ video 1 0 0 30 0 0 0 - fit 1000 0 0 0 -\nvideo 1 30 10 20 0 - 1 - fit 1000 0 0 0 -\n\
2247+ audio 1 0 0 30 0 0 0 - fit 1000 0 0 0 -\naudio 1 30 0 10 0 - 2 - fit 1000 0 0 0 -\n",
22482248 "the table comes before the clips, and a clip names a line of it"
22492249 );
22502250
@@ -2355,12 +2355,12 @@ mod tests {
23552355 let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0);
23562356 assert_eq!(
23572357 String::from_utf8_lossy(&bytes),
2358- "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2358+ "edith 20\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
23592359 color 0.1:1.2:0.9:-0.3\n\
23602360 color -1e-7:16777215.0:3.918315e-39:-0.0\n\
23612361 color 0.0:1.0:1.0:0.0\n\
2362- video 1 0 0 30 0 0 - 0 fit 1000 0 0 0\nvideo 1 30 10 20 0 - - 1 fit 1000 0 0 0\n\
2363- audio 1 0 0 30 0 0 - 0 fit 1000 0 0 0\naudio 1 30 0 10 0 - - 2 fit 1000 0 0 0\n",
2362+ video 1 0 0 30 0 0 - 0 fit 1000 0 0 0 -\nvideo 1 30 10 20 0 - - 1 fit 1000 0 0 0 -\n\
2363+ audio 1 0 0 30 0 0 - 0 fit 1000 0 0 0 -\naudio 1 30 0 10 0 - - 2 fit 1000 0 0 0 -\n",
23642364 "the table comes before the clips, and a clip names a line of it"
23652365 );
23662366
@@ -2420,9 +2420,9 @@ mod tests {
24202420 (1280, 720),
24212421 old.playhead
24222422 )),
2423- "edith 19\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2423+ "edith 20\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
24242424 eq 80.0:-3.0:0.707:ls\n\
2425- video 1 0 0 30 0 0 0 - fit 1000 0 0 0\naudio 1 0 0 30 0 0 - - fit 1000 0 0 0\n"
2425+ video 1 0 0 30 0 0 0 - fit 1000 0 0 0 -\naudio 1 0 0 30 0 0 - - fit 1000 0 0 0 -\n"
24262426 );
24272427 }
24282428
@@ -2462,9 +2462,9 @@ mod tests {
24622462 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
24632463 assert_eq!(
24642464 String::from_utf8_lossy(&bytes),
2465- "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2466- video 1 0 0 30 0 - - - fit 2000 0 0 0\nvideo 1 15 30 40 0 - - - fit 250 0 0 0\n\
2467- audio 1 0 0 30 0 - - - fit 2000 0 0 0\n",
2465+ "edith 20\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2466+ video 1 0 0 30 0 - - - fit 2000 0 0 0 -\nvideo 1 15 30 40 0 - - - fit 250 0 0 0 -\n\
2467+ audio 1 0 0 30 0 - - - fit 2000 0 0 0 -\n",
24682468 "the rate is the clip line's last field, in thousandths"
24692469 );
24702470 let back = parse(&bytes, &dir).expect("parse");
@@ -2491,8 +2491,8 @@ mod tests {
24912491 (1280, 720),
24922492 old.playhead
24932493 )),
2494- "edith 19\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2495- video 1 0 0 30 0 0 - - fit 1000 0 0 0\naudio 1 0 0 30 0 0 - - fit 1000 0 0 0\n"
2494+ "edith 20\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2495+ video 1 0 0 30 0 0 - - fit 1000 0 0 0 -\naudio 1 0 0 30 0 0 - - fit 1000 0 0 0 -\n"
24962496 );
24972497 // A rate outside what the editor can set is a corrupt line, by name.
24982498 let bad = b"edith 8\nsource 0 a.mp4\nvideo 1 0 0 30 0 - - - fit 9000\n";
@@ -2540,8 +2540,8 @@ mod tests {
25402540 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
25412541 assert_eq!(
25422542 String::from_utf8_lossy(&bytes),
2543- "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2544- video 1 0 0 30 0 - - - fit 1000 5 7 0\n",
2543+ "edith 20\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2544+ video 1 0 0 30 0 - - - fit 1000 5 7 0 -\n",
25452545 "the fades are the clip line's last two fields"
25462546 );
25472547 let back = parse(&bytes, &dir).expect("parse");
@@ -2591,8 +2591,8 @@ mod tests {
25912591 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
25922592 assert_eq!(
25932593 String::from_utf8_lossy(&bytes),
2594- "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2595- video 1 0 0 30 0 - - - fit 1000 0 0 9\n",
2594+ "edith 20\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
2595+ video 1 0 0 30 0 - - - fit 1000 0 0 9 -\n",
25962596 "the dissolve is the clip line's own last field"
25972597 );
25982598 let back = parse(&bytes, &dir).expect("parse");
@@ -2643,10 +2643,10 @@ mod tests {
26432643 );
26442644 assert_eq!(
26452645 String::from_utf8_lossy(&bytes),
2646- "edith 19\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\
2646+ "edith 20\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\
26472647 limiter -1.5 on\nsource 0 a.mp4\n\
2648- video 1 0 0 30 0 - - - fit 1000 0 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0 0\n\
2649- audio 2 0 0 30 0 - - - fit 1000 0 0 0\n\
2648+ video 1 0 0 30 0 - - - fit 1000 0 0 0 -\naudio 1 0 0 30 0 - - - fit 1000 0 0 0 -\n\
2649+ audio 2 0 0 30 0 - - - fit 1000 0 0 0 -\n\
26502650 gain audio 1 3.0\ngain audio 2 -6.5\n",
26512651 "the mix is lines of its own, the gains after the lanes they name"
26522652 );
@@ -2675,8 +2675,8 @@ mod tests {
26752675 (1280, 720),
26762676 old.playhead
26772677 )),
2678- "edith 19\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2679- video 1 0 0 30 0 - - - fit 1000 0 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0 0\n"
2678+ "edith 20\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2679+ video 1 0 0 30 0 - - - fit 1000 0 0 0 -\naudio 1 0 0 30 0 - - - fit 1000 0 0 0 -\n"
26802680 );
26812681
26822682 // Each of the three refuses by name, on its own line.
@@ -2839,10 +2839,10 @@ mod tests {
28392839 assert!(old.eq.is_empty(), "nothing before v5 equalizes anything");
28402840 assert_eq!(
28412841 String::from_utf8_lossy(&flat(&dir, &old.sources, &old.lanes, old.playhead)),
2842- "edith 19\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
2842+ "edith 20\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
28432843 source 2 /elsewhere/b.mp4\n\
2844- video 1 0 0 30 0 0 - - fit 1000 0 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0\n\
2845- audio 1 0 0 30 0 0 - - fit 1000 0 0 0\n"
2844+ video 1 0 0 30 0 0 - - fit 1000 0 0 0 -\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0 -\n\
2845+ audio 1 0 0 30 0 0 - - fit 1000 0 0 0 -\n"
28462846 );
28472847 // An empty lane's line is still the whole of that lane, eq or no eq.
28482848 let empty = parse(
@@ -2892,10 +2892,10 @@ mod tests {
28922892 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);
28932893 assert_eq!(
28942894 String::from_utf8_lossy(&v5),
2895- "edith 19\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
2895+ "edith 20\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
28962896 source 0 /elsewhere/b.mp4\n\
2897- video 1 0 0 30 0 0 - - fit 1000 0 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0\n\
2898- audio 1 0 0 30 0 0 - - fit 1000 0 0 0\n",
2897+ video 1 0 0 30 0 0 - - fit 1000 0 0 0 -\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0 -\n\
2898+ audio 1 0 0 30 0 0 - - fit 1000 0 0 0 -\n",
28992899 "a re-saved v2 project differs only by its version, the lane \
29002900 numbers, the streams it always meant and an equalizer it has none of"
29012901 );
@@ -2924,7 +2924,7 @@ mod tests {
29242924 // Saved again it is the current version, which round-trips to the
29252925 // same document.
29262926 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);
2927- assert!(v5.starts_with(b"edith 19\n"));
2927+ assert!(v5.starts_with(b"edith 20\n"));
29282928 let again = parse(&v5, &dir).expect("v5 parses");
29292929 assert_eq!(again.lanes, back.lanes);
29302930 // A dialect may not be mixed: lane lines under v1, `clip` under v2.
@@ -3035,8 +3035,8 @@ mod tests {
30353035 let bytes = std::fs::read(&path).expect("read back");
30363036 assert_eq!(
30373037 String::from_utf8_lossy(&bytes),
3038- "edith 19\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\
3039- video 1 0 0 30 0 - - - fit 1000 0 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0 0\n"
3038+ "edith 20\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\
3039+ video 1 0 0 30 0 - - - fit 1000 0 0 0 -\naudio 1 0 0 30 0 - - - fit 1000 0 0 0 -\n"
30403040 );
30413041 // Loading rejoins the *given* directory, so the file is reached by the
30423042 // way the project was opened -- the same file, through the link, still
@@ -3080,10 +3080,10 @@ mod tests {
30803080 #[test]
30813081 fn a_wrong_first_line_is_refused_by_name() {
30823082 let dir = PathBuf::from("/proj");
3083- let err = parse(b"edith 20\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir)
3083+ let err = parse(b"edith 21\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir)
30843084 .unwrap_err()
30853085 .to_string();
3086- assert_eq!(err, "line 1: unsupported version 20");
3086+ assert_eq!(err, "line 1: unsupported version 21");
30873087 for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] {
30883088 assert_eq!(
30893089 parse(junk, &dir).unwrap_err().to_string(),
crates/engine/src/project.rsmodified+7 -2
@@ -6748,6 +6748,9 @@ mod tests {
67486748 /// 52 bytes of fields, but the struct's own alignment is 8 (from the
67496749 /// `usize` source and the 8-byte `Option<u32>` link), so an odd number of
67506750 /// words after it pads out to the next multiple of 8: 56 bytes total.
6751+ /// The transform index is a third `Option<u16>`, same reason as the eq and
6752+ /// colour ones before it -- it lands in bytes already spent on padding, so
6753+ /// the struct still costs 56.
67516754 /// This is the assert that says so: a clip that grows a word grows every
67526755 /// undo snapshot and every clipboard copy with it.
67536756 #[test]
@@ -8104,13 +8107,15 @@ mod tests {
81048107 /// Not a claim about correctness but about cost: a clip is copied on every
81058108 /// paste, every undo snapshot and every lane clone, so its size is worth
81068109 /// knowing. The eq index fit the padding a `Copy` clip already had; the
8107- /// colour one did not, and the struct grew a word.
8110+ /// colour one did not, and the struct grew a word. The transform index is
8111+ /// a third `Option<u16>`, and it fits the padding the fit policy and the
8112+ /// transition byte already left behind, so the struct did not grow again.
81088113 #[test]
81098114 fn a_clip_is_still_a_small_copy() {
81108115 assert_eq!(
81118116 std::mem::size_of::<Clip>(),
81128117 56,
8113- "Clip changed size -- 32 before the colour index, 40 before the fades, 48 after, 56 with the transition"
8118+ "Clip changed size -- 32 before the colour index, 40 before the fades, 48 after, 56 with the transition, still 56 with the transform index"
81148119 );
81158120 }
81168121