mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Better framing of demo snapshots (#7787)
This commit is contained in:
@@ -372,8 +372,8 @@ fn file_menu_button(ui: &mut Ui) {
|
||||
mod tests {
|
||||
use crate::{Demo as _, demo::demo_app_windows::DemoGroups};
|
||||
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::{Harness, OsThreshold, SnapshotOptions, SnapshotResults};
|
||||
use egui::Vec2;
|
||||
use egui_kittest::{HarnessBuilder, OsThreshold, SnapshotOptions, SnapshotResults};
|
||||
|
||||
#[test]
|
||||
fn demos_should_match_snapshot() {
|
||||
@@ -394,20 +394,15 @@ mod tests {
|
||||
|
||||
let name = remove_leading_emoji(demo.name());
|
||||
|
||||
let mut harness = Harness::new_ui(|ui| {
|
||||
egui_extras::install_image_loaders(ui);
|
||||
demo.show(ui, &mut true);
|
||||
});
|
||||
let mut harness = HarnessBuilder::default()
|
||||
.with_size(Vec2::splat(2048.0))
|
||||
.build_ui(|ui| {
|
||||
egui_extras::install_image_loaders(ui);
|
||||
demo.show(ui, &mut true);
|
||||
});
|
||||
|
||||
let window = harness
|
||||
.get_all_by_role(egui::accesskit::Role::Window)
|
||||
.next()
|
||||
.unwrap();
|
||||
// TODO(lucasmerlin): Windows should probably have a label?
|
||||
//let window = harness.get_by_label(name);
|
||||
|
||||
let size = window.rect().size();
|
||||
harness.set_size(size);
|
||||
// Resize to fit every window, plus some margin:
|
||||
harness.set_size(harness.ctx.globally_used_rect().max.to_vec2() + Vec2::splat(16.0));
|
||||
|
||||
// Run the app for some more frames...
|
||||
harness.run_ok();
|
||||
|
||||
Reference in New Issue
Block a user