feat(gui): Implement custom title bar and window controls

This commit is contained in:
2026-03-13 12:20:37 -04:00
parent 02fca1f8ba
commit 59d7368bd7
2 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import pytest
from unittest.mock import patch, MagicMock
from imgui_bundle import imgui
def test_gui_window_controls_minimize_maximize_close():
# We will test the logic of the title bar controls that we are about to implement.
from src.gui_2 import App
app = App()
with patch("src.gui_2.win32gui") as mock_win32gui, \
patch("src.gui_2.win32con") as mock_win32con, \
patch("src.gui_2.imgui") as mock_imgui:
# Setup mock for HWND
mock_viewport = MagicMock()
mock_viewport.platform_handle = 12345
mock_imgui.get_main_viewport.return_value = mock_viewport
# Setup mock for buttons to simulate clicks
# Let's say _render_custom_title_bar uses imgui.button
# We will test the close button logic
# Since it's UI code, we just simulate the conditions
mock_imgui.button.return_value = True # Simulate all buttons being clicked
# Call the method (to be implemented)
app._render_custom_title_bar()
# Verify that win32gui calls are made for minimize, maximize, close
# Since all buttons returned True, all actions should be triggered in this dummy test
assert mock_win32gui.ShowWindow.called
assert mock_win32gui.PostMessage.called