Compare commits

...
Author SHA1 Message Date
skylar taylor-barrick 12ca4cc65b #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.
2026-10-22 17:31:42 -06:00
+17
View File
@@ -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]