Merge branch 'master' into beacon

This commit is contained in:
Héctor Ramón Jiménez 2025-04-05 18:20:31 +02:00
commit 3f67044977
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
62 changed files with 713 additions and 780 deletions

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()
.cloned()
.map(|theme| {
let mut styling = Styling::default();
styling.update(Message::ThemeChanged(theme));
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()
}
}