diff --git a/crates/ui-egui/src/menu_catalog.rs b/crates/ui-egui/src/menu_catalog.rs index 10d1b57d61..b84e5adeef 100644 --- a/crates/ui-egui/src/menu_catalog.rs +++ b/crates/ui-egui/src/menu_catalog.rs @@ -468,6 +468,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[ (&["Type", "Anti-Alias"], "---", None, "---"), (&["Type", "Anti-Alias"], "Windows LCD", None, "type.antiAlias.windowsLcd"), (&["Type", "Anti-Alias"], "Windows", None, "type.antiAlias.windows"), + (&["Type"], "---", None, "---"), (&["Type", "Orientation"], "Horizontal", None, "type.orientation.horizontal"), (&["Type", "Orientation"], "Vertical", None, "type.orientation.vertical"), (&["Type", "OpenType"], "Standard Ligatures", None, "type.openType.standardLigatures"), @@ -524,6 +525,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[ (&["Type", "Font Preview Size"], "Large", None, "type.fontPreviewSize.large"), (&["Type", "Font Preview Size"], "Extra Large", None, "type.fontPreviewSize.extraLarge"), (&["Type", "Font Preview Size"], "Huge", None, "type.fontPreviewSize.huge"), + (&["Type"], "---", None, "---"), (&["Type", "Language Options"], "Default Features", None, "type.languageOptions.defaultFeatures"), (&["Type", "Language Options"], "East Asian Features", None, "type.languageOptions.eastAsianFeatures"), (&["Type", "Language Options"], "Middle Eastern Features", None, "type.languageOptions.middleEasternFeatures"), @@ -828,3 +830,7 @@ pub const ARRANGE_ICONS: &[(&str, &str)] = &[ ("window.arrange.sixUp", "arrange-six-up"), ("window.arrange.consolidateAllToTabs", "arrange-consolidate-all-to-tabs"), ]; + +#[cfg(test)] +#[path = "menus/type_menu_groups_tests.rs"] +mod type_menu_groups_tests; diff --git a/crates/ui-egui/src/menus/type_menu_groups_tests.rs b/crates/ui-egui/src/menus/type_menu_groups_tests.rs new file mode 100644 index 0000000000..477186a8be --- /dev/null +++ b/crates/ui-egui/src/menus/type_menu_groups_tests.rs @@ -0,0 +1,23 @@ +use crate::PhotocraftApp; +use craft::menu::{Node, from_items}; + +#[test] +fn type_submenus_keep_their_reference_groups() { + let app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default()); + let bar = from_items(&["Type"], &crate::menus::menu_rows(&app)); + let entries: Vec<_> = bar.menus[0] + .children + .iter() + .map(|node| match node { + Node::Separator => "---", + Node::Submenu { label, .. } | Node::Heading(label) => label.as_str(), + Node::Item(row) => row.command.id.as_str(), + _ => "", + }) + .collect(); + assert!(entries.windows(6).any(|rows| rows == ["---", "Anti-Alias", "---", "Orientation", "OpenType", "---"]), "{entries:?}"); + assert!(entries.windows(6).any(|rows| rows == ["---", "Font Preview Size", "---", "Language Options", "---", "type.updateAllTextLayers"]), "{entries:?}"); + let warp = entries.iter().position(|entry| *entry == "type.warpText").unwrap(); + let preview = entries.iter().position(|entry| *entry == "Font Preview Size").unwrap(); + assert!(warp < preview, "{entries:?}"); +}