From e32a5dc120f8886919ff31e0ca6607edbbb036da Mon Sep 17 00:00:00 2001 From: SoldierPePe Date: Thu, 5 Nov 2026 03:08:19 +0300 Subject: [PATCH] M10: a minimized mirrored window keeps its Expand button where the rail was Minimize (#1835) puts an Expand button where the navigation bar was. In a mirrored window the rail is on the right, so the button goes to the top right there; the test pins both sides. --- crates/ui-egui/src/mirror_tests.rs | 15 +++++++++++++++ crates/ui-egui/src/panel_width_tests.rs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/mirror_tests.rs b/crates/ui-egui/src/mirror_tests.rs index b64ae828c..a316165e6 100644 --- a/crates/ui-egui/src/mirror_tests.rs +++ b/crates/ui-egui/src/mirror_tests.rs @@ -89,3 +89,18 @@ fn switching_back_unmirrors_the_window_and_egui() { assert_eq!(canvas(&u), (layers::RAIL_WIDTH + PANEL_DEFAULT, WINDOW_W - PANEL_DEFAULT)); assert!(!u.ctx.global_style().right_to_left); } + +#[test] +fn a_minimized_window_has_its_expand_button_where_the_rail_was() { + use egui::accesskit::Role; + for mirrored in [true, false] { + let mut u = ui(mirrored); + u.app.run("select.set", json!({"ids": []})); + u.app.run("view.minimize", json!({"on": true})); + u.frame(vec![]); + let expand = crate::panel_width_tests::control(&mut u, Role::Button, "Expand the interface").expect("the Expand button"); + // 32 wide, 8 from the window's edge. + let x = if mirrored { WINDOW_W - 24.0 } else { 24.0 }; + assert_eq!(expand.x, x, "mirrored: {mirrored}"); + } +} diff --git a/crates/ui-egui/src/panel_width_tests.rs b/crates/ui-egui/src/panel_width_tests.rs index 357b13669..73b5859eb 100644 --- a/crates/ui-egui/src/panel_width_tests.rs +++ b/crates/ui-egui/src/panel_width_tests.rs @@ -211,7 +211,7 @@ fn minimize_ui_hides_the_panels_and_keeps_their_widths() { } /// The middle of the accessible control with `role` and `label`, if one shows. -fn control(u: &mut Ui, role: egui::accesskit::Role, label: &str) -> Option { +pub(crate) fn control(u: &mut Ui, role: egui::accesskit::Role, label: &str) -> Option { u.ctx.enable_accesskit(); u.frame(vec![]); let out = u.frame_output(vec![]);