testsAndMisc/python_pkg/app_icons/tests/test_labels.py
Krzysztof kuhy Rudnicki 35b497b409
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Has been cancelled
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Has been cancelled
Python tests / test (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Shell tests / shell-tests (push) Has been cancelled
Shell tests / lib-tests (push) Has been cancelled
Shell tests / arch-tests (push) Has been cancelled
app_icons: fit every glyph to one ink circle, launcher-name rules
- fit.py: centre each glyph and scale it so its furthest ink sits at
  INK_RADIUS = 340px, compensating the unscaled stroke width
- style.py: INK_RADIUS plus INK_RADIUS_DP for vector-drawable consumers
- labels.py/_label_widths.py: LABELS registry; names start with a
  capital, ASCII letters only, <= 10 chars, <= 522 wide in the Pixel
  launcher font
- drop centre_offset, safe_box_overflow and the CLI safe-box warning
- add prompt-bubble (sufler) and camera (macro_cam) glyphs and apps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012kQ5PCKqBHAkAVkPSvp6dk
2026-10-23 14:35:00 +02:00

43 lines
1.4 KiB
Python

"""Tests for app_icons.labels: the launcher-name rules every app must meet."""
from __future__ import annotations
import pytest
from python_pkg.app_icons import apps, labels
class TestLabelProblems:
@pytest.mark.parametrize("name", ["Todo", "BookGuard", "WakeAlarm", "Focuser", "A"])
def test_valid(self, name: str) -> None:
assert labels.label_problems(name) == []
@pytest.mark.parametrize(
("name", "fragment"),
[
("", "empty"),
("todo", "capital"),
("Book Guard", "ASCII letters"),
("diet_guard", "ASCII letters"),
("Umbrella?", "ASCII letters"),
("Żółw", "ASCII letters"),
("SignalBotRemote", "characters"),
("FocusOwner", "launcher font"),
("WakeAlarmX", "launcher font"),
],
)
def test_invalid(self, name: str, fragment: str) -> None:
assert any(fragment in p for p in labels.label_problems(name))
class TestRegistryLabels:
def test_every_app_has_a_label(self) -> None:
assert set(labels.LABELS) == set(apps.APPS)
@pytest.mark.parametrize("key", sorted(apps.APPS))
def test_label_is_valid(self, key: str) -> None:
assert labels.label_problems(apps.get_app(key).label) == []
def test_labels_are_unique(self) -> None:
assert len(set(labels.LABELS.values())) == len(labels.LABELS)