-
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.
Co-authored-by: Andreas Reich <r_andreas2@web.de>
- Loading branch information
1 parent
ee4ab08
commit 46b58e5
Showing
28 changed files
with
591 additions
and
178 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,78 @@ | ||
use egui::accesskit::Role; | ||
use egui::Vec2; | ||
use egui_demo_app::{Anchor, WrapApp}; | ||
use egui_kittest::kittest::Queryable; | ||
|
||
#[test] | ||
fn test_demo_app() { | ||
let mut harness = egui_kittest::Harness::builder() | ||
.with_size(Vec2::new(900.0, 600.0)) | ||
.wgpu() | ||
.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<_>>(); | ||
|
||
#[cfg(feature = "wgpu")] | ||
assert!( | ||
apps.iter() | ||
.any(|(_, anchor)| matches!(anchor, Anchor::Custom3d)), | ||
"Expected to find the Custom3d app.", | ||
); | ||
|
||
let mut results = vec![]; | ||
|
||
for (name, anchor) in apps { | ||
harness.get_by_role_and_label(Role::Button, name).click(); | ||
|
||
match anchor { | ||
// The widget gallery demo shows the current date, so we can't use it for snapshot testing | ||
Anchor::Demo => { | ||
continue; | ||
} | ||
// This is already tested extensively elsewhere | ||
Anchor::Rendering => { | ||
continue; | ||
} | ||
// We don't want to rely on a network connection for tests | ||
#[cfg(feature = "http")] | ||
Anchor::Http => { | ||
continue; | ||
} | ||
// Load a local image where we know it exists and loads quickly | ||
#[cfg(feature = "image_viewer")] | ||
Anchor::ImageViewer => { | ||
harness.run(); | ||
|
||
harness | ||
.get_by_role_and_label(Role::TextInput, "URI:") | ||
.focus(); | ||
harness.press_key_modifiers(egui::Modifiers::COMMAND, egui::Key::A); | ||
|
||
harness | ||
.get_by_role_and_label(Role::TextInput, "URI:") | ||
.type_text("file://../eframe/data/icon.png"); | ||
|
||
harness.get_by_role_and_label(Role::Button, "✔").click(); | ||
} | ||
_ => {} | ||
} | ||
|
||
harness.run(); | ||
|
||
if let Err(e) = harness.try_snapshot(&anchor.to_string()) { | ||
results.push(e); | ||
} | ||
} | ||
|
||
if let Some(error) = results.first() { | ||
panic!("{error}"); | ||
} | ||
} |
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
Oops, something went wrong.