Passe theme clair, libelles utilisateur, aides conteneurs, recherche de mise a jour et indication honnete des moteurs optionnels non embarques. Tests GUI unitaires: 126 passed.
56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
"""Tests de la logique de thème G4 (palettes maquette, status_color) sans display."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from gui_v6 import theme as theme_mod
|
|
|
|
_REQUIRED_TOKENS = {
|
|
"bg", "card", "card_border", "primary", "primary_dim", "accent",
|
|
"text", "text_dim", "text_muted", "success", "warning", "danger", "blue",
|
|
"divider", "btn_sec_bg", "btn_sec_border", "appearance",
|
|
}
|
|
|
|
|
|
def test_four_themes_present():
|
|
assert set(theme_mod.PALETTES) == {"sombre", "clair", "medical", "neutre"}
|
|
assert theme_mod.DEFAULT_THEME == "clair"
|
|
|
|
|
|
@pytest.mark.parametrize("name", ["sombre", "clair", "medical", "neutre"])
|
|
def test_palette_has_all_tokens(name):
|
|
palette = theme_mod.PALETTES[name]
|
|
assert _REQUIRED_TOKENS <= set(palette)
|
|
# Couleurs hex valides (sauf appearance).
|
|
for key, val in palette.items():
|
|
if key == "appearance":
|
|
assert val in ("dark", "light")
|
|
else:
|
|
assert isinstance(val, str) and val.startswith("#") and len(val) == 7
|
|
|
|
|
|
def test_default_palette_matches_mockup():
|
|
p = theme_mod.get_palette(theme_mod.DEFAULT_THEME)
|
|
assert p["bg"] == "#cdd2da"
|
|
assert p["card"] == "#ffffff"
|
|
assert p["primary"] == "#c93050"
|
|
assert p["accent"] == "#b45309"
|
|
|
|
|
|
def test_get_palette_fallback():
|
|
assert theme_mod.get_palette("inconnu") is theme_mod.PALETTES[theme_mod.DEFAULT_THEME]
|
|
|
|
|
|
def test_status_color_maps_to_tokens():
|
|
assert theme_mod.status_color("sombre", "active") == theme_mod.PALETTES["sombre"]["success"]
|
|
assert theme_mod.status_color("sombre", "expired") == theme_mod.PALETTES["sombre"]["danger"]
|
|
assert theme_mod.status_color("sombre", "grace") == theme_mod.PALETTES["sombre"]["warning"]
|
|
# statut inconnu → text_muted, sans lever.
|
|
assert theme_mod.status_color("sombre", "???") == theme_mod.PALETTES["sombre"]["text_muted"]
|
|
|
|
|
|
def test_theme_labels_present():
|
|
for name in theme_mod.theme_names():
|
|
assert name in theme_mod.THEME_LABELS
|