diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-10-18 20:28:09 +0200 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-10-18 20:28:09 +0200 |
| commit | 2071e2beda763137416ac386d4bb953711ec995d (patch) | |
| tree | bdcf840cb457f8286c1d967410f98972eb99b50a /tools/tests/test_make_icon.py | |
| parent | a9b1dc8bd9354973eabd72f56d82b2eab6f48d56 (diff) | |
test(tools): add test-log judge, docs and policy checks with tests
- ciq_test_report.py: decides pass/fail from Run No Evil output instead
of monkeydo's unreliable exit code; writes JUnit XML.
- check_docs.py: offline check of relative links and GitHub anchors.
- lint_project.py: project rules (headers, no logging outside Diag,
no secret-like literals, no network APIs or permissions).
- check_budgets.py with budgets.json: perf and memory gates.
- make_icon.py: reproducible launcher icon.
- 31 pytest tests, including Hypothesis fuzzing of the log parser and
integration checks against the real docs and sources; ruff and mypy
(strict) clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/tests/test_make_icon.py')
| -rw-r--r-- | tools/tests/test_make_icon.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/tests/test_make_icon.py b/tools/tests/test_make_icon.py new file mode 100644 index 0000000..66128c5 --- /dev/null +++ b/tools/tests/test_make_icon.py @@ -0,0 +1,25 @@ +"""Tests for tools/make_icon.py (launcher icon generator).""" + +from __future__ import annotations + +import make_icon +from PIL import Image + + +def rgba(img: Image.Image, xy: tuple[int, int]) -> tuple[int, ...]: + """One RGBA pixel as a tuple (Pillow's getpixel returns a wider union type).""" + value = img.getpixel(xy) + assert isinstance(value, tuple) + return value + + +def test_icon_size_transparency_and_colours() -> None: + img = make_icon.draw_icon(60) + assert img.size == (60, 60) + assert img.mode == "RGBA" + # Corners are outside the disc, so fully transparent. + assert rgba(img, (0, 0))[3] == 0 + # The disc edge is teal, the lock body in the middle is white. + r, g, b, a = rgba(img, (30, 4)) + assert a > 200 and g > r and b > r + assert rgba(img, (22, 40))[:3] == (255, 255, 255) |
