1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Allow masking widgets in kittest snapshots (#7467)

* Closes <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [ ] I have followed the instructions in the PR template
This commit is contained in:
Lucas Meurer
2025-08-21 17:46:36 +02:00
committed by GitHub
parent bf981b8d3e
commit 42c2fc58c9
3 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cdb0c0b955e3d3773a00afa61d4c44999de447aa71dd737181563101f09f5ac9
size 5444

View File

@@ -138,3 +138,24 @@ fn test_scroll_down() {
"The button was not clicked after scrolling down. (Probably not scrolled enough / at all)"
);
}
#[test]
fn test_masking() {
let mut harness = Harness::new_ui(|ui| {
let timestamp = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_millis();
ui.label("I should not be masked.");
ui.label(format!("Timestamp: {timestamp}"));
ui.label("I should also not be masked.");
});
harness.fit_contents();
let to_be_masked = harness.get_by_label_contains("Timestamp: ");
harness.mask(to_be_masked.rect());
harness.snapshot("test_masking");
}