Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

#329: test that the Help menu works on the start screen

skylar taylor-barrick15e4fdd12433
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 87537abd7..41da5a69e 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -5642,4 +5642,17 @@ mod tests {
assert!(texts.iter().any(|t| t == "Recent files"), "{texts:?}");
assert!(texts.iter().any(|t| t == "gone"), "the card names it without `.designcraft`: {texts:?}");
}
+
+ // Regression test for #329: on the start screen (no document) the Help menu's links were greyed out.
+ #[test]
+ fn help_links_are_enabled_without_a_document() {
+ let app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ assert!(app.session.active().is_none());
+ let ids: Vec<&str> = UI_COMMANDS.iter().map(|c| c.0).filter(|id| id.starts_with("help.")).collect();
+ assert!(ids.contains(&"help.discord") && ids.contains(&"help.github"), "{ids:?}");
+ for id in ids {
+ assert!(menu_enabled(&app, id), "{id} must work from the start screen");
+ }
+ assert!(!menu_enabled(&app, "view.rulers"), "other UI commands still need a document");
+ }
}