From 5f0d3addf77667bf255c08f9468ae96cfc86802b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 7 Nov 2026 21:17:44 -0800 Subject: [PATCH 1/2] Tests: a torn-off strip or a new toolbar leaves the palette windows shown The hidden-toolbar test now expects exactly one show command when the flyout stops drawing, and the comment at palette_window_levels names the All Tools drawer. --- crates/ui-egui/src/panel_docking.rs | 3 ++- .../ui-egui/src/panel_docking/native_tests.rs | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rs index a0205be882..9f75168ece 100644 --- a/crates/ui-egui/src/panel_docking.rs +++ b/crates/ui-egui/src/panel_docking.rs @@ -1136,7 +1136,8 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui) { } let modal = modal_open(app, &ctx); // Palette windows are OS windows of their own, held above the app's window while it is active, - // so a dialog, a menu or a tool flyout drawn in the main window would be covered by them. + // so a dialog, a menu, a tool flyout or the All Tools drawer drawn in the main window would be + // covered by them. #[cfg(not(target_arch = "wasm32"))] palette_window_levels(&ctx, &layout, modal, egui::Popup::is_any_open(&ctx) || crate::menus::menu_open(&ctx) || crate::toolbar::flyout_open(&ctx)); let mut blocked = Vec::new(); diff --git a/crates/ui-egui/src/panel_docking/native_tests.rs b/crates/ui-egui/src/panel_docking/native_tests.rs index 784b86fcf9..0f6c182d8d 100644 --- a/crates/ui-egui/src/panel_docking/native_tests.rs +++ b/crates/ui-egui/src/panel_docking/native_tests.rs @@ -750,7 +750,25 @@ fn a_flyout_or_drawer_of_a_hidden_toolbar_leaves_the_palette_windows_shown() { h.app.run("window.panels", json!({})).unwrap(); h.frames(1); assert!(!h.app.ui.toolbar && h.app.ui.flyout.is_some(), "the flyout is left set with the Tools panel hidden"); - assert_eq!(take_palette_commands(&h, viewport).0.last(), Some(&true), "shown again: the flyout does not draw"); + assert_eq!(take_palette_commands(&h, viewport).0, [true], "shown again: the flyout does not draw"); +} + +/// A strip torn off a flyout and a toolbar made with New Toolbar stay on screen like panels, so the +/// palette windows stay shown beside them. +#[test] +fn a_torn_off_strip_or_a_new_toolbar_leaves_the_palette_windows_shown() { + let mut h = Harness::new(); + let viewport = h.float("navigator"); + h.host.borrow_mut().focus = ViewportId::ROOT; + h.frames(2); + take_palette_commands(&h, viewport); + 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"); + 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"); } /// The frame in which a click elsewhere closes a flyout or the drawer shows the palette windows, as From eb30d6ef78ea46807fcb10c6f1e3dbf74be7f6da Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 8 Nov 2026 06:12:34 -0800 Subject: [PATCH 2/2] 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. --- .../ui-egui/src/panel_docking/native_tests.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panel_docking/native_tests.rs b/crates/ui-egui/src/panel_docking/native_tests.rs index 0f6c182d8d..5e72e61afd 100644 --- a/crates/ui-egui/src/panel_docking/native_tests.rs +++ b/crates/ui-egui/src/panel_docking/native_tests.rs @@ -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