import pytest
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)

    # 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 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
