From e5f265bb74e349fb3cf44cba0bab004b0056f7e2 Mon Sep 17 00:00:00 2001 From: Aimar Mendez Date: Mon, 2 Nov 2026 22:19:21 +0000 Subject: [PATCH] Ribbon test: pin macOS for the AutoSum tooltip, so it passes on a Mac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since #2729 the ribbon picks a tooltip's shortcut by the OS egui reports (`ctx.os()`), which egui_kittest pins to Nix unless told. The test still chose the expected text with cfg!(target_os = "macos"), so on a Mac it looked for "AutoSum (⌘⇧T)" while the harness drew "AutoSum (Alt+=)", and `cargo xtask ci` failed there while the Linux gate stayed green. The harness now pins macOS and the test expects the ⌘⇧T tooltip on every host; widgets::tests already covers the Windows/Linux "Alt+=" text. Verified on macOS 27 (arm64): `cargo xtask ci` passes all 10 steps (with CRAFT_FONTS_DIR at the gate's craft-fonts commit); on main (7bb397a3) it fails at test with "tooltip with the shortcut". --- crates/ui-egui/tests/it/ribbon_layout.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/tests/it/ribbon_layout.rs b/crates/ui-egui/tests/it/ribbon_layout.rs index 452f8ea33..fdb94b193 100644 --- a/crates/ui-egui/tests/it/ribbon_layout.rs +++ b/crates/ui-egui/tests/it/ribbon_layout.rs @@ -104,7 +104,10 @@ struct Clicks { #[test] /// The main button clicks once and the arrow twice separately; the tooltip keeps the platform shortcut, and the icon sits above the full-width label. fn big_split_button_separates_the_default_action_from_the_menu() { - let mut h = crate::common::builder().with_size(vec2(300.0, 200.0)).build_ui_state( + // The ribbon picks the shortcut by the OS egui reports, which kittest pins to Nix unless told: + // pin macOS, so the check is the same on every host (the other platforms' text is in + // `widgets::tests`). + let mut h = crate::common::builder().with_size(vec2(300.0, 200.0)).with_os(egui::os::OperatingSystem::Mac).build_ui_state( |ui, c: &mut Clicks| { let (main, arrow) = widgets::big_split_button(ui, Icon::Sum, "Auto\nSum", "AutoSum"); c.main += u32::from(main.clicked()); @@ -125,8 +128,7 @@ fn big_split_button_separates_the_default_action_from_the_menu() { h.ctx.all_styles_mut(|s| s.interaction.tooltip_delay = 0.0); h.get_by_label("Auto Sum").hover(); h.run_steps(6); - let shortcut = if cfg!(target_os = "macos") { "AutoSum (\u{2318}\u{21e7}T)" } else { "AutoSum (Alt+=)" }; - assert!(h.query_by_value(shortcut).is_some(), "tooltip with the shortcut"); + assert!(h.query_by_value("AutoSum (\u{2318}\u{21e7}T)").is_some(), "tooltip with the macOS shortcut"); // The icon part sits above the label part, across the full width. let main = h.get_by_label("Auto Sum").rect(); let arrow = h.get_by_label("Auto Sum options").rect();