Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions crates/ui-egui/src/dialogs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4898,20 +4898,26 @@ mod tests {
app.run("ui.dialog", json!({"name": "selectByAttributes"})).unwrap();
let mut h = app_harness(app);
h.run_steps(3);
// The match count repaints independently. Wait only for the requested menu entry.
let pick_value = |h: &mut egui_kittest::Harness<'static, RustGisApp>, value: &str| {
h.get_by_role_and_label(Role::Button, "Values ▾").click();
for _ in 0..10 {
h.step();
if h.query_by_role_and_label(Role::Button, value).is_some() {
break;
}
}
h.get_by_role_and_label(Role::Button, value).click();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the entry never appears, the poll gives up after ten steps and the get_by_role_and_label below panics with a generic "node not found", which does not say which value was missing. Asserting first names it in the failure:

Suggested change
h.get_by_role_and_label(Role::Button, value).click();
assert!(h.query_by_role_and_label(Role::Button, value).is_some(), "{value} is not listed under Values");
h.get_by_role_and_label(Role::Button, value).click();

Category: quality

h.step();
};
h.get_by_role_and_label(Role::Button, "name").click();
h.run();
h.step();
h.state_mut().dialogs.text = "name LIKE ".into();
h.get_by_role_and_label(Role::Button, "Values ▾").click();
h.run();
h.get_by_role_and_label(Role::Button, "'a_b'").click();
h.run();
pick_value(&mut h, "'a_b'");
assert_eq!(h.state().dialogs.text, "name LIKE ", "nothing written");
assert!(h.query_by_label_contains("matches more than itself").is_some(), "and it says why");
// Another value goes in, and the note goes.
h.get_by_role_and_label(Role::Button, "Values ▾").click();
h.run();
h.get_by_role_and_label(Role::Button, "'plain'").click();
h.run();
pick_value(&mut h, "'plain'");
assert_eq!(h.state().dialogs.text, "name LIKE 'plain' ");
assert!(h.query_by_label_contains("matches more than itself").is_none());
}
Expand Down
Loading