mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -04:00
Add tests for the ui and dbg format and use idmap
This commit is contained in:
3
crates/egui_kittest/tests/snapshots/id_popup_0.png
Normal file
3
crates/egui_kittest/tests/snapshots/id_popup_0.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5a6b2bc514547975d3321bb1e09ab913a3733686c7412258180ad43be048d2fe
|
||||
size 11889
|
||||
3
crates/egui_kittest/tests/snapshots/id_popup_1.png
Normal file
3
crates/egui_kittest/tests/snapshots/id_popup_1.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:43d3a9d413de27ac0ace3afead63cb54f14c53fc5098ed493cd0e3592f9ff108
|
||||
size 20901
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user