From 08d077d97a3cf697fa5ae5c61802f64831d58827 Mon Sep 17 00:00:00 2001 From: Sazid Al Bayazid Date: Tue, 20 Oct 2026 09:55:14 +0600 Subject: [PATCH] Tests: open the folded Window group to reach the Full Screen button (#2864) The ribbon now shrinks its groups to fit the window (#662), and on the View tab the Window group folds into a drop-down at 1440 pt: the Full Screen button then lives in that menu, so the a11y query no longer finds it and the test failed on the folded ribbon. Open the group when it is folded, and click the button where it is. --- crates/ui-egui/src/lib.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 8ae7c451b..7a01817b6 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -6920,14 +6920,27 @@ mod tests { for _ in 0..3 { h.step(); } - // The click's frames carry the viewport command, so collect while clicking. - let click_full_screen = |h: &mut egui_kittest::Harness| { - let mut out = Vec::new(); + // The View tab's Window group folds into a drop-down when the window is narrow (#662), + // and the button then lives in that menu: open the group when it is folded. + fn full_screen<'a>(h: &'a egui_kittest::Harness<'a, WordApp>) -> Option> { h.query_all(egui_kittest::kittest::By::new().role(egui::accesskit::Role::Button)) .into_iter() .find(|n| n.accesskit_node().label().as_deref().is_some_and(|l| l.replace('\n', " ").contains("Full Screen"))) - .unwrap_or_else(|| panic!("the Full Screen button is on the View tab")) + } + if full_screen(&h).is_none() { + h.query_all(egui_kittest::kittest::By::new().role(egui::accesskit::Role::Button)) + .into_iter() + .find(|n| n.accesskit_node().label().as_deref() == Some("Window")) + .unwrap_or_else(|| panic!("the View tab has a Window group")) .click(); + for _ in 0..2 { + h.step(); + } + } + // The click's frames carry the viewport command, so collect while clicking. + let click_full_screen = |h: &mut egui_kittest::Harness| { + let mut out = Vec::new(); + full_screen(h).unwrap_or_else(|| panic!("the Full Screen button is on the View tab")).click(); for _ in 0..2 { h.step(); out.extend(h.output().viewport_output.values().flat_map(|v| v.commands.iter()).filter(|c| matches!(c, Fullscreen(_))).cloned());