From 2e44f9b2e8155b6d2b64b3ef7d9ecfcaf1211dca Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 09:08:56 -0800 Subject: [PATCH] Tests: check the empty image's length before its pixels The test-lint step flagged the all() check on the fallback image as unguarded: an empty pixel list would pass it. The test now asserts the image holds one pixel per position of its 3 x 2 size first. --- crates/ui-egui/src/canvas/tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 6dae4c8787..7be7f49dc2 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -6980,5 +6980,6 @@ fn the_worker_s_frame_reaches_its_texture_image_in_the_buffer_it_was_rendered_in // A raster whose pixels don't match its size gives an empty image of that size. let short = vectorcraft_render::Rendered { width: 3, height: 2, pixels: vec![u32::MAX; 5] }; let empty = color_image_owned(short); + assert_eq!(empty.pixels.len(), 6, "the empty image has one pixel per position of its size"); assert!(empty.size == [3, 2] && empty.pixels.iter().all(|c| *c == Color32::TRANSPARENT), "a raster of the wrong length is not shown"); }