Increase the threshold for snapshot tests (#5298)

* Related to #5295 
* [x] I have followed the instructions in the PR template
This commit is contained in:
lucasmerlin 2024-10-23 11:19:39 +02:00 committed by GitHub
parent 68d312d043
commit d9a35a7289
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -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(),