Include test windows in `egui_demo_lib` snapshot tests (#7070)
This commit is contained in:
parent
54ae2360ec
commit
f57cb27386
|
|
@ -1343,6 +1343,7 @@ dependencies = [
|
|||
"egui",
|
||||
"egui_extras",
|
||||
"egui_kittest",
|
||||
"image",
|
||||
"mimalloc",
|
||||
"rand",
|
||||
"serde",
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ syntect = ["egui_extras/syntect"]
|
|||
|
||||
[dependencies]
|
||||
egui = { workspace = true, default-features = false, features = ["color-hex"] }
|
||||
egui_extras = { workspace = true, features = ["default", "file", "svg"] }
|
||||
egui_extras = { workspace = true, features = ["image", "svg"] }
|
||||
|
||||
unicode_names2 = { version = "0.6.0", default-features = false } # this old version has fewer dependencies
|
||||
|
||||
|
|
@ -57,7 +57,9 @@ serde = { workspace = true, optional = true }
|
|||
[dev-dependencies]
|
||||
criterion.workspace = true
|
||||
egui = { workspace = true, features = ["default_fonts"] }
|
||||
egui_extras = { workspace = true, features = ["image", "svg"] }
|
||||
egui_kittest = { workspace = true, features = ["wgpu", "snapshot"] }
|
||||
image = { workspace = true, features = ["png"] }
|
||||
mimalloc.workspace = true # for benchmarks
|
||||
rand = "0.9"
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,16 @@ struct DemoGroup {
|
|||
demos: Vec<Box<dyn Demo>>,
|
||||
}
|
||||
|
||||
impl std::ops::Add for DemoGroup {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, other: Self) -> Self {
|
||||
let mut demos = self.demos;
|
||||
demos.extend(other.demos);
|
||||
Self { demos }
|
||||
}
|
||||
}
|
||||
|
||||
impl DemoGroup {
|
||||
pub fn new(demos: Vec<Box<dyn Demo>>) -> Self {
|
||||
Self { demos }
|
||||
|
|
@ -367,7 +377,12 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn demos_should_match_snapshot() {
|
||||
let demos = DemoGroups::default().demos;
|
||||
let DemoGroups {
|
||||
demos,
|
||||
tests,
|
||||
about: _,
|
||||
} = DemoGroups::default();
|
||||
let demos = demos + tests;
|
||||
|
||||
let mut results = SnapshotResults::new();
|
||||
|
||||
|
|
@ -377,13 +392,10 @@ mod tests {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Remove the emoji from the demo name
|
||||
let name = demo
|
||||
.name()
|
||||
.split_once(' ')
|
||||
.map_or(demo.name(), |(_, name)| name);
|
||||
let name = remove_leading_emoji(demo.name());
|
||||
|
||||
let mut harness = Harness::new(|ctx| {
|
||||
egui_extras::install_image_loaders(ctx);
|
||||
demo.show(ctx, &mut true);
|
||||
});
|
||||
|
||||
|
|
@ -406,4 +418,13 @@ mod tests {
|
|||
results.add(harness.try_snapshot_options(&format!("demos/{name}"), &options));
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_leading_emoji(full_name: &str) -> &str {
|
||||
if let Some((start, name)) = full_name.split_once(' ') {
|
||||
if start.len() <= 4 && start.bytes().next().is_some_and(|byte| byte >= 128) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
full_name
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b4f807098e0bc56eaacabb76d646a76036cc66a7a6e54b1c934fa9fecb5b0170
|
||||
size 26470
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:629006243b61f25e48a454cc617b8e49e38985eebbfe136f3bcb0b361d204671
|
||||
size 61431
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c69c211061663cd17756eb0ad5a7720ed883047dbcedb39c493c544cfc644ed3
|
||||
size 99087
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8d31533f812b2b72410b5caafea9b647d3f4cc9da3db9fcf37c332cb57d58742
|
||||
size 111670
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:502790125ddd0204ea8a468c80c6f3e824adcd98f5a3f626e97f3512d31e1074
|
||||
size 24516
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5fc9e2ec3253a30ac9649995b019b6b23d745dba07a327886f574a15c0e99e84
|
||||
size 50082
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:18fe761145335a60b1eeb1f7f2072224df86f0e2006caa09d1f3cc4bd263d90c
|
||||
size 46560
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3110fab8444cb41dffe8b27277fa5dafd0d335aaf13dca511bcccc8b53fb25c8
|
||||
size 24046
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f1e0657cae72e7ee117d8826bcd18685fd0cdd61d0d613685e4337533c7d4801
|
||||
size 23050
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b4bf35ad4ce01122de5bc0830018044fd70f116938293fbeb72a2278de0bbb22
|
||||
size 35068
|
||||
oid sha256:0fcfee082fe1dcbb7515ca6e3d5457e71fecf91a3efc4f76906a32fdb588adb4
|
||||
size 35096
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f90d56d40004f61628e3f66cfac817c426cd18eb4b9c69ea1b3a6fe5e75e3f05
|
||||
size 70354
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8c0ce7090ba12d849f9e3c77010503b394f3e1fce65c382738f55f7181fd7450
|
||||
size 42527
|
||||
|
|
@ -30,7 +30,7 @@ rustdoc-args = ["--generate-link-to-definition"]
|
|||
[features]
|
||||
default = ["dep:mime_guess2"]
|
||||
|
||||
## Shorthand for enabling the different types of image loaders (`file`, `http`, `image`, `svg`).
|
||||
## Shorthand for enabling all the different types of image loaders.
|
||||
all_loaders = ["file", "http", "image", "svg", "gif", "webp"]
|
||||
|
||||
## Enable [`DatePickerButton`] widget.
|
||||
|
|
|
|||
Loading…
Reference in New Issue