Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,16 @@ dependencies = [
"serde",
]

[[package]]
name = "bincode"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740"
dependencies = [
"serde",
"unty",
]

[[package]]
name = "bit-set"
version = "0.8.0"
Expand Down Expand Up @@ -1382,6 +1392,8 @@ dependencies = [
name = "egui_kittest"
version = "0.34.1"
dependencies = [
"backtrace",
"bincode 2.0.1",
"dify",
"document-features",
"eframe",
Expand Down Expand Up @@ -3576,7 +3588,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa9dae7b05c02ec1a6bc9bcf20d8bc64a7dcbf57934107902a872014899b741f"
dependencies = [
"anyhow",
"bincode",
"bincode 1.3.3",
"byteorder",
"cfg-if",
"itertools 0.10.5",
Expand Down Expand Up @@ -4378,7 +4390,7 @@ version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925"
dependencies = [
"bincode",
"bincode 1.3.3",
"fancy-regex",
"flate2",
"fnv",
Expand Down Expand Up @@ -4821,6 +4833,12 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"

[[package]]
name = "unty"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"

[[package]]
name = "ureq"
version = "3.3.0"
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
android_logger = "0.15.1"
arboard = { version = "3.6.1", default-features = false }
backtrace = "0.3.76"
bincode = { version = "2.0.1", default-features = false, features = ["std", "serde"] }
bitflags = "2.9.4"
bytemuck = "1.24.0"
cint = "0.3.1"
Expand All @@ -90,6 +91,7 @@
enum-map = "2.7.3"
env_logger = { version = "0.11.8", default-features = false }
font-types = { version = "0.11.0", default-features = false, features = ["std"] }
fs4 = { version = "0.13.1", default-features = false, features = ["sync"] }

Check failure on line 94 in Cargo.toml

View workflow job for this annotation

GitHub Actions / cargo-shear

shear/unused_workspace_dependency

unused workspace dependency `fs4` (remove this dependency)
glow = "0.17.0"
glutin = { version = "0.32.3", default-features = false }
glutin-winit = { version = "0.5.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ serde = { workspace = true, optional = true }
criterion.workspace = true
egui = { workspace = true, features = ["default_fonts"] }
egui_extras = { workspace = true, features = ["image", "svg"] }
egui_kittest = { workspace = true, features = ["wgpu", "snapshot"] }
egui_kittest = { workspace = true, features = ["wgpu", "snapshot", "inspector"] }
image = { workspace = true, features = ["png"] }
mimalloc.workspace = true # for benchmarks
rand.workspace = true
Expand Down
16 changes: 16 additions & 0 deletions crates/egui_kittest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ wgpu = ["dep:egui-wgpu", "dep:pollster", "dep:image", "dep:wgpu", "eframe?/wgpu"
## Adds a dify-based image snapshot utility.
snapshot = ["dep:dify", "dep:image", "dep:open", "dep:tempfile", "image/png"]

## Record a test session as an animated GIF or PNG sequence.
recording = ["dep:image", "image/gif", "image/png"]

## Expose the [`inspector_api`] wire protocol used to talk to the external
## `kittest_inspector` binary. Pull this in if you're building a tool that consumes
## the same stream — the binary itself enables this transitively.
inspector_api = ["dep:bincode", "egui/serde"]

## Stream frames + accesskit tree to a `kittest_inspector` window for live debugging.
inspector = ["inspector_api", "dep:image", "dep:backtrace"]

## Allows testing eframe::App
eframe = ["dep:eframe", "eframe/accesskit"]

Expand All @@ -50,6 +61,10 @@ wgpu = { workspace = true, features = ["metal", "dx12", "vulkan", "gles"], optio
# snapshot dependencies
dify = { workspace = true, optional = true }

# inspector dependencies
bincode = { workspace = true, optional = true }
backtrace = { workspace = true, optional = true }

# Enable this when generating docs.
document-features = { workspace = true, optional = true }

Expand All @@ -62,6 +77,7 @@ tempfile = { workspace = true, optional = true }
egui = { workspace = true, features = ["default_fonts"] }
image = { workspace = true, features = ["png"] }
egui_extras = { workspace = true, features = ["image", "http"] }
tempfile = { workspace = true }

[lints]
workspace = true
18 changes: 18 additions & 0 deletions crates/egui_kittest/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ pub struct Config {
/// Default is 0.
failed_pixel_count_threshold: usize,

/// When `true`, every harness automatically records itself and writes a GIF to
/// `{output_path}/failures/{test_name}.gif` on test failure.
///
/// Requires the `recording` feature; ignored otherwise.
/// Default is `false`.
#[cfg_attr(not(feature = "recording"), allow(dead_code))]
save_gif_on_failure: bool,

windows: OsConfig,
mac: OsConfig,
linux: OsConfig,
Expand All @@ -36,6 +44,7 @@ impl Default for Config {
output_path: PathBuf::from("tests/snapshots"),
threshold: 0.6,
failed_pixel_count_threshold: 0,
save_gif_on_failure: false,
windows: Default::default(),
mac: Default::default(),
linux: Default::default(),
Expand Down Expand Up @@ -113,6 +122,15 @@ impl Config {
pub fn output_path(&self) -> PathBuf {
self.output_path.clone()
}

/// Whether harnesses should automatically record themselves and save a GIF on test failure.
///
/// Configurable via `kittest.toml`. Requires the `recording` feature; ignored otherwise.
/// Default is `false`.
#[cfg(feature = "recording")]
pub fn save_gif_on_failure(&self) -> bool {
self.save_gif_on_failure
}
}

#[cfg(feature = "snapshot")]
Expand Down
Loading
Loading