summaryrefslogtreecommitdiff
path: root/tools/tests/test_ui_flow.py
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-21 03:55:10 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-21 03:55:10 +0200
commit56e0c351bb95cfdf63aa76ab8c5d725a694bad63 (patch)
treee99c7af6eca0656948279055c20a5f87d855d4c8 /tools/tests/test_ui_flow.py
parent5e8ac1e2f5a660e55ea132996e1d5730cfa4fa64 (diff)
test(build): add make watchdog, the glance memory budget and the glance screenshot
- make watchdog (in make ci): a stress build encodes, packs, turns into runs and draws the largest code of every 2D symbology at two steps per event on the Forerunner 255S and 70; it fails on a watchdog trip, and the last code left on the screen must decode (bitmap path on the 70). - make memtest checks the glance (DIAG glance, budget 70 % of 64 KB). - screenshots.sh launches the app again after the flow and compares the glance with the favourite's code (glance_code.png on 7 watches); the About goldens show 0.8.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/tests/test_ui_flow.py')
-rw-r--r--tools/tests/test_ui_flow.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/tests/test_ui_flow.py b/tools/tests/test_ui_flow.py
index 7e0d336..d98b4c2 100644
--- a/tools/tests/test_ui_flow.py
+++ b/tools/tests/test_ui_flow.py
@@ -1,5 +1,5 @@
# Author: cirakg & claude ai
-# Summary: Tests for the UI flow driver's pure parts: device key layout, JSON lookup and the app-log reader.
+# Summary: Tests for the UI flow driver's pure parts: key layout, JSON lookup, the app-log reader, barcode reading.
from __future__ import annotations
import json
@@ -8,7 +8,9 @@ import time
from pathlib import Path
import pytest
+import segno
import ui_flow
+from PIL import Image
def write_sim(tmp_path: Path, config: dict[str, object]) -> Path:
@@ -71,3 +73,11 @@ def test_app_log_latest_returns_the_last_match(tmp_path: Path) -> None:
match = ui_flow.AppLog(log_path).latest(r"DIAG list_focus y=(\d+)")
assert match is not None and match.group(1) == "42"
assert ui_flow.AppLog(tmp_path / "missing.log").latest("x") is None
+
+
+def test_barcodes_on_reads_a_drawn_code(tmp_path: Path) -> None:
+ path = tmp_path / "qr.png"
+ segno.make("OTPW stress", error="m").save(str(path), scale=4, border=4)
+ screen = Image.open(path).convert("RGB")
+ assert ui_flow.barcodes_on(screen) == ["OTPW stress"]
+ assert ui_flow.barcodes_on(Image.new("RGB", (100, 100), "white")) == []