test: add reproducible 720p visual capture

This commit is contained in:
goose
2026-10-08 22:33:52 -04:00
parent cf102e1e95
commit 23acd47495
6 changed files with 166 additions and 16 deletions
+17 -2
View File
@@ -17,9 +17,11 @@ if [[ " $* " == *" --import "* ]]; then
printf '%s\n' "fake import output" >&2
exit "${FAKE_IMPORT_STATUS:-0}"
fi
if [[ " $* " == *" --capture "* || " $* " == *" --capture-exit "* ]]; then
if [[ " $* " == *" --capture "* || " $* " == *" --capture-exit "* || " $* " == *" --visual-check-compact "* ]]; then
if [[ " $* " == *" --capture-exit "* ]]; then
capture_name="visual-check-exit.png"
elif [[ " $* " == *" --visual-check-compact "* ]]; then
capture_name="visual-check-compact.png"
else
capture_name="visual-check.png"
fi
@@ -30,7 +32,8 @@ import sys
import zlib
os.makedirs("artifacts", exist_ok=True)
width, height = 1920, 1080
compact = sys.argv[1] == "visual-check-compact.png"
width, height = (1280, 720) if compact else (1920, 1080)
unknown = (1, 2, 5)
visible = (176, 176, 176)
# Match the blue-black explored tile palette accepted by the real capture
@@ -74,6 +77,18 @@ assert_import_precedes_run() {
}
}
visual_log="$tmp_dir/run-visual-check.sh.log"
FAKE_GODOT_LOG="$visual_log" GODOT_BIN="$fake_godot" DISPLAY=:99 "$project_dir/scripts/run-visual-check.sh"
compact_run="$(grep -- '--visual-check-compact' "$visual_log")"
[[ "$compact_run" == *"--windowed"* && "$compact_run" == *"--resolution 1280x720"* ]] || {
echo "run-visual-check.sh did not request a real 1280x720 compact window" >&2
exit 1
}
[[ -s "$project_dir/artifacts/visual-check-compact.png" ]] || {
echo "run-visual-check.sh did not produce a compact capture" >&2
exit 1
}
assert_import_precedes_run test-unit.sh
assert_import_precedes_run test-e2e.sh
assert_import_precedes_run run-visual-check.sh