mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Enforce consistent snapshot updates (#7744)
* Closes https://github.com/emilk/egui/issues/7647 This collects SnapshotResults within the Harness and adds a check to enforce snapshot results are merged in case multiple Harnesses are constructed within a test. This should make snapshot updates via kitdiff/accept_snapshots.sh way more useful since it should now always update all snapshots instead of only the first one per test.
This commit is contained in:
@@ -3,6 +3,7 @@ use egui_kittest::{Harness, kittest::Queryable as _};
|
||||
|
||||
#[test]
|
||||
fn test_kerning() {
|
||||
let mut results = egui_kittest::SnapshotResults::new();
|
||||
for pixels_per_point in [1.0, 2.0] {
|
||||
for theme in [egui::Theme::Dark, egui::Theme::Light] {
|
||||
let mut harness = Harness::builder()
|
||||
@@ -24,12 +25,14 @@ fn test_kerning() {
|
||||
egui::Theme::Light => "light",
|
||||
}
|
||||
));
|
||||
results.extend_harness(&mut harness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_italics() {
|
||||
let mut results = egui_kittest::SnapshotResults::new();
|
||||
for pixels_per_point in [1.0, 2.0_f32.sqrt(), 2.0] {
|
||||
for theme in [egui::Theme::Dark, egui::Theme::Light] {
|
||||
let mut harness = Harness::builder()
|
||||
@@ -49,6 +52,7 @@ fn test_italics() {
|
||||
egui::Theme::Light => "light",
|
||||
}
|
||||
));
|
||||
results.extend_harness(&mut harness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user