From 12ca4cc65bde174ca2a4d6eb5cd62181afef71e3 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Thu, 22 Oct 2026 17:31:42 -0600 Subject: [PATCH] #49: test that the in-window menu headings are spaced apart The File/Edit/View headings sat only egui's default 8 px apart because frameless buttons get no padding of their own. The test lays out the in-window menu bar and checks every pair of neighbouring headings is at least 24 px apart; without the item-spacing fix the gap is 4 px and the assertion fails. --- crates/ui-egui/src/menubar.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/ui-egui/src/menubar.rs b/crates/ui-egui/src/menubar.rs index 1ac3e9926..1dbd6f391 100644 --- a/crates/ui-egui/src/menubar.rs +++ b/crates/ui-egui/src/menubar.rs @@ -1395,6 +1395,23 @@ mod tests { let _ = std::fs::remove_dir_all(&dir); } + // Regression test for #49: the in-window menu headings (File, Edit, ...) sat only egui's default + // 8 px apart, too close to read or aim at. + #[test] + fn in_window_menu_headings_are_spaced_apart() { + let mut a = app(); + a.native_menu = false; + let mut h = crate::headless::Headless::new(a, [1400.0, 900.0], 1.0); + h.step(); + h.step(); + let rect = |id: &str| h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("{id} is on screen")); + let titles: Vec<_> = ["File", "Edit", "View", "Photo", "Window", "Help"].iter().map(|t| rect(&format!("menu:{t}"))).collect(); + for pair in titles.windows(2) { + let gap = pair[1].left() - pair[0].right(); + assert!(gap >= 24.0 - 0.5, "headings {:?} and {:?} are only {gap} px apart", pair[0], pair[1]); + } + } + /// A backup the host refuses (changes still unsaved, issue #1508) says why when started from /// the menu, as a refused export does; the refusal used to reach only the control channel. #[test]