fix: finalize S6.1 visual capture verification

This commit is contained in:
goose
2026-10-01 22:02:32 -04:00
parent 4919369dba
commit 673c1c1257
5 changed files with 219 additions and 96 deletions
+11 -2
View File
@@ -27,11 +27,20 @@ if [[ " $* " == *" --capture "* || " $* " == *" --capture-exit "* ]]; then
import os
import struct
import sys
import zlib
os.makedirs("artifacts", exist_ok=True)
width, height = 1280, 720
color = (199, 207, 217) if sys.argv[1].endswith("-exit.png") else (4, 6, 18)
scanlines = b"".join(b"\x00" + bytes(color) * width for _ in range(height))
def chunk(kind, data):
return struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data) & 0xFFFFFFFF)
png = b"\x89PNG\r\n\x1a\n"
png += chunk(b"IHDR", struct.pack(">IIBBBBB", width, height, 8, 2, 0, 0, 0))
png += chunk(b"IDAT", zlib.compress(scanlines))
png += chunk(b"IEND", b"")
with open(f"artifacts/{sys.argv[1]}", "wb") as capture:
capture.write(b"\x89PNG\r\n\x1a\n")
capture.write(struct.pack(">I4sII5B", 13, b"IHDR", 1280, 720, 8, 2, 0, 0, 0))
capture.write(png)
PY
fi
exit 0