1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Apply nightly clippy suggestions/fixes (#7794)

* Reduce the diff for https://github.com/emilk/egui/pull/7793
This commit is contained in:
Emil Ernerfeldt
2025-12-19 18:43:58 +01:00
committed by GitHub
parent f1e0b2e565
commit 011c59c2ad
10 changed files with 183 additions and 197 deletions

View File

@@ -12,30 +12,28 @@ Ui testing library for egui, based on [kittest](https://github.com/rerun-io/kitt
use egui::accesskit::Toggled;
use egui_kittest::{Harness, kittest::{Queryable, NodeT}};
fn main() {
let mut checked = false;
let app = |ui: &mut egui::Ui| {
ui.checkbox(&mut checked, "Check me!");
};
let mut checked = false;
let app = |ui: &mut egui::Ui| {
ui.checkbox(&mut checked, "Check me!");
};
let mut harness = Harness::new_ui(app);
let mut harness = Harness::new_ui(app);
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.accesskit_node().toggled(), Some(Toggled::False));
checkbox.click();
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.accesskit_node().toggled(), Some(Toggled::False));
checkbox.click();
harness.run();
harness.run();
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.accesskit_node().toggled(), Some(Toggled::True));
let checkbox = harness.get_by_label("Check me!");
assert_eq!(checkbox.accesskit_node().toggled(), Some(Toggled::True));
// Shrink the window size to the smallest size possible
harness.fit_contents();
// Shrink the window size to the smallest size possible
harness.fit_contents();
// You can even render the ui and do image snapshot tests
#[cfg(all(feature = "wgpu", feature = "snapshot"))]
harness.snapshot("readme_example");
}
// You can even render the ui and do image snapshot tests
#[cfg(all(feature = "wgpu", feature = "snapshot"))]
harness.snapshot("readme_example");
```
## Configuration
@@ -44,7 +42,7 @@ You can configure test settings via a `kittest.toml` file in your workspace root
All possible settings and their defaults:
```toml
# path to the snapshot directory
output_path = "tests/snapshots"
output_path = "tests/snapshots"
# default threshold for image comparison tests
threshold = 0.6