Files
kryon/tests/webp_browser_test.py
T
waozi 56af335572 Integrate Material widgets, image codecs and Kryon Labs website
Add Card elevation and consistent widget states, retained TextArea selection,
and rounded image rendering. Integrate published image-codec, WebP and AVIF
packages across native hosts and renderer artifacts with project-aware builds.

Modernize Kryon Labs around visual GUI apps and modules, with real previews,
honest availability, and rebuilt interactive editor and widget gallery assets.
Bound private browser test lifecycles and verify source, saved IR, native,
portable, browser, Windows and Android paths with the published compiler.
2026-11-05 11:12:10 -03:00

24 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Decode the WebP fixtures with the canvas host in private headless Chromium."""
from toolchain import JS_RUNTIME
from pathlib import Path
import tempfile
from browser_behavior import ROOT, build_behavior, run
with tempfile.TemporaryDirectory(prefix='webp-browser-', dir=ROOT / 'build') as path:
work = Path(path)
modules = work / 'modules'
modules.mkdir()
cases = []
for fixture in sorted((ROOT / 'tests/fixtures/webp').glob('*.webp')):
cases.append(f' if name == "{fixture.stem}" {{ return "{fixture.read_bytes().hex()}" }}\n')
(modules / 'webp_browser_fixtures.zi').write_text(
'// Generated by webp_browser_test.py from tests/fixtures/webp.\n'
'WebPFixtureHex :: (name: string) -> string {\n' + ''.join(cases) + ' return ""\n}\n')
build_behavior(work, 'webp', [modules])
run([JS_RUNTIME, ROOT / 'tests/canvas_backend_browser.mjs', (work / 'test.html').as_uri(), work / 'profile'],
timeout=45)
print('WebP in the browser: lossy, lossy alpha, lossless and animated first frame decoded')