wip(engine): transform test wrappers compile again
Browse files at this commit7ef5618b7597fe0b76981b998d122a5097e4b193Parent: 621274e4 changed files +59 -29
- crates/engine/src/edith.rs +14 -0
- crates/engine/src/project.rs +43 -29
- crates/engine/src/silence.rs +1 -0
- crates/engine/src/sweep.rs +1 -0
crates/engine/src/edith.rsmodified+14 -0
| @@ -1519,6 +1519,7 @@ mod tests { | |||
| 1519 | &[], | 1519 | &[], |
| 1520 | eq, | 1520 | eq, |
| 1521 | color, | 1521 | color, |
| 1522 | + &[], | ||
| 1522 | resolution, | 1523 | resolution, |
| 1523 | None, | 1524 | None, |
| 1524 | crate::tonemap::Preset::default(), | 1525 | crate::tonemap::Preset::default(), |
| @@ -1567,6 +1568,7 @@ mod tests { | |||
| 1567 | &tracks, | 1568 | &tracks, |
| 1568 | &[], | 1569 | &[], |
| 1569 | &[], | 1570 | &[], |
| 1571 | + &[], | ||
| 1570 | (1280, 720), | 1572 | (1280, 720), |
| 1571 | None, | 1573 | None, |
| 1572 | crate::tonemap::Preset::default(), | 1574 | crate::tonemap::Preset::default(), |
| @@ -1648,6 +1650,7 @@ mod tests { | |||
| 1648 | &[subtitle("/proj/subs.srt", None)], | 1650 | &[subtitle("/proj/subs.srt", None)], |
| 1649 | &[], | 1651 | &[], |
| 1650 | &[], | 1652 | &[], |
| 1653 | + &[], | ||
| 1651 | (1280, 720), | 1654 | (1280, 720), |
| 1652 | None, | 1655 | None, |
| 1653 | crate::tonemap::Preset::default(), | 1656 | crate::tonemap::Preset::default(), |
| @@ -1700,6 +1703,7 @@ mod tests { | |||
| 1700 | &[], | 1703 | &[], |
| 1701 | &[], | 1704 | &[], |
| 1702 | &[], | 1705 | &[], |
| 1706 | + &[], | ||
| 1703 | (1280, 720), | 1707 | (1280, 720), |
| 1704 | None, | 1708 | None, |
| 1705 | crate::tonemap::Preset::default(), | 1709 | crate::tonemap::Preset::default(), |
| @@ -1764,6 +1768,7 @@ mod tests { | |||
| 1764 | &[], | 1768 | &[], |
| 1765 | &[], | 1769 | &[], |
| 1766 | &[], | 1770 | &[], |
| 1771 | + &[], | ||
| 1767 | (1280, 720), | 1772 | (1280, 720), |
| 1768 | None, | 1773 | None, |
| 1769 | crate::tonemap::Preset::default(), | 1774 | crate::tonemap::Preset::default(), |
| @@ -1830,6 +1835,7 @@ mod tests { | |||
| 1830 | &[], | 1835 | &[], |
| 1831 | &[], | 1836 | &[], |
| 1832 | &[], | 1837 | &[], |
| 1838 | + &[], | ||
| 1833 | (1280, 720), | 1839 | (1280, 720), |
| 1834 | None, | 1840 | None, |
| 1835 | crate::tonemap::Preset::default(), | 1841 | crate::tonemap::Preset::default(), |
| @@ -1903,6 +1909,7 @@ mod tests { | |||
| 1903 | &[], | 1909 | &[], |
| 1904 | &[], | 1910 | &[], |
| 1905 | &[], | 1911 | &[], |
| 1912 | + &[], | ||
| 1906 | (1280, 720), | 1913 | (1280, 720), |
| 1907 | None, | 1914 | None, |
| 1908 | crate::tonemap::Preset::default(), | 1915 | crate::tonemap::Preset::default(), |
| @@ -1969,6 +1976,7 @@ mod tests { | |||
| 1969 | &[], | 1976 | &[], |
| 1970 | &[], | 1977 | &[], |
| 1971 | &[], | 1978 | &[], |
| 1979 | + &[], | ||
| 1972 | (1280, 720), | 1980 | (1280, 720), |
| 1973 | None, | 1981 | None, |
| 1974 | preset, | 1982 | preset, |
| @@ -2022,6 +2030,7 @@ mod tests { | |||
| 2022 | link, | 2030 | link, |
| 2023 | eq: None, | 2031 | eq: None, |
| 2024 | color: None, | 2032 | color: None, |
| 2033 | + transform: None, | ||
| 2025 | fit: FitPolicy::default(), | 2034 | fit: FitPolicy::default(), |
| 2026 | speed: Speed::NORMAL, | 2035 | speed: Speed::NORMAL, |
| 2027 | } | 2036 | } |
| @@ -2436,6 +2445,7 @@ mod tests { | |||
| 2436 | link: None, | 2445 | link: None, |
| 2437 | eq: None, | 2446 | eq: None, |
| 2438 | color: None, | 2447 | color: None, |
| 2448 | + transform: None, | ||
| 2439 | fit: FitPolicy::default(), | 2449 | fit: FitPolicy::default(), |
| 2440 | speed: Speed::from_permille(permille), | 2450 | speed: Speed::from_permille(permille), |
| 2441 | }; | 2451 | }; |
| @@ -2522,6 +2532,7 @@ mod tests { | |||
| 2522 | link: None, | 2532 | link: None, |
| 2523 | eq: None, | 2533 | eq: None, |
| 2524 | color: None, | 2534 | color: None, |
| 2535 | + transform: None, | ||
| 2525 | fit: FitPolicy::default(), | 2536 | fit: FitPolicy::default(), |
| 2526 | speed: Speed::NORMAL, | 2537 | speed: Speed::NORMAL, |
| 2527 | }; | 2538 | }; |
| @@ -2572,6 +2583,7 @@ mod tests { | |||
| 2572 | link: None, | 2583 | link: None, |
| 2573 | eq: None, | 2584 | eq: None, |
| 2574 | color: None, | 2585 | color: None, |
| 2586 | + transform: None, | ||
| 2575 | fit: FitPolicy::default(), | 2587 | fit: FitPolicy::default(), |
| 2576 | speed: Speed::NORMAL, | 2588 | speed: Speed::NORMAL, |
| 2577 | }; | 2589 | }; |
| @@ -2618,6 +2630,7 @@ mod tests { | |||
| 2618 | &[], | 2630 | &[], |
| 2619 | &[], | 2631 | &[], |
| 2620 | &[], | 2632 | &[], |
| 2633 | + &[], | ||
| 2621 | (1280, 720), | 2634 | (1280, 720), |
| 2622 | Some(23.976023976023978), | 2635 | Some(23.976023976023978), |
| 2623 | crate::tonemap::Preset::default(), | 2636 | crate::tonemap::Preset::default(), |
| @@ -3007,6 +3020,7 @@ mod tests { | |||
| 3007 | &[], | 3020 | &[], |
| 3008 | &[], | 3021 | &[], |
| 3009 | &[], | 3022 | &[], |
| 3023 | + &[], | ||
| 3010 | (1280, 720), | 3024 | (1280, 720), |
| 3011 | None, | 3025 | None, |
| 3012 | crate::tonemap::Preset::default(), | 3026 | crate::tonemap::Preset::default(), |
crates/engine/src/project.rsmodified+43 -29
| @@ -6882,6 +6882,7 @@ mod tests { | |||
| 6882 | two(vec![c], vec![c]), | 6882 | two(vec![c], vec![c]), |
| 6883 | Vec::new(), | 6883 | Vec::new(), |
| 6884 | Vec::new(), | 6884 | Vec::new(), |
| 6885 | + Vec::new(), | ||
| 6885 | ) | 6886 | ) |
| 6886 | .expect("valid parts") | 6887 | .expect("valid parts") |
| 6887 | }; | 6888 | }; |
| @@ -7020,9 +7021,9 @@ mod tests { | |||
| 7020 | // A saved-and-loaded empty timeline is a project like any other, and it | 7021 | // A saved-and-loaded empty timeline is a project like any other, and it |
| 7021 | // still names the file its frame rate came from. | 7022 | // still names the file its frame rate came from. |
| 7022 | assert!(p.lift(Lane::V1, 0)); | 7023 | assert!(p.lift(Lane::V1, 0)); |
| 7023 | - let (sources, lanes, eq, color) = p.without_orphan_sources(); | 7024 | + let (sources, lanes, eq, color, _transform) = p.without_orphan_sources(); |
| 7024 | assert_eq!(sources.len(), 1, "source 0 survives an emptied timeline"); | 7025 | assert_eq!(sources.len(), 1, "source 0 survives an emptied timeline"); |
| 7025 | - let back = Project::from_parts(sources, lanes, eq, color).expect("an empty project loads"); | 7026 | + let back = Project::from_parts(sources, lanes, eq, color, Vec::new()).expect("an empty project loads"); |
| 7026 | assert_eq!(back.timeline_frames(), 0); | 7027 | assert_eq!(back.timeline_frames(), 0); |
| 7027 | assert_eq!(back.lanes().len(), 2, "and it kept its lanes"); | 7028 | assert_eq!(back.lanes().len(), 2, "and it kept its lanes"); |
| 7028 | } | 7029 | } |
| @@ -7196,7 +7197,7 @@ mod tests { | |||
| 7196 | (LaneKind::Video, vec![clip(0, 0, 3, 0), clip(10, 3, 6, 0)]), | 7197 | (LaneKind::Video, vec![clip(0, 0, 3, 0), clip(10, 3, 6, 0)]), |
| 7197 | (LaneKind::Audio, vec![clip(0, 0, 3, 0)]), | 7198 | (LaneKind::Audio, vec![clip(0, 0, 3, 0)]), |
| 7198 | ]; | 7199 | ]; |
| 7199 | - let mut p = Project::from_parts(sources, lanes, vec![], vec![]).expect("valid parts"); | 7200 | + let mut p = Project::from_parts(sources, lanes, vec![], vec![], Vec::new()).expect("valid parts"); |
| 7200 | let before = shape(&p); | 7201 | let before = shape(&p); |
| 7201 | 7202 | ||
| 7202 | // Into the gap, exactly where it was let go -- nothing else moves. | 7203 | // Into the gap, exactly where it was let go -- nothing else moves. |
| @@ -7759,7 +7760,7 @@ mod tests { | |||
| 7759 | // Import a second file, undo it: source 1 is now an orphan. | 7760 | // Import a second file, undo it: source 1 is now an orphan. |
| 7760 | let mut p = two_sources(); | 7761 | let mut p = two_sources(); |
| 7761 | assert!(p.undo()); | 7762 | assert!(p.undo()); |
| 7762 | - let (sources, lanes, eq, color) = p.without_orphan_sources(); | 7763 | + let (sources, lanes, eq, color, _transform) = p.without_orphan_sources(); |
| 7763 | assert_eq!(sources, vec![Source::new(FILE, 0)], "the orphan is gone"); | 7764 | assert_eq!(sources, vec![Source::new(FILE, 0)], "the orphan is gone"); |
| 7764 | assert!(eq.is_empty(), "and a project with no equalizer writes none"); | 7765 | assert!(eq.is_empty(), "and a project with no equalizer writes none"); |
| 7765 | assert!(color.is_empty(), "nor a colour it never graded with"); | 7766 | assert!(color.is_empty(), "nor a colour it never graded with"); |
| @@ -7775,7 +7776,7 @@ mod tests { | |||
| 7775 | assert_eq!(p.import(FILE2, 0), 1); | 7776 | assert_eq!(p.import(FILE2, 0), 1); |
| 7776 | assert_eq!(p.import("/nonexistent/c.mp4", 0), 2); | 7777 | assert_eq!(p.import("/nonexistent/c.mp4", 0), 2); |
| 7777 | assert!(p.append_clip(2, 4)); | 7778 | assert!(p.append_clip(2, 4)); |
| 7778 | - let (sources, lanes, eq, color) = p.without_orphan_sources(); | 7779 | + let (sources, lanes, eq, color, _transform) = p.without_orphan_sources(); |
| 7779 | assert_eq!( | 7780 | assert_eq!( |
| 7780 | sources, | 7781 | sources, |
| 7781 | vec![Source::new(FILE, 0), Source::new("/nonexistent/c.mp4", 0)] | 7782 | vec![Source::new(FILE, 0), Source::new("/nonexistent/c.mp4", 0)] |
| @@ -7785,7 +7786,7 @@ mod tests { | |||
| 7785 | [0, 1] | 7786 | [0, 1] |
| 7786 | ); | 7787 | ); |
| 7787 | // ...and what comes out is loadable, with the same timeline. | 7788 | // ...and what comes out is loadable, with the same timeline. |
| 7788 | - let reloaded = Project::from_parts(sources, lanes, eq, color).expect("from_parts"); | 7789 | + let reloaded = Project::from_parts(sources, lanes, eq, color, Vec::new()).expect("from_parts"); |
| 7789 | assert_eq!(reloaded.timeline_frames(), p.timeline_frames()); | 7790 | assert_eq!(reloaded.timeline_frames(), p.timeline_frames()); |
| 7790 | assert_eq!(reloaded.sources().len(), 2); | 7791 | assert_eq!(reloaded.sources().len(), 2); |
| 7791 | } | 7792 | } |
| @@ -7836,8 +7837,8 @@ mod tests { | |||
| 7836 | ); | 7837 | ); |
| 7837 | // What is left is a project that still loads, which is the whole point | 7838 | // What is left is a project that still loads, which is the whole point |
| 7838 | // of renumbering rather than leaving a hole. | 7839 | // of renumbering rather than leaving a hole. |
| 7839 | - let (sources, lanes, eq, color) = p.without_orphan_sources(); | 7840 | + let (sources, lanes, eq, color, _transform) = p.without_orphan_sources(); |
| 7840 | - Project::from_parts(sources, lanes, eq, color).expect("from_parts"); | 7841 | + Project::from_parts(sources, lanes, eq, color, Vec::new()).expect("from_parts"); |
| 7841 | } | 7842 | } |
| 7842 | 7843 | ||
| 7843 | /// The two edges of a removal: it retires the undo stack (the corner-cut on | 7844 | /// The two edges of a removal: it retires the undo stack (the corner-cut on |
| @@ -7943,7 +7944,7 @@ mod tests { | |||
| 7943 | assert!(p.undo(), "back to the first setting"); | 7944 | assert!(p.undo(), "back to the first setting"); |
| 7944 | assert_eq!(p.eq_of(Lane::V1, 0), Some(&band_at(1))); | 7945 | assert_eq!(p.eq_of(Lane::V1, 0), Some(&band_at(1))); |
| 7945 | 7946 | ||
| 7946 | - let (_, lanes, eq, _) = p.without_orphan_sources(); | 7947 | + let (_, lanes, eq, _, _) = p.without_orphan_sources(); |
| 7947 | assert_eq!(eq, vec![band_at(1)], "what nothing plays is not written"); | 7948 | assert_eq!(eq, vec![band_at(1)], "what nothing plays is not written"); |
| 7948 | assert_eq!(lanes[0].1[0].eq, Some(0), "and the survivor renumbers"); | 7949 | assert_eq!(lanes[0].1[0].eq, Some(0), "and the survivor renumbers"); |
| 7949 | assert_eq!(lanes[0].1[1].eq, None); | 7950 | assert_eq!(lanes[0].1[1].eq, None); |
| @@ -7951,7 +7952,7 @@ mod tests { | |||
| 7951 | // One curve on three clips is one entry: settings that are equal share. | 7952 | // One curve on three clips is one entry: settings that are equal share. |
| 7952 | assert!(p.set_eq(Lane::V1, 1, Some(band_at(1)))); | 7953 | assert!(p.set_eq(Lane::V1, 1, Some(band_at(1)))); |
| 7953 | assert!(p.set_eq(Lane::A1, 2, Some(band_at(1)))); | 7954 | assert!(p.set_eq(Lane::A1, 2, Some(band_at(1)))); |
| 7954 | - let (_, lanes, eq, _) = p.without_orphan_sources(); | 7955 | + let (_, lanes, eq, _, _) = p.without_orphan_sources(); |
| 7955 | assert_eq!(eq.len(), 1, "equal settings share their entry"); | 7956 | assert_eq!(eq.len(), 1, "equal settings share their entry"); |
| 7956 | assert_eq!(lanes[1].1[2].eq, Some(0)); | 7957 | assert_eq!(lanes[1].1[2].eq, Some(0)); |
| 7957 | reloads(&p, "an equalizer that outlived an undo"); | 7958 | reloads(&p, "an equalizer that outlived an undo"); |
| @@ -8076,7 +8077,7 @@ mod tests { | |||
| 8076 | assert!(p.undo(), "back to the first grade"); | 8077 | assert!(p.undo(), "back to the first grade"); |
| 8077 | assert_eq!(p.color_of(Lane::V1, 0), Some(&grade_at(1))); | 8078 | assert_eq!(p.color_of(Lane::V1, 0), Some(&grade_at(1))); |
| 8078 | 8079 | ||
| 8079 | - let (_, lanes, _, color) = p.without_orphan_sources(); | 8080 | + let (_, lanes, _, color, _) = p.without_orphan_sources(); |
| 8080 | assert_eq!( | 8081 | assert_eq!( |
| 8081 | color, | 8082 | color, |
| 8082 | vec![grade_at(1)], | 8083 | vec![grade_at(1)], |
| @@ -8088,14 +8089,14 @@ mod tests { | |||
| 8088 | // One grade on three clips is one entry: settings that are equal share. | 8089 | // One grade on three clips is one entry: settings that are equal share. |
| 8089 | assert!(p.set_color(Lane::V1, 1, Some(grade_at(1)))); | 8090 | assert!(p.set_color(Lane::V1, 1, Some(grade_at(1)))); |
| 8090 | assert!(p.set_color(Lane::A1, 2, Some(grade_at(1)))); | 8091 | assert!(p.set_color(Lane::A1, 2, Some(grade_at(1)))); |
| 8091 | - let (_, lanes, _, color) = p.without_orphan_sources(); | 8092 | + let (_, lanes, _, color, _) = p.without_orphan_sources(); |
| 8092 | assert_eq!(color.len(), 1, "equal grades share their entry"); | 8093 | assert_eq!(color.len(), 1, "equal grades share their entry"); |
| 8093 | assert_eq!(lanes[1].1[2].color, Some(0)); | 8094 | assert_eq!(lanes[1].1[2].color, Some(0)); |
| 8094 | reloads(&p, "a colour that outlived an undo"); | 8095 | reloads(&p, "a colour that outlived an undo"); |
| 8095 | 8096 | ||
| 8096 | // An equalizer and a grade on one clip are two independent tables. | 8097 | // An equalizer and a grade on one clip are two independent tables. |
| 8097 | assert!(p.set_eq(Lane::V1, 0, Some(band_at(3)))); | 8098 | assert!(p.set_eq(Lane::V1, 0, Some(band_at(3)))); |
| 8098 | - let (_, lanes, eq, color) = p.without_orphan_sources(); | 8099 | + let (_, lanes, eq, color, _) = p.without_orphan_sources(); |
| 8099 | assert_eq!((eq.len(), color.len()), (1, 1)); | 8100 | assert_eq!((eq.len(), color.len()), (1, 1)); |
| 8100 | assert_eq!((lanes[0].1[0].eq, lanes[0].1[0].color), (Some(0), Some(0))); | 8101 | assert_eq!((lanes[0].1[0].eq, lanes[0].1[0].color), (Some(0), Some(0))); |
| 8101 | } | 8102 | } |
| @@ -8115,9 +8116,9 @@ mod tests { | |||
| 8115 | 8116 | ||
| 8116 | #[test] | 8117 | #[test] |
| 8117 | fn from_parts_has_no_history_and_checks_the_invariants() { | 8118 | fn from_parts_has_no_history_and_checks_the_invariants() { |
| 8118 | - let (sources, lanes, eq, color) = three().without_orphan_sources(); | 8119 | + let (sources, lanes, eq, color, _transform) = three().without_orphan_sources(); |
| 8119 | let (video, audio) = (lanes[0].1.clone(), lanes[1].1.clone()); | 8120 | let (video, audio) = (lanes[0].1.clone(), lanes[1].1.clone()); |
| 8120 | - let mut p = Project::from_parts(sources.clone(), lanes.clone(), eq.clone(), color.clone()) | 8121 | + let mut p = Project::from_parts(sources.clone(), lanes.clone(), eq.clone(), color.clone(), Vec::new()) |
| 8121 | .expect("valid parts"); | 8122 | .expect("valid parts"); |
| 8122 | assert_eq!(p.clips(), three().clips()); | 8123 | assert_eq!(p.clips(), three().clips()); |
| 8123 | assert!(!p.undo(), "a loaded project has nothing to undo"); | 8124 | assert!(!p.undo(), "a loaded project has nothing to undo"); |
| @@ -8132,6 +8133,7 @@ mod tests { | |||
| 8132 | two(video.clone(), Vec::new()), | 8133 | two(video.clone(), Vec::new()), |
| 8133 | Vec::new(), | 8134 | Vec::new(), |
| 8134 | Vec::new(), | 8135 | Vec::new(), |
| 8136 | + Vec::new(), | ||
| 8135 | ) | 8137 | ) |
| 8136 | .is_ok() | 8138 | .is_ok() |
| 8137 | ); | 8139 | ); |
| @@ -8141,10 +8143,11 @@ mod tests { | |||
| 8141 | two(Vec::new(), Vec::new()), | 8143 | two(Vec::new(), Vec::new()), |
| 8142 | Vec::new(), | 8144 | Vec::new(), |
| 8143 | Vec::new(), | 8145 | Vec::new(), |
| 8146 | + Vec::new(), | ||
| 8144 | ) | 8147 | ) |
| 8145 | .is_ok() | 8148 | .is_ok() |
| 8146 | ); | 8149 | ); |
| 8147 | - assert!(Project::from_parts(sources.clone(), Vec::new(), Vec::new(), Vec::new()).is_err()); | 8150 | + assert!(Project::from_parts(sources.clone(), Vec::new(), Vec::new(), Vec::new(), Vec::new()).is_err()); |
| 8148 | let bad: [Vec<Clip>; 5] = [ | 8151 | let bad: [Vec<Clip>; 5] = [ |
| 8149 | vec![clip(0, 0, 3, 1)], // source that is not there | 8152 | vec![clip(0, 0, 3, 1)], // source that is not there |
| 8150 | vec![clip(0, 3, 3, 0)], // empty clip | 8153 | vec![clip(0, 3, 3, 0)], // empty clip |
| @@ -8159,6 +8162,7 @@ mod tests { | |||
| 8159 | two(clips.clone(), Vec::new()), | 8162 | two(clips.clone(), Vec::new()), |
| 8160 | Vec::new(), | 8163 | Vec::new(), |
| 8161 | Vec::new(), | 8164 | Vec::new(), |
| 8165 | + Vec::new(), | ||
| 8162 | ) | 8166 | ) |
| 8163 | .is_err(), | 8167 | .is_err(), |
| 8164 | "{clips:?}" | 8168 | "{clips:?}" |
| @@ -8169,6 +8173,7 @@ mod tests { | |||
| 8169 | two(video.clone(), clips.clone()), | 8173 | two(video.clone(), clips.clone()), |
| 8170 | Vec::new(), | 8174 | Vec::new(), |
| 8171 | Vec::new(), | 8175 | Vec::new(), |
| 8176 | + Vec::new(), | ||
| 8172 | ) | 8177 | ) |
| 8173 | .is_err() | 8178 | .is_err() |
| 8174 | ); | 8179 | ); |
| @@ -8183,6 +8188,7 @@ mod tests { | |||
| 8183 | ], | 8188 | ], |
| 8184 | Vec::new(), | 8189 | Vec::new(), |
| 8185 | Vec::new(), | 8190 | Vec::new(), |
| 8191 | + Vec::new(), | ||
| 8186 | ) | 8192 | ) |
| 8187 | .is_err() | 8193 | .is_err() |
| 8188 | ); | 8194 | ); |
| @@ -8204,6 +8210,7 @@ mod tests { | |||
| 8204 | two(eqd(0), Vec::new()), | 8210 | two(eqd(0), Vec::new()), |
| 8205 | Vec::new(), | 8211 | Vec::new(), |
| 8206 | Vec::new(), | 8212 | Vec::new(), |
| 8213 | + Vec::new(), | ||
| 8207 | ) | 8214 | ) |
| 8208 | .is_err() | 8215 | .is_err() |
| 8209 | ); | 8216 | ); |
| @@ -8215,6 +8222,7 @@ mod tests { | |||
| 8215 | two(eqd(0), Vec::new()), | 8222 | two(eqd(0), Vec::new()), |
| 8216 | vec![nan], | 8223 | vec![nan], |
| 8217 | Vec::new(), | 8224 | Vec::new(), |
| 8225 | + Vec::new(), | ||
| 8218 | ) | 8226 | ) |
| 8219 | .is_err() | 8227 | .is_err() |
| 8220 | ); | 8228 | ); |
| @@ -8223,6 +8231,7 @@ mod tests { | |||
| 8223 | two(eqd(0), Vec::new()), | 8231 | two(eqd(0), Vec::new()), |
| 8224 | vec![band_at(1)], | 8232 | vec![band_at(1)], |
| 8225 | Vec::new(), | 8233 | Vec::new(), |
| 8234 | + Vec::new(), | ||
| 8226 | ) | 8235 | ) |
| 8227 | .expect("an eq the table holds"); | 8236 | .expect("an eq the table holds"); |
| 8228 | assert_eq!(loaded.eq_of(Lane::V1, 0), Some(&band_at(1))); | 8237 | assert_eq!(loaded.eq_of(Lane::V1, 0), Some(&band_at(1))); |
| @@ -8245,6 +8254,7 @@ mod tests { | |||
| 8245 | two(graded(0), Vec::new()), | 8254 | two(graded(0), Vec::new()), |
| 8246 | Vec::new(), | 8255 | Vec::new(), |
| 8247 | Vec::new(), | 8256 | Vec::new(), |
| 8257 | + Vec::new(), | ||
| 8248 | ) | 8258 | ) |
| 8249 | .is_err(), | 8259 | .is_err(), |
| 8250 | "a colour index no entry answers" | 8260 | "a colour index no entry answers" |
| @@ -8258,6 +8268,7 @@ mod tests { | |||
| 8258 | tint: f32::NAN, | 8268 | tint: f32::NAN, |
| 8259 | ..grade_at(1) | 8269 | ..grade_at(1) |
| 8260 | }], | 8270 | }], |
| 8271 | + Vec::new(), | ||
| 8261 | ) | 8272 | ) |
| 8262 | .is_err(), | 8273 | .is_err(), |
| 8263 | "a value the file format could not have written" | 8274 | "a value the file format could not have written" |
| @@ -8267,12 +8278,13 @@ mod tests { | |||
| 8267 | two(graded(0), Vec::new()), | 8278 | two(graded(0), Vec::new()), |
| 8268 | Vec::new(), | 8279 | Vec::new(), |
| 8269 | vec![grade_at(1)], | 8280 | vec![grade_at(1)], |
| 8281 | + Vec::new(), | ||
| 8270 | ) | 8282 | ) |
| 8271 | .expect("a colour the table holds"); | 8283 | .expect("a colour the table holds"); |
| 8272 | assert_eq!(loaded.color_of(Lane::V1, 0), Some(&grade_at(1))); | 8284 | assert_eq!(loaded.color_of(Lane::V1, 0), Some(&grade_at(1))); |
| 8273 | 8285 | ||
| 8274 | // Group ids survive a load, and the next split gets a fresh one. | 8286 | // Group ids survive a load, and the next split gets a fresh one. |
| 8275 | - let mut p = Project::from_parts(sources, lanes, eq, color).expect("valid parts"); | 8287 | + let mut p = Project::from_parts(sources, lanes, eq, color, Vec::new()).expect("valid parts"); |
| 8276 | assert!(p.split(4)); | 8288 | assert!(p.split(4)); |
| 8277 | assert!(p.clips().iter().all(|c| c.link.is_some())); | 8289 | assert!(p.clips().iter().all(|c| c.link.is_some())); |
| 8278 | } | 8290 | } |
| @@ -8308,7 +8320,7 @@ mod tests { | |||
| 8308 | 8320 | ||
| 8309 | // The door: a doubled id inside one lane, refused by name. | 8321 | // The door: a doubled id inside one lane, refused by name. |
| 8310 | let err = |video: Vec<Clip>, audio: Vec<Clip>| { | 8322 | let err = |video: Vec<Clip>, audio: Vec<Clip>| { |
| 8311 | - Project::from_parts(sources.clone(), two(video, audio), Vec::new(), Vec::new()) | 8323 | + Project::from_parts(sources.clone(), two(video, audio), Vec::new(), Vec::new(), Vec::new()) |
| 8312 | .expect_err("refused") | 8324 | .expect_err("refused") |
| 8313 | .to_string() | 8325 | .to_string() |
| 8314 | }; | 8326 | }; |
| @@ -8343,14 +8355,15 @@ mod tests { | |||
| 8343 | two(vec![linked(0, 0, 5, 2)], vec![linked(0, 0, 3, 2)]), | 8355 | two(vec![linked(0, 0, 5, 2)], vec![linked(0, 0, 3, 2)]), |
| 8344 | Vec::new(), | 8356 | Vec::new(), |
| 8345 | Vec::new(), | 8357 | Vec::new(), |
| 8358 | + Vec::new(), | ||
| 8346 | ); | 8359 | ); |
| 8347 | assert!(apart.is_ok(), "offsets within one group load: {apart:?}"); | 8360 | assert!(apart.is_ok(), "offsets within one group load: {apart:?}"); |
| 8348 | // A one-sided link is *not* an error: it is what a lift leaves behind. | 8361 | // A one-sided link is *not* an error: it is what a lift leaves behind. |
| 8349 | let mut p = Project::single(FILE, 9); | 8362 | let mut p = Project::single(FILE, 9); |
| 8350 | assert!(p.lift(Lane::A1, 0)); | 8363 | assert!(p.lift(Lane::A1, 0)); |
| 8351 | - let (sources, lanes, eq, color) = p.clone().without_orphan_sources(); | 8364 | + let (sources, lanes, eq, color, _transform) = p.clone().without_orphan_sources(); |
| 8352 | assert!( | 8365 | assert!( |
| 8353 | - Project::from_parts(sources, lanes, eq, color).is_ok(), | 8366 | + Project::from_parts(sources, lanes, eq, color, Vec::new()).is_ok(), |
| 8354 | "a lifted lane's project has to load again" | 8367 | "a lifted lane's project has to load again" |
| 8355 | ); | 8368 | ); |
| 8356 | 8369 | ||
| @@ -8745,8 +8758,8 @@ mod tests { | |||
| 8745 | /// handed back to the constructor a load goes through -- every lane of them, | 8758 | /// handed back to the constructor a load goes through -- every lane of them, |
| 8746 | /// and the reloaded timeline has to be the same lanes in the same order. | 8759 | /// and the reloaded timeline has to be the same lanes in the same order. |
| 8747 | fn reloads(p: &Project, what: &str) { | 8760 | fn reloads(p: &Project, what: &str) { |
| 8748 | - let (sources, lanes, eq, color) = p.clone().without_orphan_sources(); | 8761 | + let (sources, lanes, eq, color, _transform) = p.clone().without_orphan_sources(); |
| 8749 | - match Project::from_parts(sources, lanes, eq, color) { | 8762 | + match Project::from_parts(sources, lanes, eq, color, Vec::new()) { |
| 8750 | Err(e) => panic!("{what}: saved but would not load: {e}\n{:?}", p.lanes), | 8763 | Err(e) => panic!("{what}: saved but would not load: {e}\n{:?}", p.lanes), |
| 8751 | Ok(back) => { | 8764 | Ok(back) => { |
| 8752 | assert_eq!(back.lanes(), p.lanes(), "{what}: the lane list changed"); | 8765 | assert_eq!(back.lanes(), p.lanes(), "{what}: the lane list changed"); |
| @@ -8996,12 +9009,12 @@ mod tests { | |||
| 8996 | invariants_hold(&p, "V2 over V1"); | 9009 | invariants_hold(&p, "V2 over V1"); |
| 8997 | 9010 | ||
| 8998 | // A save writes that order and a load takes it back. | 9011 | // A save writes that order and a load takes it back. |
| 8999 | - let (sources, lanes, eq, color) = p.without_orphan_sources(); | 9012 | + let (sources, lanes, eq, color, _transform) = p.without_orphan_sources(); |
| 9000 | assert_eq!( | 9013 | assert_eq!( |
| 9001 | lanes.iter().map(|(k, _)| *k).collect::<Vec<_>>(), | 9014 | lanes.iter().map(|(k, _)| *k).collect::<Vec<_>>(), |
| 9002 | [LaneKind::Video, LaneKind::Video, LaneKind::Audio] | 9015 | [LaneKind::Video, LaneKind::Video, LaneKind::Audio] |
| 9003 | ); | 9016 | ); |
| 9004 | - let back = Project::from_parts(sources, lanes, eq, color).expect("three lanes load"); | 9017 | + let back = Project::from_parts(sources, lanes, eq, color, Vec::new()).expect("three lanes load"); |
| 9005 | assert_eq!(back.lanes(), p.lanes()); | 9018 | assert_eq!(back.lanes(), p.lanes()); |
| 9006 | assert_eq!(shape(&back), shape(&p), "the same lane is still on top"); | 9019 | assert_eq!(shape(&back), shape(&p), "the same lane is still on top"); |
| 9007 | 9020 | ||
| @@ -9133,7 +9146,7 @@ mod tests { | |||
| 9133 | let v2 = p.add_lane(LaneKind::Video); | 9146 | let v2 = p.add_lane(LaneKind::Video); |
| 9134 | assert!(p.place(v2, 4, clip(0, 20, 32, 0))); | 9147 | assert!(p.place(v2, 4, clip(0, 20, 32, 0))); |
| 9135 | let a2 = p.add_lane(LaneKind::Audio); | 9148 | let a2 = p.add_lane(LaneKind::Audio); |
| 9136 | - let (sources, lanes, eq, color) = p.without_orphan_sources(); | 9149 | + let (sources, lanes, eq, color, _transform) = p.without_orphan_sources(); |
| 9137 | assert_eq!( | 9150 | assert_eq!( |
| 9138 | lanes.iter().map(|(k, _)| *k).collect::<Vec<_>>(), | 9151 | lanes.iter().map(|(k, _)| *k).collect::<Vec<_>>(), |
| 9139 | [ | 9152 | [ |
| @@ -9147,7 +9160,7 @@ mod tests { | |||
| 9147 | assert_eq!(lanes[2].1, p.lane(v2), "V2's clips are written"); | 9160 | assert_eq!(lanes[2].1, p.lane(v2), "V2's clips are written"); |
| 9148 | assert!(lanes[3].1.is_empty(), "and the empty A2 is still a lane"); | 9161 | assert!(lanes[3].1.is_empty(), "and the empty A2 is still a lane"); |
| 9149 | // ...and all four load again as the same four. | 9162 | // ...and all four load again as the same four. |
| 9150 | - let back = Project::from_parts(sources, lanes, eq, color).expect("four lanes load"); | 9163 | + let back = Project::from_parts(sources, lanes, eq, color, Vec::new()).expect("four lanes load"); |
| 9151 | assert_eq!(back.lanes(), p.lanes()); | 9164 | assert_eq!(back.lanes(), p.lanes()); |
| 9152 | assert_eq!(back.lane(a2), p.lane(a2)); | 9165 | assert_eq!(back.lane(a2), p.lane(a2)); |
| 9153 | 9166 | ||
| @@ -9240,7 +9253,7 @@ mod tests { | |||
| 9240 | (LaneKind::Video, vec![clip(10, 5, 15, 1)]), | 9253 | (LaneKind::Video, vec![clip(10, 5, 15, 1)]), |
| 9241 | (LaneKind::Audio, vec![clip(0, 0, 30, 0)]), | 9254 | (LaneKind::Audio, vec![clip(0, 0, 30, 0)]), |
| 9242 | ]; | 9255 | ]; |
| 9243 | - let p = Project::from_parts(sources, lanes, vec![], vec![]).expect("valid parts"); | 9256 | + let p = Project::from_parts(sources, lanes, vec![], vec![], Vec::new()).expect("valid parts"); |
| 9244 | assert_eq!( | 9257 | assert_eq!( |
| 9245 | p.composite_spans_from(0), | 9258 | p.composite_spans_from(0), |
| 9246 | vec![ | 9259 | vec![ |
| @@ -9285,7 +9298,7 @@ mod tests { | |||
| 9285 | (LaneKind::Video, vec![clip(10, 0, 10, 1)]), | 9298 | (LaneKind::Video, vec![clip(10, 0, 10, 1)]), |
| 9286 | (LaneKind::Audio, vec![clip(0, 0, 30, 0)]), | 9299 | (LaneKind::Audio, vec![clip(0, 0, 30, 0)]), |
| 9287 | ]; | 9300 | ]; |
| 9288 | - let p = Project::from_parts(sources, holed, vec![], vec![]).expect("valid parts"); | 9301 | + let p = Project::from_parts(sources, holed, vec![], vec![], Vec::new()).expect("valid parts"); |
| 9289 | assert_eq!( | 9302 | assert_eq!( |
| 9290 | p.composite_spans_from(0), | 9303 | p.composite_spans_from(0), |
| 9291 | vec![ | 9304 | vec![ |
| @@ -9333,7 +9346,7 @@ mod tests { | |||
| 9333 | (LaneKind::Audio, vec![clip(15, 0, 15, 1)]), | 9346 | (LaneKind::Audio, vec![clip(15, 0, 15, 1)]), |
| 9334 | (LaneKind::Audio, Vec::new()), | 9347 | (LaneKind::Audio, Vec::new()), |
| 9335 | ]; | 9348 | ]; |
| 9336 | - let p = Project::from_parts(sources, lanes, vec![], vec![]).expect("valid parts"); | 9349 | + let p = Project::from_parts(sources, lanes, vec![], vec![], Vec::new()).expect("valid parts"); |
| 9337 | let lists = p.audio_segments_from(0, FPS); | 9350 | let lists = p.audio_segments_from(0, FPS); |
| 9338 | assert_eq!(lists.len(), 2, "the empty lane is not mixed in"); | 9351 | assert_eq!(lists.len(), 2, "the empty lane is not mixed in"); |
| 9339 | assert_eq!(lists[0], p.segments_from(0, FPS), "A1 is unchanged"); | 9352 | assert_eq!(lists[0], p.segments_from(0, FPS), "A1 is unchanged"); |
| @@ -9350,6 +9363,7 @@ mod tests { | |||
| 9350 | ], | 9363 | ], |
| 9351 | vec![], | 9364 | vec![], |
| 9352 | vec![], | 9365 | vec![], |
| 9366 | + Vec::new(), | ||
| 9353 | ) | 9367 | ) |
| 9354 | .expect("valid parts"); | 9368 | .expect("valid parts"); |
| 9355 | assert_eq!(p.audio_segments_from(0, FPS), vec![vec![(None, 0.0, 1.0)]]); | 9369 | assert_eq!(p.audio_segments_from(0, FPS), vec![vec![(None, 0.0, 1.0)]]); |
crates/engine/src/silence.rsmodified+1 -0
| @@ -305,6 +305,7 @@ mod tests { | |||
| 305 | link: None, | 305 | link: None, |
| 306 | eq: None, | 306 | eq: None, |
| 307 | color: None, | 307 | color: None, |
| 308 | + transform: None, | ||
| 308 | fit: FitPolicy::default(), | 309 | fit: FitPolicy::default(), |
| 309 | speed, | 310 | speed, |
| 310 | } | 311 | } |
crates/engine/src/sweep.rsmodified+1 -0
| @@ -76,6 +76,7 @@ fn clip(start: u32, in_frame: u32, out_frame: u32) -> Clip { | |||
| 76 | link: None, | 76 | link: None, |
| 77 | eq: None, | 77 | eq: None, |
| 78 | color: None, | 78 | color: None, |
| 79 | + transform: None, | ||
| 79 | fit: FitPolicy::Fit, | 80 | fit: FitPolicy::Fit, |
| 80 | speed: Speed::NORMAL, | 81 | speed: Speed::NORMAL, |
| 81 | } | 82 | } |