Test different Theme variants in styling example

This commit is contained in:
Héctor Ramón Jiménez 2025-04-01 02:54:45 +02:00
parent ced4276a5e
commit 2b7d8eaaca
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
27 changed files with 69 additions and 35 deletions

View file

@ -7,3 +7,7 @@ publish = false
[dependencies]
iced.workspace = true
[dev-dependencies]
iced_test.workspace = true
rayon = "1"

View file

@ -0,0 +1 @@
9e67e429f88fd5a64744d9cd4d42e123950bea4a45fea78581bc3d64b12e11f0

View file

@ -0,0 +1 @@
811a22238f3a40e3e3998f514c0a95f24f2b45449250682d86c8ec392fec5e28

View file

@ -0,0 +1 @@
6bf957efe807f87f38cfc672f9a05325aadee6256aacca87bbc3281b98160c8a

View file

@ -0,0 +1 @@
d3f4110fae78a3be3b7a4813e9a432b48b81fff1e982c0244e4ea394074bef55

View file

@ -0,0 +1 @@
578e7420de69d82906d284c59d81fcea0edf81098481fc4dd7b4c1fb577b7f1c

View file

@ -0,0 +1 @@
422e841113efaa86e9e37593d0d14f8dd36ad483a81c30a08588f48805e4f9f3

View file

@ -0,0 +1 @@
3d616a31842a29b4a3d31fbeef25f95c7b50f33360f1c05e069e0b29b3f7553e

View file

@ -0,0 +1 @@
9a21865bfc075669d368ccac69b975c3e1f6c22ba297dddfa003d4ee1a06641c

View file

@ -0,0 +1 @@
d5164fb10a92177afd0aab353557d1e3fdaa743962c6a901f05cbfcd0d91e9fb

View file

@ -0,0 +1 @@
3d5ba3b50f192f8700edbfbf54007e92dfd66997bce7342671afc2b60d556aca

View file

@ -0,0 +1 @@
90cb13c900d58a56ce170afeefbceb77410d024e7eae6030e181df1c929c3944

View file

@ -0,0 +1 @@
71b625bc39aaead7a1298e4b2dad51b266526c53deab139858774986395878db

View file

@ -0,0 +1 @@
f08f80a79959ef1c2fd8f8696a26555f2b2eab6618dd3653a042acab563bcced

View file

@ -0,0 +1 @@
3302b7934051ff8aa01d70c45e28c444bdc93e8a4da219931aa22465b51c6748

View file

@ -0,0 +1 @@
661ec43b66213f369ce5a3680e9e8ead56c98d94718da25b12fbb313386944e0

View file

@ -0,0 +1 @@
b5dd22b064220d5f2f90c6f0f381eff41d25f534587d1649ed59e25f878eda97

View file

@ -0,0 +1 @@
dd6e7e7ba125a2549143501c3de44427633f0bfa6c0d8b6f66aa95d503874065

View file

@ -0,0 +1 @@
44b5afe743b753a54f3e68da2fd2701837e7e8cff276ff1e8c349030c83ac72e

View file

@ -0,0 +1 @@
1b46820f12611b2759eb843688cd13b6024f2096b7986f205398bb029e0c60bd

View file

@ -0,0 +1 @@
27a9a8bb08cea7b0a9b9763e332a6833d4fead1a885cdd59a1f5161e3726d6b1

View file

@ -0,0 +1 @@
ab0dee2cc24f30eb51b376a0385302b45bfeddb373348525dab7f551c27ffec2

View file

@ -0,0 +1 @@
aef404c7e38aec5387c39cf3a2911688324c1b9b520e5f541b9fd3fd6eefd3a8

View file

@ -167,3 +167,42 @@ impl Styling {
self.theme.clone()
}
}
#[cfg(test)]
mod tests {
use super::*;
use rayon::prelude::*;
use iced_test::{Error, simulator};
#[test]
#[ignore]
fn it_showcases_every_theme() -> Result<(), Error> {
Theme::ALL
.par_iter()
.map(|theme| {
let mut styling = Styling::default();
styling.update(Message::ThemeChanged(theme.clone()));
let theme = styling.theme();
let mut ui = simulator(styling.view());
let snapshot = ui.snapshot(&theme)?;
assert!(
snapshot.matches_hash(format!(
"snapshots/{theme}",
theme = theme
.to_string()
.to_ascii_lowercase()
.replace(" ", "_")
))?,
"snapshots for {theme} should match!"
);
Ok(())
})
.collect()
}
}