LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
#49: test that the in-window menu headings are spaced apart
skylar taylor-barrick12ca4cc65bde
diff --git a/crates/ui-egui/src/menubar.rs b/crates/ui-egui/src/menubar.rsindex 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]