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.
This commit is contained in:
SoldierPePe
2026-11-05 03:08:19 +03:00
parent 30fe964244
commit e32a5dc120
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -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}");
}
}
+1 -1
View File
@@ -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<Pos2> {
pub(crate) fn control(u: &mut Ui, role: egui::accesskit::Role, label: &str) -> Option<Pos2> {
u.ctx.enable_accesskit();
u.frame(vec![]);
let out = u.frame_output(vec![]);