1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Add egui_kittest::Harness::set_options (#7638)

Makes it easier to set the same options for many tests

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
This commit is contained in:
Emil Ernerfeldt
2025-10-15 11:42:52 +02:00
committed by GitHub
parent 96470fabee
commit c79096ecc4
3 changed files with 39 additions and 1 deletions

View File

@@ -14,6 +14,9 @@ pub struct HarnessBuilder<State = ()> {
pub(crate) state: PhantomData<State>,
pub(crate) renderer: Box<dyn TestRenderer>,
pub(crate) wait_for_pending_images: bool,
#[cfg(feature = "snapshot")]
pub(crate) default_snapshot_options: crate::SnapshotOptions,
}
impl<State> Default for HarnessBuilder<State> {
@@ -28,6 +31,9 @@ impl<State> Default for HarnessBuilder<State> {
step_dt: 1.0 / 4.0,
wait_for_pending_images: true,
os: egui::os::OperatingSystem::Nix,
#[cfg(feature = "snapshot")]
default_snapshot_options: crate::SnapshotOptions::default(),
}
}
}
@@ -56,6 +62,12 @@ impl<State> HarnessBuilder<State> {
self
}
/// Set the default options used for snapshot tests on this harness.
#[cfg(feature = "snapshot")]
pub fn with_options(&mut self, options: crate::SnapshotOptions) {
self.default_snapshot_options = options;
}
/// Override the [`egui::os::OperatingSystem`] reported to egui.
///
/// This affects e.g. the way shortcuts are displayed. So for snapshot tests,