DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Paragraph panel: Define Lists… opens its dialog; tests for First Line Only in the three panels
aionggf48ea43a632d
diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rsindex 5ce5a808a..6deace3fc 100644--- a/crates/ui-egui/src/panels/properties.rs+++ b/crates/ui-egui/src/panels/properties.rs@@ -2143,8 +2143,9 @@ fn paragraph_panel_menu(app: &mut DesignApp, ui: &mut Ui, p: &Value) {if let Some(attrs) = attrs {let _ = app.run("type.para", json!({"attrs": attrs}));}+ // As a menu choice: Define Lists… and the other commands open their dialogs.if let Some(id) = command {- crate::menus::activate(app, id, &json!({}));+ crate::menus::activate(app, id, &Value::Null);}}@@ -3433,6 +3434,34 @@ mod tests {assert!(h.query_by_label("Small Caps").is_none());}+ /// The Paragraph panel on a First Line Only paragraph: Align to Baseline Grid shows pressed+ /// and keeps First Line Only, and the panel menu checks Only Align First Line to Grid.+ #[test]+ fn paragraph_panel_keeps_first_line_only() {+ let mut app = text_app();+ app.run("type.para", json!({"attrs": {"gridAlign": "firstLineOnly"}})).unwrap();+ let mut h = panel_harness(app, paragraph_panel);+ h.run_steps(3);+ assert_eq!(h.get_by_label("Align to Baseline Grid").accesskit_node().toggled(), Some(egui::accesskit::Toggled::True));+ h.get_by_label("Align to Baseline Grid").click();+ h.run_steps(3);+ assert_eq!(text_attrs(h.state_mut()).unwrap()["para"]["gridAlign"], "firstLineOnly");+ h.get_by_label("☰").click();+ h.run_steps(3);+ let _ = h.get_by_label("✓ Only Align First Line to Grid");+ }++ #[test]+ fn paragraph_panel_menu_define_lists_opens_its_dialog() {+ let mut h = panel_harness(text_app(), paragraph_panel);+ h.run_steps(3);+ h.get_by_label("☰").click();+ h.run_steps(3);+ h.get_by_label("Define Lists…").click();+ h.run_steps(3);+ assert!(h.state_mut().ui.dialog.is_some(), "Define Lists");+ }+#[test]fn paragraph_panel_is_laid_out_as_indesigns_with_its_panel_menu() {let mut h = panel_harness(text_app(), paragraph_panel);