mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-28 17:19:31 +01:00
test(fla,xfl): pin the edge budget and the twin set to their fixtures
Two points from CodeRabbit's review of 3144fed:
- The rebuild-budget test computes the budget the fixture needs from its
records: the drawing's edges at each of its four uses, and the library
rectangle's edges once. Before, it searched for a threshold, so the
importer set the value it was checked against, and an accounting that
charged one unit per rebuild would still have passed.
- The own-media corpus test requires its ten twins by name. It used to
accept ten or more, and its comment counted Mademoiselle twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3144fed2c6
commit
b4d33b7152
2 files changed
+25
-6
No files matched your search
@@ -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<u8>| 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);
|
||||
|
||||
@@ -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<String> = 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");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user