testsAndMisc/python_pkg/app_icons/tests/test_registry.py
Krzysztof kuhy Rudnicki f1320e1f7e app_icons: warm-tint the shared icon family palette
Charcoal field #1B1D21 -> #211D1B, accent #4C7DF0 -> #B8862E across all 6
apps in the family, matching the unified-design-system palette rework
already applied to diet-guard/dufs-cloud/screen-locker/gatelock. Both are
exact byte-reversed mirrors of the old values, so relative lightness is
unchanged -- only the tint shifts from blue toward red/brown.

Also fixes stale prose in README.md left over from an earlier accent-
unification pass (claimed each app had its own accent; they've shared one
since that pass).

Verified: 39/39 tests, preview contact sheet reviewed, all 6 repos'
assets regenerated (diet-guard's rebuilt APK pixel-verified on device).
2026-07-21 21:20:41 +02:00

51 lines
1.6 KiB
Python

"""Tests for the app registry, glyph library and family style invariants."""
from __future__ import annotations
import pytest
from python_pkg.app_icons import apps, glyphs, style
class TestGlyphLookup:
def test_known_glyph(self) -> None:
assert glyphs.get_glyph("barbell").name == "barbell"
def test_unknown_glyph_lists_alternatives(self) -> None:
with pytest.raises(KeyError, match="barbell"):
glyphs.get_glyph("nope")
class TestAppLookup:
def test_known_app(self) -> None:
assert apps.get_app("todo").glyph == "checklist"
def test_unknown_app_lists_alternatives(self) -> None:
with pytest.raises(KeyError, match="todo"):
apps.get_app("nope")
def test_asset_dir_is_under_repo(self) -> None:
app = apps.get_app("todo")
assert app.asset_dir == app.repo / "assets" / "icon"
class TestFamilyInvariants:
def test_every_app_references_a_real_glyph(self) -> None:
for app in apps.APPS.values():
assert app.glyph in glyphs.GLYPHS
def test_accents_are_shared(self) -> None:
"""Every app uses the one family accent; apps differ by glyph only."""
accents = {app.accent for app in apps.APPS.values()}
assert accents == {"#B8862E"}
def test_accents_are_hex_triplets(self) -> None:
for app in apps.APPS.values():
assert app.accent.startswith("#")
assert len(app.accent) == 7
int(app.accent[1:], 16)
def test_safe_box_fits_inside_canvas(self) -> None:
assert style.SAFE_BOX < style.CANVAS
assert style.MIN_NEGATIVE_SPACE == style.STROKE_WIDTH / 2