Skip to content

Commit

Permalink
Fixed DPI change test
Browse files Browse the repository at this point in the history
  • Loading branch information
proneon267 committed May 15, 2024
1 parent ff6223c commit 1313d7e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions testbed/tests/app/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,14 @@ async def test_app_icon(app, app_probe):


@pytest.mark.skipif(
toga.platform.current_platform != "windows", reason="This test is windows specific."
toga.platform.current_platform != "windows", reason="This test is Windows specific"
)
async def test_system_dpi_change(
monkeypatch, app, app_probe, main_window, main_window_probe
):
# Store original window content
main_window_content_original = main_window.content

from toga_winforms.libs import shcore

GetScaleFactorForMonitor_original = getattr(shcore, "GetScaleFactorForMonitor")
Expand Down Expand Up @@ -693,7 +696,7 @@ def GetScaleFactorForMonitor_mock(hMonitor, pScale):
GetScaleFactorForMonitor_original,
)
dpi_change_events[0](None, None)
await main_window_probe.redraw(
"\nTriggering DPI change event for restoring original state"
)
main_window.content.clear()
main_window.content.window = None
main_window.content = main_window_content_original
main_window.show()
await main_window_probe.redraw("\nRestoring original state of Main Window")

0 comments on commit 1313d7e

Please sign in to comment.