Tests: the torn-off strip test checks the palette windows were shown first

The drawer opens and closes before the strip and the toolbar, so the
test fails when the palette windows were already hidden, and opens again
at the end. The test checks the floating strip is the Pen group's and
the custom toolbar is Mine, shown.
This commit is contained in:
dotCooCoo
2026-11-09 00:34:34 +07:00
committed by bflatastic
parent 5f0d3addf7
commit eb30d6ef78
@@ -762,13 +762,26 @@ fn a_torn_off_strip_or_a_new_toolbar_leaves_the_palette_windows_shown() {
h.host.borrow_mut().focus = ViewportId::ROOT;
h.frames(2);
take_palette_commands(&h, viewport);
// The commands go only on a change, so the drawer opening and closing shows the palette windows
// were on screen before the strip and the toolbar.
h.app.run("window.editToolbar", json!({"open": true})).unwrap();
h.frames(2);
assert_eq!(take_palette_commands(&h, viewport).0, [false], "hidden under the drawer");
h.app.run("window.editToolbar", json!({"open": false})).unwrap();
h.frames(2);
assert_eq!(take_palette_commands(&h, viewport).0, [true], "shown when the drawer closes");
h.app.run("window.floatTools", json!({"tool": "pen"})).unwrap();
h.app.run("window.toolbar.new", json!({"name": "Mine"})).unwrap();
h.frames(2);
assert!(!h.app.ui.floating_flyouts.is_empty(), "the strip floats");
assert!(h.app.ui.custom_toolbars.iter().any(|b| b.shown), "the new toolbar shows");
let strips: Vec<&str> = h.app.ui.floating_flyouts.iter().filter_map(|strip| strip.tools.first().map(String::as_str)).collect();
assert_eq!(strips, ["pen"], "the Pen strip floats");
let toolbars: Vec<(&str, bool)> = h.app.ui.custom_toolbars.iter().map(|toolbar| (toolbar.name.as_str(), toolbar.shown)).collect();
assert_eq!(toolbars, [("Mine", true)], "the new toolbar shows");
assert_eq!(h.app.ui.flyout, None, "no flyout is open");
assert_eq!(take_palette_commands(&h, viewport), (vec![], vec![]), "the palette windows are left as they were");
h.app.run("window.editToolbar", json!({"open": true})).unwrap();
h.frames(2);
assert_eq!(take_palette_commands(&h, viewport).0, [false], "still shown: the drawer hides them again");
}
/// The frame in which a click elsewhere closes a flyout or the drawer shows the palette windows, as