checkpoint frosted glass

This commit is contained in:
2026-03-13 15:33:40 -04:00
parent 1771c32006
commit 5b196dccf0
5 changed files with 150 additions and 79 deletions

View File

@@ -3,33 +3,48 @@ from unittest.mock import MagicMock
from src import theme_2 as theme
def test_theme_apply_sets_rounding_and_padding(monkeypatch):
# Mock imgui
mock_style = MagicMock()
mock_imgui = MagicMock()
mock_imgui.get_style.return_value = mock_style
mock_imgui.ImVec2.side_effect = lambda x, y: (x, y)
monkeypatch.setattr(theme, "imgui", mock_imgui)
# Mock imgui
mock_style = MagicMock()
mock_imgui = MagicMock()
mock_imgui.get_style.return_value = mock_style
mock_imgui.ImVec2.side_effect = lambda x, y: (x, y)
monkeypatch.setattr(theme, "imgui", mock_imgui)
# Call apply with the default palette
theme.apply("ImGui Dark")
# Call apply with the default palette
theme.apply("ImGui Dark")
# Verify subtle rounding styles
assert mock_style.window_rounding == 6.0
assert mock_style.child_rounding == 4.0
assert mock_style.frame_rounding == 4.0
assert mock_style.popup_rounding == 4.0
assert mock_style.scrollbar_rounding == 12.0
assert mock_style.grab_rounding == 4.0
assert mock_style.tab_rounding == 4.0
# Verify subtle rounding styles
assert mock_style.window_rounding == 6.0
assert mock_style.child_rounding == 4.0
assert mock_style.frame_rounding == 4.0
assert mock_style.popup_rounding == 4.0
assert mock_style.scrollbar_rounding == 12.0
assert mock_style.grab_rounding == 4.0
assert mock_style.tab_rounding == 4.0
# Verify borders
assert mock_style.window_border_size == 1.0
assert mock_style.frame_border_size == 1.0
assert mock_style.popup_border_size == 1.0
# Verify borders
assert mock_style.window_border_size == 1.0
assert mock_style.frame_border_size == 1.0
assert mock_style.popup_border_size == 1.0
# Verify padding/spacing
assert mock_style.window_padding == (8.0, 8.0)
assert mock_style.frame_padding == (8.0, 4.0)
assert mock_style.item_spacing == (8.0, 4.0)
assert mock_style.item_inner_spacing == (4.0, 4.0)
assert mock_style.scrollbar_size == 14.0
# Verify padding/spacing
assert mock_style.window_padding == (8.0, 8.0)
assert mock_style.frame_padding == (8.0, 4.0)
assert mock_style.item_spacing == (8.0, 4.0)
assert mock_style.item_inner_spacing == (4.0, 4.0)
assert mock_style.scrollbar_size == 14.0
def test_frosted_glass_enabled_toggle():
theme.set_frosted_glass_enabled(True)
assert theme.get_frosted_glass_enabled() is True
theme.set_frosted_glass_enabled(False)
assert theme.get_frosted_glass_enabled() is False
def test_theme_config_frosted_glass():
config = {"theme": {"frosted_glass_enabled": True}}
theme.load_from_config(config)
assert theme.get_frosted_glass_enabled() is True
new_config = {}
theme.save_to_config(new_config)
assert new_config["theme"]["frosted_glass_enabled"] is True