|
359 | 359 | printf ' FAIL --stagger did not measurably shrink width (%s → %s pt)\n' "$raw_w" "$stag_w" |
360 | 360 | fi |
361 | 361 | fi |
362 | | -# --stagger=0 must always produce identical output to the no-unflatten baseline. |
| 362 | +# --stagger=0 must produce a valid PNG (same shape as the happy-path PNG smoke |
| 363 | +# above): capture the exit code, treat a Playwright-skip stderr as skip, and |
| 364 | +# fail loudly for anything else. |
363 | 365 | "$SCRIPT" "$FIX/happy.json" --stagger=0 --out "$tmp/stag0.png" \ |
364 | | - >/dev/null 2>"$tmp/stag0.err" || true |
365 | | -if grep -qE "$png_skip_re" "$tmp/stag0.err" 2>/dev/null; then |
366 | | - printf ' skip --stagger=0 PNG (Playwright/Chromium not available)\n' |
367 | | -elif [ ! -s "$tmp/stag0.png" ] && [ ! -e "$tmp/stag0.png" ]; then |
368 | | - : # nothing to assert |
369 | | -elif file "$tmp/stag0.png" 2>/dev/null | grep -q 'PNG image'; then |
| 366 | + >/dev/null 2>"$tmp/stag0.err" |
| 367 | +rc=$? |
| 368 | +if [ "$rc" -ne 0 ]; then |
| 369 | + if grep -qE "$png_skip_re" "$tmp/stag0.err"; then |
| 370 | + printf ' skip --stagger=0 PNG (Playwright/Chromium not available)\n' |
| 371 | + else |
| 372 | + fail=$((fail + 1)) |
| 373 | + printf ' FAIL --stagger=0 exited %d\n' "$rc" |
| 374 | + sed 's/^/ /' < "$tmp/stag0.err" |
| 375 | + fi |
| 376 | +elif [ ! -s "$tmp/stag0.png" ]; then |
| 377 | + fail=$((fail + 1)) |
| 378 | + printf ' FAIL --stagger=0 produced empty output\n' |
| 379 | +elif ! file "$tmp/stag0.png" 2>/dev/null | grep -q 'PNG image'; then |
| 380 | + fail=$((fail + 1)) |
| 381 | + printf ' FAIL --stagger=0 output is not a PNG (file: %s)\n' \ |
| 382 | + "$(file "$tmp/stag0.png" 2>/dev/null || echo unknown)" |
| 383 | +else |
370 | 384 | pass=$((pass + 1)) |
371 | 385 | printf ' ok --stagger=0 renders a PNG\n' |
372 | 386 | fi |
|
0 commit comments