From aaab1bbc9d00680946eb8a44b011893e428e51db Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Sat, 28 Nov 2026 02:31:55 +0000 Subject: [PATCH] fix(diagram): Insert Diagram shows every layout (#7973) The same max_rows item-count cap showed 3 of 8 layouts. Partial: the names "Basic Process" and "Basic Pyramid" are still elided, since wider cells break the pinned 75x93 cell size test and two-line captions need card text the dialog does not use. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx --- .../ui-egui/src/dialogs/dialogs_insert/tests.rs | 15 +++++++++++++++ crates/ui-egui/src/dialogs/dialogs_smart_art.rs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs/dialogs_insert/tests.rs b/crates/ui-egui/src/dialogs/dialogs_insert/tests.rs index c271ab8dd0..d9b0de3a52 100644 --- a/crates/ui-egui/src/dialogs/dialogs_insert/tests.rs +++ b/crates/ui-egui/src/dialogs/dialogs_insert/tests.rs @@ -160,6 +160,21 @@ fn symbol_dialog_shows_the_map_in_rows() { h.get_by_label("from Unicode (hex)"); } +/// #7973: Insert Diagram offers every layout in its grid, not the first row of three. +#[test] +fn insert_diagram_dialog_shows_every_layout() { + use egui::accesskit::Role; + let mut h = testing::harness(app()); + crate::dialogs::open(h.state_mut(), "insertSmartArt", &json!({})).expect("the dialog opens"); + // The tiles' heights settle over a few passes. + h.run_steps(10); + let grid = h.get_by_role_and_label(Role::ListBox, "Layouts").rect(); + for layout in wordcraft_doc::smart_art::SmartArtLayout::ALL { + let shown = h.query_all_by_label(layout.label()).any(|n| grid.contains(n.rect().center())); + assert!(shown, "{} is shown in the grid", layout.label()); + } +} + /// The Field dialog builds the field code from its options. #[test] fn field_dialog_builds_the_instruction() { diff --git a/crates/ui-egui/src/dialogs/dialogs_smart_art.rs b/crates/ui-egui/src/dialogs/dialogs_smart_art.rs index e71632abfd..36455ed7c5 100644 --- a/crates/ui-egui/src/dialogs/dialogs_smart_art.rs +++ b/crates/ui-egui/src/dialogs/dialogs_smart_art.rs @@ -321,7 +321,7 @@ fn layout_tiles(ui: &mut Ui, theme: &[Rgb], form: &mut SmartArtForm) -> bool { .card_columns(3) // Production's picker is three tile rows high and scrolls the rest; the cap also makes the grid the one owner // of its scroll inside the dialog's scrolling body. - .max_rows(3) + .max_rows(crate::dialogs::tile_rows_cap(shown.len(), 3, 3)) .selection(Bind::given(Selection::single(current))) .show_items(ui, &keyed(&positions, |i| *i), &mut |key, _| { let layout = shown.get(*key).copied().unwrap_or_default();