summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-15 13:26:28 +0300
committerPaul Buetow <paul@buetow.org>2026-06-15 23:50:40 +0300
commit6e47246dbbc97821b97aa9c45352abc9c2a9aa4a (patch)
treeaa893f4ef633f76faab5731313de2d694a1de94e /tests
parent3adeaa68af3bac73450a4156edb51fd1ec88347a (diff)
Stats/camera pages: blurred background, album-like camera thumbs, spacing
Three refinements to the stats site: - Stats and per-camera pages now get a random blurred background image (same seeded pick the album preview pages use) instead of a plain black page. Adds _stats_random_background + STATS_BLURS_DIR; falls back to black when no photos exist (e.g. isolated unit tests). - Per-camera thumbnails now behave like the main album: they link to each photo's album view page (navigation, details, EXIF tooltip) and carry the same seeded animation class, instead of linking to the raw image. render_album_pages records a photo -> "<page>-<preview>" map (ALBUM_VIEW_PAGE_BY_PHOTO) that the camera pages read; photos with no recorded view page fall back to the image. - Spacing: the camera leaderboard rows get padding + a separator line so the long wrapping camera names are distinguishable, and the stats sections, headings, bar rows, back-link, and camera grid get moderate extra spacing so nothing looks cramped. Tests updated for the new camera-thumbnail markup and extended to assert the stats background and the album view-page links; camera.tmpl comment corrected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cli.sh27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/cli.sh b/tests/cli.sh
index f01c2e0..14439bf 100755
--- a/tests/cli.sh
+++ b/tests/cli.sh
@@ -3060,6 +3060,7 @@ test::stats_identify_output() {
}
test_generate_stats_pages_created_and_nav_linked() {
+ local camera_html
local config_file
local fake_bin
local -i nav_links
@@ -3088,6 +3089,21 @@ test_generate_stats_pages_created_and_nav_linked() {
test::assert_contains 'Canon EOS R5' "$(<"$TEST_TMPDIR/dist/stats.html")"
test::assert_not_contains '<script' "$(<"$TEST_TMPDIR/dist/stats.html")"
+ # The stats page gets a random blurred background like the album pages.
+ test::assert_contains 'background-image: url("./blurs/' \
+ "$(<"$TEST_TMPDIR/dist/stats.html")"
+
+ # Camera-page thumbnails link into the album view pages (behave like the main
+ # album), not the raw image, and point at the thumbs.
+ camera_html=$(<"$TEST_TMPDIR/dist/camera-canon-eos-r5.html")
+ test::assert_contains 'src="./thumbs/' "$camera_html"
+ test::assert_not_contains 'href="./photos/' "$camera_html"
+ if ! grep -Eq 'href="\./[0-9]+-[0-9]+\.html"' <<< "$camera_html"; then
+ printf 'FAIL: camera page does not link thumbnails to album view pages\n' \
+ >&2
+ exit 1
+ fi
+
# The header bar links to the stats page on at least one generated page.
nav_links=$(grep -lF 'stats.html">Stats' "$TEST_TMPDIR"/dist/*.html | wc -l)
test "$nav_links" -gt 0
@@ -4001,6 +4017,8 @@ MAXPREVIEWS=40
ORIGINAL_BASEPATH=''
TARBALL_INCLUDE=no
SHURIKEN_OUTPUT_MODE=quiet
+# Seed so the per-thumbnail animation class is reproducible across runs.
+RANDOM_SEED=camera-test
apply_config_defaults
feed() {
@@ -4040,11 +4058,14 @@ BASH
test::assert_file_exists "$dist_dir/run1/camera-canon-eos-5d-2.html"
test::assert_file_exists "$dist_dir/run1/camera-nikon-co-z6.html"
- # The Canon EOS 5D page lists exactly its two photos as thumbnails linking to
- # the full images under photos/, and not the other camera's photo.
+ # The Canon EOS 5D page lists exactly its two photos as thumbnails, and not
+ # the other camera's photo. With no album rendered here, the thumbnail link
+ # falls back to the full image under photos/; the img carries a thumb class
+ # (plus a seeded animation class) pointing at thumbs/.
html=$(cat "$dist_dir/run1/camera-canon-eos-5d.html")
test::assert_contains '<a href="../photos/a.jpg">' "$html"
- test::assert_contains '<img class="thumb" src="../thumbs/a.jpg" />' "$html"
+ test::assert_contains 'class="thumb ' "$html"
+ test::assert_contains 'src="../thumbs/a.jpg" />' "$html"
test::assert_contains '<a href="../photos/b.jpg">' "$html"
test::assert_not_contains 'photos/c.png' "$html"
test::assert_not_contains 'photos/d.jpg' "$html"