Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Page box test: the menu's entries found among the names the window shows elsewhere too

moppeeer34d97eae377e
diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs
index eb84e74ca..742aba403 100644
--- a/crates/ui-egui/src/chrome/tests.rs
+++ b/crates/ui-egui/src/chrome/tests.rs
@@ -203,16 +203,18 @@ fn the_page_box_names_the_parent_in_view_and_lists_the_parents() {
h.get_by(|n| n.role() == Role::ComboBox && n.label().as_deref() == Some("Page")).click();
h.run_steps(3);
for name in ["1", "2", "3", "4", "A-Parent"] {
- assert!(h.query_by_label(name).is_some(), "{name} is listed");
+ // The canvas or a panel may show the name too: the menu lists it.
+ assert!(h.query_all_by_label(name).next().is_some(), "{name} is listed");
}
- h.get_by_label("B-Cover").click();
+ // The menu, drawn last, holds the last match.
+ h.get_all_by_label("B-Cover").last().unwrap().click();
h.run_steps(6);
assert_eq!(shown(&h), "B-Cover");
assert_eq!(crate::canvas::current_parent_page(&h.state().app).map(|(i, _)| i), Some(1));
// A page: the parents are left.
h.get_by(|n| n.role() == Role::ComboBox && n.label().as_deref() == Some("Page")).click();
h.run_steps(3);
- h.get_by_label("3").click();
+ h.get_all_by_label("3").last().unwrap().click();
h.run_steps(6);
assert!(!h.state().app.session.active().unwrap().editing_parents);
assert_eq!(crate::canvas::current_page(&h.state().app), Some(2));