Port Repixelizer surface to Eve
This commit is contained in:
parent
1e1a3441fe
commit
0564d42f75
14 changed files with 1193 additions and 18 deletions
64
tests/test_eve_surface.py
Normal file
64
tests/test_eve_surface.py
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from repixelizer.cli import main as cli_main
|
||||
from repixelizer.eve_surface import build_repixelizer_eve_surface
|
||||
|
||||
|
||||
def test_repixelizer_eve_surface_preserves_retro_style_tokens(monkeypatch, tmp_path: Path) -> None:
|
||||
monkeypatch.setenv("REPIXELIZER_HOSTED_DEMO", "1")
|
||||
monkeypatch.setenv("REPIXELIZER_QUEUE_CAPACITY", "7")
|
||||
monkeypatch.setenv("REPIXELIZER_SPOOL_DIR", str(tmp_path / "spool"))
|
||||
monkeypatch.setenv("GC_ACCESS_MODE", "off")
|
||||
|
||||
payload = build_repixelizer_eve_surface(
|
||||
updated_at="2026-06-04T00:00:00Z",
|
||||
public_base_url="https://repixelizer.example",
|
||||
)
|
||||
|
||||
assert payload["schema"] == "gamecult.eve.surface.v1"
|
||||
assert payload["providerId"] == "repixelizer"
|
||||
assert payload["surface"]["root"]["props"]["styleProfile"] == "repixelizer.retro.pixel"
|
||||
assert payload["runtime"]["hostedDemo"] is True
|
||||
assert payload["runtime"]["queue"]["queueCapacity"] == 7
|
||||
|
||||
tokens = payload["surface"]["styles"]["tokens"]
|
||||
assert "Press Start 2P" in tokens["fontTitle"]
|
||||
assert "VT323" in tokens["fontBody"]
|
||||
assert tokens["colorBackgroundTop"] == "#01040b"
|
||||
assert tokens["colorAccent"] == "#ffd84a"
|
||||
assert tokens["imageRendering"] == "pixelated"
|
||||
assert tokens["scanlineOverlay"] is True
|
||||
|
||||
commands = {entry["command"]: entry for entry in payload["commands"]}
|
||||
assert commands["repixelizer.job.submit"]["route"] == "/api/jobs"
|
||||
assert commands["repixelizer.job.cancel_own"]["method"] == "DELETE"
|
||||
|
||||
android = payload["loweringComparison"]["periwinkleAndroidKotlin"]
|
||||
assert android["status"] == "surface-tree-renderer-present-style-token-gap"
|
||||
assert any("Press Start 2P" in gap for gap in android["losesUntilRendererParity"])
|
||||
|
||||
|
||||
def test_eve_surface_cli_writes_json(monkeypatch, tmp_path: Path) -> None:
|
||||
monkeypatch.setenv("REPIXELIZER_SPOOL_DIR", str(tmp_path / "spool"))
|
||||
monkeypatch.setenv("GC_ACCESS_MODE", "off")
|
||||
out = tmp_path / "repixelizer.eve-surface.json"
|
||||
|
||||
exit_code = cli_main(
|
||||
[
|
||||
"eve-surface",
|
||||
"--out",
|
||||
str(out),
|
||||
"--updated-at",
|
||||
"2026-06-04T00:00:00Z",
|
||||
"--public-base-url",
|
||||
"https://repixelizer.example",
|
||||
]
|
||||
)
|
||||
|
||||
assert exit_code == 0
|
||||
payload = json.loads(out.read_text(encoding="utf-8"))
|
||||
assert payload["updatedAt"] == "2026-06-04T00:00:00Z"
|
||||
assert payload["surface"]["styles"]["assets"]["appUrl"] == "https://repixelizer.example/app/"
|
||||
|
|
@ -1195,6 +1195,26 @@ def test_gui_queue_panel_defaults_off_for_local_runs_and_can_be_forced(monkeypat
|
|||
assert payload["ui"]["showQueuePanel"] is True
|
||||
|
||||
|
||||
def test_gui_serves_eve_surface_from_live_runtime_projection(monkeypatch, tmp_path: Path) -> None:
|
||||
from repixelizer.gui import create_app
|
||||
|
||||
monkeypatch.setenv("REPIXELIZER_HOSTED_DEMO", "1")
|
||||
monkeypatch.setenv("REPIXELIZER_QUEUE_CAPACITY", "5")
|
||||
monkeypatch.setenv("REPIXELIZER_SPOOL_DIR", str(tmp_path / "spool"))
|
||||
monkeypatch.setenv("GC_ACCESS_MODE", "off")
|
||||
|
||||
app = create_app()
|
||||
status, _headers, body = asyncio.run(_get_response(app, "/eve/surface"))
|
||||
payload = _response_json(type("Response", (), {"body": body})())
|
||||
|
||||
assert status == 200
|
||||
assert payload["schema"] == "gamecult.eve.surface.v1"
|
||||
assert payload["surface"]["styles"]["tokens"]["colorAccent"] == "#ffd84a"
|
||||
assert payload["runtime"]["queue"]["queueCapacity"] == 5
|
||||
assert payload["runtime"]["auth"]["mode"] == "off"
|
||||
assert payload["surface"]["styles"]["assets"]["appUrl"] == "http://testserver/app/"
|
||||
|
||||
|
||||
def test_gui_queue_rejects_eleventh_waiting_job(monkeypatch, tmp_path: Path) -> None:
|
||||
from repixelizer.gui import create_app
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ def test_provider_advertisement_names_witness_schemas(monkeypatch, tmp_path: Pat
|
|||
assert witness["kind"] == "cc-export-path-reserved"
|
||||
assert witness["path"] == "state/repixelizer.witness.cc"
|
||||
assert witness["freshness"]["state"] == "planned"
|
||||
surface = payload["surfaces"][0]
|
||||
assert surface["status"] == "available"
|
||||
assert surface["transport"] == "http-json"
|
||||
assert surface["url"] == "https://repixelizer.gamecult.org/eve/surface"
|
||||
assert surface["styleProfile"] == "repixelizer.retro.pixel"
|
||||
|
||||
|
||||
def test_witness_advertisement_cli_writes_json(monkeypatch, tmp_path: Path) -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue