From cc006451b682f6d2c1836db16bc324dfa115cabc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 28 Jun 2026 20:55:52 +0300 Subject: Assert generated page tiles flush (cell total multiple of 12) Closes the last output-coverage gap from the gauge-bar audit: the flush guarantee (a page's grid-cell total is a multiple of 12 so it forms a complete rectangle at 2/3/4/6 columns) was only unit-tested on the alignment helper and via markup presence. The dense-packing check that verified it on real albums was a throwaway. test_generate_preview_grid_ emits_every_tile_shape now computes the generated page-1 cell total (features=4 cells, others=1) and asserts it is a positive multiple of 12, and that the pinned seed still yields both a feature and a subdivided tile. Co-Authored-By: Claude Opus 4.8 --- tests/cli.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/cli.sh b/tests/cli.sh index f158ad5..73748b2 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -669,6 +669,31 @@ test_generate_preview_grid_emits_every_tile_shape() { test::assert_contains 'grid-template-columns: repeat(4, 1fr)' "$page_html" test::assert_contains 'grid-template-columns: repeat(6, 1fr)' "$page_html" + # Flush PROPERTY (the guarantee behind the fixed-column grid): the generated + # page's total grid cells must be a positive multiple of 12 (LCM of 2/3/4/6) + # so it tiles into a complete rectangle -- no ragged/cut-off bottom at any + # breakpoint. Cell footprint: a 2x2 feature is 4 cells, every other top-level + # tile (single / subdivided) is 1. The unit test exercises the alignment + # helper in isolation; this asserts a real GENERATED page actually lands on a + # multiple of 12. The feature/subdivided counts being non-zero also guards + # that the pinned seed still produces both shapes (so the markup assertions + # below stay meaningful if the roll logic ever changes). + local -i grid_thumbs grid_features grid_tiles grid_cells + grid_thumbs=$(grep -o "class='thumb " <<< "$page_html" | wc -l) + grid_features=$(grep -o "class='feature'" <<< "$page_html" | wc -l) + grid_tiles=$(grep -o "
" <<< "$page_html" | wc -l) + grid_cells=$(( grid_thumbs + 3 * grid_features + grid_tiles )) + if (( grid_features == 0 || grid_tiles == 0 )); then + printf 'FAIL: pinned seed no longer yields a feature AND a subdivided tile (feat=%d tiles=%d)\n' \ + "$grid_features" "$grid_tiles" >&2 + exit 1 + fi + if (( grid_cells == 0 || grid_cells % 12 != 0 )); then + printf 'FAIL: generated page-1 grid cells %d is not a positive multiple of 12 (ragged page)\n' \ + "$grid_cells" >&2 + exit 1 + fi + # (1) Single thumbnail: a plain anchor (no anchor class) wrapping an # linking to its view page. test::assert_contains "" "$page_html" -- cgit v1.2.3