### Basic egui_kittest Usage Example Source: https://crates.io/crates/egui_kittest Demonstrates how to use Harness to interact with UI elements like checkboxes and perform basic assertions. Ensure the 'wgpu' and 'snapshot' features are enabled for snapshot testing. ```rust use egui::accesskit::Toggled; use egui_kittest::{Harness, kittest::{Queryable, NodeT}}; let mut checked = false; let app = |ui: &mut egui::Ui| { ui.checkbox(&mut checked, "Check me!"); }; 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(); harness.run(); 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(); // You can even render the ui and do image snapshot tests #[cfg(all(feature = "wgpu", feature = "snapshot"))] harness.snapshot("readme_example"); ``` -------------------------------- ### egui_kittest Configuration File Example Source: https://crates.io/crates/egui_kittest Shows the structure and default settings for a 'kittest.toml' configuration file. This file allows customization of test settings like output paths and thresholds for different operating systems. ```toml # path to the snapshot directory output_path = "tests/snapshots" # default threshold for image comparison tests threshold = 0.6 # default failed_pixel_count_threshold failed_pixel_count_threshold = 0 [windows] threshold = 0.6 failed_pixel_count_threshold = 0 [macos] threshold = 0.6 failed_pixel_count_threshold = 0 [linux] threshold = 0.6 failed_pixel_count_threshold = 0 ``` -------------------------------- ### Snapshot Testing .gitignore Example Source: https://crates.io/crates/egui_kittest Provides lines to add to your .gitignore file to exclude generated snapshot diff and new image files from version control. This is crucial for managing generated test artifacts. ```gitignore **/tests/snapshots/**/*.diff.png **/tests/snapshots/**/*.new.png ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.