Compare commits
23 Commits
docs/updat
...
0afd9d402f
| Author | SHA1 | Date | |
|---|---|---|---|
| 0afd9d402f | |||
| 347ae68f43 | |||
| bd400c25be | |||
| 65b8e2dfd0 | |||
| 16289f1f10 | |||
| f8bfbc23ce | |||
| 86e2c02f19 | |||
| 56643ae04f | |||
| 234d5290bc | |||
| b1280dc193 | |||
| a27c09f58e | |||
| 21d90bd3e6 | |||
| 8f4bbc46dc | |||
| 2d917de0b6 | |||
| 7b1481e7b0 | |||
| 9acd7b6fd0 | |||
| a6f2eedae5 | |||
| dc2d59db5d | |||
| ced83ce247 | |||
| aa2f0f9a8b | |||
| 03cdd70ad0 | |||
| d0e18518a2 | |||
| c36342061f |
@@ -164,6 +164,58 @@ class TestSetFontSelection:
|
|||||||
assert original_index == config.FONT_INDEX
|
assert original_index == config.FONT_INDEX
|
||||||
|
|
||||||
|
|
||||||
|
class TestActiveTheme:
|
||||||
|
"""Tests for ACTIVE_THEME global and set_active_theme function."""
|
||||||
|
|
||||||
|
def test_active_theme_initially_none(self):
|
||||||
|
"""ACTIVE_THEME should be None at module start."""
|
||||||
|
# Reset to None to test initial state
|
||||||
|
original = config.ACTIVE_THEME
|
||||||
|
config.ACTIVE_THEME = None
|
||||||
|
try:
|
||||||
|
assert config.ACTIVE_THEME is None
|
||||||
|
finally:
|
||||||
|
config.ACTIVE_THEME = original
|
||||||
|
|
||||||
|
def test_set_active_theme_green(self):
|
||||||
|
"""Setting green theme works correctly."""
|
||||||
|
config.set_active_theme("green")
|
||||||
|
assert config.ACTIVE_THEME is not None
|
||||||
|
assert config.ACTIVE_THEME.name == "green"
|
||||||
|
assert len(config.ACTIVE_THEME.main_gradient) == 12
|
||||||
|
assert len(config.ACTIVE_THEME.message_gradient) == 12
|
||||||
|
|
||||||
|
def test_set_active_theme_default(self):
|
||||||
|
"""Default theme is green when not specified."""
|
||||||
|
config.set_active_theme()
|
||||||
|
assert config.ACTIVE_THEME is not None
|
||||||
|
assert config.ACTIVE_THEME.name == "green"
|
||||||
|
|
||||||
|
def test_set_active_theme_invalid(self):
|
||||||
|
"""Invalid theme_id raises KeyError."""
|
||||||
|
with pytest.raises(KeyError):
|
||||||
|
config.set_active_theme("nonexistent")
|
||||||
|
|
||||||
|
def test_set_active_theme_all_themes(self):
|
||||||
|
"""Verify orange and purple themes work."""
|
||||||
|
# Test orange
|
||||||
|
config.set_active_theme("orange")
|
||||||
|
assert config.ACTIVE_THEME.name == "orange"
|
||||||
|
|
||||||
|
# Test purple
|
||||||
|
config.set_active_theme("purple")
|
||||||
|
assert config.ACTIVE_THEME.name == "purple"
|
||||||
|
|
||||||
|
def test_set_active_theme_idempotent(self):
|
||||||
|
"""Calling set_active_theme multiple times works."""
|
||||||
|
config.set_active_theme("green")
|
||||||
|
first_theme = config.ACTIVE_THEME
|
||||||
|
config.set_active_theme("green")
|
||||||
|
second_theme = config.ACTIVE_THEME
|
||||||
|
assert first_theme.name == second_theme.name
|
||||||
|
assert first_theme.name == "green"
|
||||||
|
|
||||||
|
|
||||||
class TestConfigDataclass:
|
class TestConfigDataclass:
|
||||||
"""Tests for Config dataclass."""
|
"""Tests for Config dataclass."""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user