checkpoint: fixing ux with window frame bar
This commit is contained in:
@@ -9,22 +9,34 @@ def test_gui_window_controls_minimize_maximize_close():
|
||||
|
||||
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:
|
||||
|
||||
patch("src.gui_2.imgui") as mock_imgui, \
|
||||
patch("ctypes.pythonapi.PyCapsule_GetPointer") as mock_get_pointer:
|
||||
|
||||
# Setup mock for HWND
|
||||
mock_viewport = MagicMock()
|
||||
mock_viewport.platform_handle = 12345
|
||||
mock_viewport.platform_handle_raw = "mock_capsule"
|
||||
mock_imgui.get_main_viewport.return_value = mock_viewport
|
||||
|
||||
mock_get_pointer.return_value = 12345
|
||||
mock_imgui.get_window_width.return_value = 800.0
|
||||
mock_imgui.get_cursor_pos_x.return_value = 100.0
|
||||
mock_imgui.get_io().display_size.x = 800.0
|
||||
mock_style = MagicMock()
|
||||
mock_style.item_spacing.x = 4.0
|
||||
mock_imgui.get_style.return_value = mock_style
|
||||
# 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()
|
||||
# Avoid hitting actual menu logic that requires real runner_params
|
||||
mock_imgui.begin_menu.return_value = False
|
||||
|
||||
app.runner_params = MagicMock()
|
||||
|
||||
# Call the method (now in _show_menus)
|
||||
app._show_menus()
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user