ui: every sample has a thumbnail on the Start card and a gallery capture (#294)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 10:17:28 -04:00
1 parent bbf2dba092
commit 2908a77850
11 files changed
+44 -4

No files matched your search

+9 -2
View File
@@ -19,6 +19,10 @@ const THUMBNAILS: &[(&str, &[u8])] = &[
("rubber-seal", include_bytes!("../thumbnails/rubber-seal.png")),
("heated-bracket", include_bytes!("../thumbnails/heated-bracket.png")),
("bracket-hex", include_bytes!("../thumbnails/bracket-hex.png")),
("flow-past", include_bytes!("../thumbnails/flow-past.png")),
("cantilever", include_bytes!("../thumbnails/cantilever.png")),
("impact", include_bytes!("../thumbnails/impact.png")),
("parts", include_bytes!("../thumbnails/parts.png")),
];
/// The thumbnails' aspect ratio (height over width).
@@ -164,13 +168,16 @@ mod tests {
assert_eq!(names.first(), Some(&"crank-arm"));
}
/// Every flagship name and every thumbnail names a registered sample, and every thumbnail
/// decodes at 320 px wide.
/// Every flagship name and every thumbnail names a registered sample, every sample has a
/// thumbnail (#294), and every thumbnail decodes at 320 px wide.
#[test]
fn thumbnails_and_flagship_names_are_registered_samples() {
for name in FLAGSHIP.iter().chain(THUMBNAILS.iter().map(|(n, _)| n)) {
assert!(fieldcraft_engine::sample::find(name).is_some(), "{name}");
}
for s in SAMPLES {
assert!(THUMBNAILS.iter().any(|(n, _)| *n == s.name), "{} has no thumbnail", s.name);
}
for (name, bytes) in THUMBNAILS {
let image = decode(bytes).unwrap_or_else(|| panic!("{name} does not decode"));
assert_eq!(image.size[0], 320, "{name}");