Files
probably-rendering-one-more…/packages/brand/tests/assets.py
T
codex-bot c405f47916
Endoleap brand checks / verify (pull_request) Failing after 5s
creative workspace review checks / verify (pull_request) Has been cancelled
feat(brand): add Endoleap assets and production theme package
2026-11-01 00:22:43 +08:00

16 lines
802 B
Python

"""Render the committed SVGs only in remote CI and compare their actual pixels."""
from pathlib import Path
import io, json
from PIL import Image
import resvg_py
root = Path(__file__).resolve().parents[1]
manifest = json.loads((root / 'assets/manifest.json').read_text())
for variant in manifest['variants']:
svg = (root / f'assets/svg/{variant}.svg').read_text()
for size in manifest['png_sizes']:
actual = Image.open(io.BytesIO(resvg_py.svg_to_bytes(svg_string=svg, width=size, height=size, shape_rendering='geometric_precision'))).convert('RGBA')
stored = Image.open(root / f'assets/png/{variant}/endoleap-{size}.png').convert('RGBA')
assert actual.tobytes() == stored.tobytes(), (variant, size)
print('72 PNG assets exactly match their committed fixed-path SVGs.')