From 3cdfd1b0ec5deb7907fd9506fa03d4b89d9204b0 Mon Sep 17 00:00:00 2001 From: lucasmerlin Date: Wed, 23 Oct 2024 11:19:39 +0200 Subject: [PATCH] Increase the threshold for snapshot tests (#5298) * Related to #5295 * [x] I have followed the instructions in the PR template --- crates/egui_kittest/src/snapshot.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/egui_kittest/src/snapshot.rs b/crates/egui_kittest/src/snapshot.rs index 9a64fb42abd..46b7466173b 100644 --- a/crates/egui_kittest/src/snapshot.rs +++ b/crates/egui_kittest/src/snapshot.rs @@ -121,10 +121,12 @@ pub fn try_image_snapshot(current: &image::RgbaImage, name: &str) -> Result<(), // Looking at dify's source code, the threshold is based on the distance between two colors in // YIQ color space. - // The default is 0.1, but we'll try 0.0 because ideally the output should not change at all. - // We might have to increase the threshold if there are minor differences when running tests - // on different gpus or different backends. - let threshold = 0.0; + // The default is 0.1. + // We currently need 2.1 because there are slight rendering differences between the different + // wgpu rendering backends, graphics cards and/or operating systems. + // After some testing it seems like 0.6 should be enough for almost all tests to pass. + // Only the `Bézier Curve` demo seems to need a threshold of 2.1. + let threshold = 2.1; let result = dify::diff::get_results( previous, current.clone(),