diff --git a/.gitignore b/.gitignore index fab7870a6e8..887de9da3de 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,9 @@ **/target **/target_ra **/target_wasm +**/tests/snapshots/**/*.diff.png +**/tests/snapshots/**/*.new.png /.*.json /.vscode /media/* .idea/ -**/tests/snapshots/**/*.new.png -**/tests/snapshots/**/*.diff.png diff --git a/Cargo.lock b/Cargo.lock index 30d09557179..43a25113bd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1384,8 +1384,8 @@ dependencies = [ name = "egui_kittest" version = "0.29.1" dependencies = [ - "accesskit_consumer", "dify", + "document-features", "egui", "egui-wgpu", "image", diff --git a/Cargo.toml b/Cargo.toml index 6ca4941abad..c50a51d76e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,15 +75,18 @@ ahash = { version = "0.8.11", default-features = false, features = [ backtrace = "0.3" bytemuck = "1.7.2" criterion = { version = "0.5.1", default-features = false } +dify = { version = "0.7", default-features = false } document-features = " 0.2.8" glow = "0.14" glutin = "0.32.0" glutin-winit = "0.5.0" home = "0.5.9" image = { version = "0.25", default-features = false } +kittest = { git = "https://github.com/rerun-io/kittest", version = "0.1", branch = "main"} log = { version = "0.4", features = ["std"] } nohash-hasher = "0.2" parking_lot = "0.12" +pollster = "0.3" puffin = "0.19" puffin_http = "0.16" ron = "0.8" diff --git a/crates/egui_demo_lib/Cargo.toml b/crates/egui_demo_lib/Cargo.toml index e98bf5d3406..f8f1f47f686 100644 --- a/crates/egui_demo_lib/Cargo.toml +++ b/crates/egui_demo_lib/Cargo.toml @@ -56,10 +56,10 @@ serde = { workspace = true, optional = true } [dev-dependencies] # when running tests we always want to use the `chrono` feature -egui_demo_lib = { features = ["chrono"], workspace = true } +egui_demo_lib = { workspace = true, features = ["chrono"] } criterion.workspace = true -egui_kittest = { workspace = true, features = ["default", "wgpu", "snapshot"] } +egui_kittest = { workspace = true, features = ["wgpu", "snapshot"] } wgpu = { workspace = true, features = ["metal"] } egui = { workspace = true, features = ["default_fonts"] } diff --git a/crates/egui_kittest/Cargo.toml b/crates/egui_kittest/Cargo.toml index 410403105b6..5063b59658b 100644 --- a/crates/egui_kittest/Cargo.toml +++ b/crates/egui_kittest/Cargo.toml @@ -1,30 +1,42 @@ [package] name = "egui_kittest" +version.workspace = true +authors = ["Lucas Meurer ", "Emil Ernerfeldt "] +description = "Testing library for egui based on kittest and AccessKit" edition.workspace = true -license.workspace = true rust-version.workspace = true -version.workspace = true +homepage = "https://github.com/emilk/egui" +license.workspace = true +readme = "./README.md" +repository = "https://github.com/emilk/egui" +categories = ["gui", "development-tools::testing", "accessibility"] +keywords = ["gui", "immediate", "egui", "testing", "accesskit"] +include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] +# Adds a wgpu-based test renderer. wgpu = ["dep:egui-wgpu", "dep:pollster", "dep:image"] -snapshot = ["dep:dify"] -default = ["image?/png"] +# Adds a dify-based image snapshot utility. +snapshot = ["dep:dify", "dep:image", "image/png"] + [dependencies] -accesskit_consumer = "0.24.0" -kittest = { git = "https://github.com/rerun-io/kittest", version = "0.1", branch = "main" } +kittest.workspace = true egui = { workspace = true, features = ["accesskit"] } # wgpu dependencies egui-wgpu = { workspace = true, optional = true } -pollster = { version = "0.3", optional = true } +pollster = { workspace = true, optional = true } image = { workspace = true, optional = true } # snapshot dependencies -dify = { version = "0.7.0", optional = true, default-features = false } +dify = { workspace = true, optional = true } + +## Enable this when generating docs. +document-features = { workspace = true, optional = true } [dev-dependencies] wgpu = { workspace = true, features = ["metal"] } diff --git a/crates/egui_kittest/README.md b/crates/egui_kittest/README.md index d9cfc35a2f2..78b46b662f6 100644 --- a/crates/egui_kittest/README.md +++ b/crates/egui_kittest/README.md @@ -1,6 +1,6 @@ # egui_kittest -Ui testing library for egui, based on [kittest](https://github.com/rerun-io/kittest) (a AccessKit based testing library). +Ui testing library for egui, based on [kittest](https://github.com/rerun-io/kittest) (an [AccessKit](https://github.com/AccessKit/accesskit) based testing library). ```rust use egui::accesskit::{Role, Toggled}; diff --git a/crates/egui_kittest/src/builder.rs b/crates/egui_kittest/src/builder.rs index b315ebe9967..bf54c624546 100644 --- a/crates/egui_kittest/src/builder.rs +++ b/crates/egui_kittest/src/builder.rs @@ -19,7 +19,7 @@ impl Default for HarnessBuilder { impl HarnessBuilder { /// Set the size of the window. #[inline] - pub fn with_size(mut self, size: Vec2) -> Self { + pub fn with_size(mut self, size: impl Into) -> Self { self.screen_rect.set_width(size.x); self.screen_rect.set_height(size.y); self diff --git a/crates/egui_kittest/src/lib.rs b/crates/egui_kittest/src/lib.rs index 4d17ebb89eb..fb5b4f7fb9a 100644 --- a/crates/egui_kittest/src/lib.rs +++ b/crates/egui_kittest/src/lib.rs @@ -1,4 +1,8 @@ #![doc = include_str!("../README.md")] +//! +//! ## Feature flags +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] + mod builder; mod event; #[cfg(feature = "snapshot")] @@ -16,7 +20,6 @@ pub use kittest; use std::mem; use crate::event::EventState; -pub use accesskit_consumer; pub use builder::*; use egui::{Pos2, Rect, TexturesDelta, Vec2, ViewportId}; use kittest::{Node, Queryable};