Covered Theme module with tests

- Extracted `ColorReplacementGenerator`;
- Extracted `ColorConverterImpl`;
- Added documentation to some classes;
- `hex_to_rgba` now supports shorthand hex colors (#fff).
This commit is contained in:
Vladyslav Hroshev
2025-04-11 22:53:30 +03:00
parent 29485ddf1e
commit abfe1f5962
25 changed files with 877 additions and 103 deletions

View File

@@ -0,0 +1,28 @@
import unittest
from scripts.utils.theme.theme_path_provider import ThemePathProvider
class ThemePathProviderTestCase(unittest.TestCase):
def setUp(self):
self.theme_path_provider = ThemePathProvider()
def test_get_theme_path_with_valid_values_returns_correct_path(self):
themes_folder = "/usr/share/themes"
color_name = "Marble"
theme_mode = "dark"
theme_type = "gnome-shell"
expected_path = f"{themes_folder}/Marble-{color_name}-{theme_mode}/{theme_type}/"
actual_path = self.theme_path_provider.get_theme_path(themes_folder, color_name, theme_mode, theme_type)
assert expected_path == actual_path
def test_get_theme_path_with_empty_values_raises_exception(self):
themes_folder = ""
color_name = ""
theme_mode = ""
theme_type = ""
with self.assertRaises(ValueError):
self.theme_path_provider.get_theme_path(themes_folder, color_name, theme_mode, theme_type)