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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user