1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Add tests for the ui and dbg format and use idmap

This commit is contained in:
lucasmerlin
2026-03-20 10:07:11 +01:00
parent 9b7fc3c18f
commit f1392b1490
4 changed files with 53 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
use egui::{Modifiers, ScrollArea, Vec2, include_image};
use egui::{include_image, Id, Modifiers, ScrollArea, Vec2};
use egui_kittest::{Harness, SnapshotResults};
use kittest::Queryable as _;
@@ -182,6 +182,30 @@ fn test_masking() {
harness.snapshot("test_masking");
}
#[test]
fn test_id_popup() {
let ids = [
Id::new("parent_id").with("with_source"),
Id::new(Id::new("parent_id")).with(Id::new("with_source").with("some other thing")),
];
let mut results = SnapshotResults::new();
for (idx, id) in ids.into_iter().enumerate() {
let mut harness = Harness::builder()
.with_size(Vec2::new(300.0, 400.0))
.build_ui(move |ui| {
id.ui(ui);
});
harness.get_by_label_contains(&id.short_debug_format()).hover();
harness.run();
harness.fit_contents();
results.add(harness.try_snapshot(format!("id_popup_{}", idx)));
}
}
#[test]
fn test_remove_cursor() {
let hovered = false;