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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx
This commit is contained in:
Martin Ball
2026-11-28 04:19:17 +00:00
co-authored by Claude Opus 5.5
parent e50ab14771
commit aaab1bbc9d
2 changed files with 16 additions and 1 deletions
@@ -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() {
@@ -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();