-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2356ae8
commit e0798b1
Showing
10 changed files
with
141 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use egui::accesskit::Role; | ||
use egui_demo_app::{Anchor, WrapApp}; | ||
use egui_kittest::kittest::Queryable; | ||
|
||
#[test] | ||
fn test_demo_app() { | ||
let mut harness = egui_kittest::Harness::builder().build_eframe(|cc| WrapApp::new(cc)); | ||
|
||
let app = harness.state_mut(); | ||
|
||
// Mock the fractal clock time so snapshots are consistent. | ||
app.state.clock.mock_time = Some(36383.0); | ||
|
||
let apps = app | ||
.apps_iter_mut() | ||
.map(|(name, anchor, _)| (name, anchor)) | ||
.collect::<Vec<_>>(); | ||
|
||
let mut results = vec![]; | ||
|
||
for (name, anchor) in apps { | ||
// The widget gallery demo shows the current date, so we can't use it for snapshot testing | ||
if matches!(anchor, Anchor::Demo) { | ||
continue; | ||
} | ||
|
||
harness.get_by_role_and_label(Role::Button, name).click(); | ||
|
||
harness.run(); | ||
|
||
results.push(harness.try_wgpu_snapshot(&anchor.to_string())); | ||
} | ||
|
||
for result in results { | ||
result.unwrap() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters