From 769f86dfbd830dd90e895720c4d99f68ce5f037d Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 25 Nov 2024 13:08:29 +0700 Subject: [PATCH] Fill in slightly more code for the image testing. This still needs a real solution, but just want to get it past clippy. --- vello_tests/tests/property.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vello_tests/tests/property.rs b/vello_tests/tests/property.rs index 368174d5..061f4779 100644 --- a/vello_tests/tests/property.rs +++ b/vello_tests/tests/property.rs @@ -55,16 +55,19 @@ fn empty_scene(use_cpu: bool) { }; let image = vello_tests::render_then_debug_sync(&scene, ¶ms).unwrap(); assert_eq!(image.format, Format::Rgba8); - // FIXME(color): Enable when there is a solution for PartialEq - /* for pixel in image.data.data().chunks_exact(4) { let &[r, g, b, a] = pixel else { unreachable!() }; let image_color = Color::from_rgba8(r, g, b, a); - if image_color != color { - panic!("Got {image_color:?}, expected clear colour {color:?}"); + // FIXME(color): Enable when there is a solution for PartialEq. This should + // not be discarding alpha, but there's no AlphaColor::difference. + if image_color + .discard_alpha() + .difference(color.discard_alpha()) + < 1e-4 + { + panic!("Got {image_color:?}, expected clear color {color:?}"); } } - */ } #[test]