Add streaming TypeScript GUI

This commit is contained in:
Meta Vens 2026-04-24 15:02:08 +01:00
commit 66595cafe5
16 changed files with 3260 additions and 36 deletions

View file

@ -55,3 +55,18 @@ def test_default_command_accepts_fixed_lattice_flags(tmp_path: Path) -> None:
)
assert exit_code == 0
assert output_path.exists()
def test_gui_command_dispatches_to_gui_main(monkeypatch) -> None:
called = {}
def fake_gui_main(*, host: str, port: int, reload: bool) -> int:
called["host"] = host
called["port"] = port
called["reload"] = reload
return 0
monkeypatch.setattr("repixelizer.cli.gui_main", fake_gui_main)
exit_code = main(["gui", "--host", "127.0.0.1", "--port", "8123", "--reload"])
assert exit_code == 0
assert called == {"host": "127.0.0.1", "port": 8123, "reload": True}

37
tests/test_gui.py Normal file
View file

@ -0,0 +1,37 @@
from __future__ import annotations
from repixelizer.pipeline import run_pipeline_rgba
from repixelizer.synthetic import fake_pixelize, make_emblem
def test_run_pipeline_rgba_emits_observer_events_for_gui() -> None:
source = make_emblem(20, 20)
fake = fake_pixelize(source, upscale=8, phase_x=0.15, phase_y=0.2, blur_radius=0.45, seed=3)
events: list[str] = []
def observer(event: str, payload) -> None:
del payload
events.append(event)
run_pipeline_rgba(
fake,
target_width=20,
target_height=20,
phase_x=0.0,
phase_y=0.0,
steps=2,
device="cpu",
enable_phase_rerank=False,
observer=observer,
)
assert events[:4] == [
"source_loaded",
"inference_candidates_ready",
"analysis_completed",
"phase_selection_completed",
]
assert "phase_field_prepared" in events
assert "phase_field_initial" in events
assert events.count("phase_field_step") == 2
assert events[-3:] == ["cleanup_completed", "palette_completed", "pipeline_completed"]