diff --git a/crates/fla/src/tests_archive.rs b/crates/fla/src/tests_archive.rs index 2a7668ce..488daf8f 100644 --- a/crates/fla/src/tests_archive.rs +++ b/crates/fla/src/tests_archive.rs @@ -319,9 +319,13 @@ fn every_rebuilt_shape_record_is_charged_its_edges_before_the_rebuild() { let (all, report) = full(usize::MAX); assert_eq!(all, 12); assert!(report.skipped.is_empty(), "{:?}", report.skipped); - // The smallest budget that still brings every use in, and one edge less. - let enough = (0..100_000).find(|&b| full(b).1.skipped.is_empty()).expect("some budget fits the document"); - assert!(enough > 0); + // The budget the fixture needs, from its records: the drawing's edges at each of its four + // uses, and the library rectangle's once. + let edges = |body: Vec| crate::shape::find_all(&one_frame_stream(&body)).first().map(|r| r.edges.len()).expect("the record decodes"); + let enough = 4 * edges(crate::tests::three_squares_body()) + edges(rectangle_body()); + let (at_budget, report) = full(enough); + assert_eq!(at_budget, all, "exactly the edges rebuilt fit"); + assert!(report.skipped.is_empty(), "{:?}", report.skipped); let (fewer, report) = full(enough - 1); assert!(fewer < all, "one edge short leaves a use out"); assert!(skipped(&report, "shapes past the import's geometry budget (left out)") > 0, "{:?}", report.skipped); diff --git a/crates/xfl/tests/own_media_corpus.rs b/crates/xfl/tests/own_media_corpus.rs index d5fccfa0..32697d15 100644 --- a/crates/xfl/tests/own_media_corpus.rs +++ b/crates/xfl/tests/own_media_corpus.rs @@ -70,9 +70,24 @@ fn every_twins_badge_decodes_from_animates_own_bitmap_data() { assert_eq!(px.rgba[mid + 3], 255, "{}: the middle is opaque", path.display()); badges.push(px.rgba.clone()); } - // The manifest's 9 pairs: 6 Animate `.fla` files, the Mademoiselle XFL folder and its zip, - // and the RoboKit and Storyboard downloads' 3 `.fla` files. - assert!(opened.len() >= 10, "expected every twin the manifest pins, got {opened:?}"); + // Every twin of the manifest's 9 pairs, by name: 5 Animate `.fla` files, Mademoiselle's + // zipped XFL folder and its unpacked copy, and the RoboKit and Storyboard downloads' 3 + // `.fla` files. + let expected = [ + "giskard-animate.fla", + "kinefox-animate.fla", + "mademoiselle-animate.fla", + "mademoiselle-animate/EDAPT_SMR_MademoiselleD_v4a_CC.xfl", + "magnebot-animate.fla", + "movietemplate-animate.fla", + "rabbit-animate.fla", + "robokit-animate/EDAPT_SMR_FreeStyle_RoboKit_v1b_CC.fla", + "storyboard-animate/EDAPT_Storyboard_Template_CC.fla", + "storyboard-animate/EDAPT_Storyboard_Template_Sample_Animatic_CC.fla", + ]; + let mut got: Vec = opened.iter().map(|p| Path::new(p).strip_prefix(&dir).map_or_else(|_| p.clone(), |r| r.to_string_lossy().replace('\\', "/"))).collect(); + got.sort(); + assert_eq!(got, expected, "every twin the manifest pins opens"); assert!(badges.windows(2).all(|w| w[0] == w[1]), "every twin's badge decodes to the same pixels"); }