1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

egui_kittest: Allow customizing the snapshot threshold and path (#5304)

This adds `egui_kittest::try_image_snapshot_options` and
`egui_kittest::image_snapshot_options`, as well as
`Harness::wgpu_snapshot_options` and
`Harness::try_wgpu_snapshot_options`

* [X] I have followed the instructions in the PR template
This commit is contained in:
lucasmerlin
2024-10-29 19:52:21 +01:00
committed by GitHub
parent 759a0b2a21
commit dafcfdad80
3 changed files with 197 additions and 36 deletions

View File

@@ -383,7 +383,7 @@ mod tests {
use crate::demo::demo_app_windows::Demos;
use egui::Vec2;
use egui_kittest::kittest::Queryable;
use egui_kittest::Harness;
use egui_kittest::{Harness, SnapshotOptions};
#[test]
fn demos_should_match_snapshot() {
@@ -417,7 +417,13 @@ mod tests {
// Run the app for some more frames...
harness.run();
let result = harness.try_wgpu_snapshot(&format!("demos/{name}"));
let mut options = SnapshotOptions::default();
// The Bézier Curve demo needs a threshold of 2.1 to pass on linux
if name == "Bézier Curve" {
options.threshold = 2.1;
}
let result = harness.try_wgpu_snapshot_options(&format!("demos/{name}"), &options);
if let Err(err) = result {
errors.push(err);
}