uxtheme/tests: Avoid fix blurry apps popup in test_GetThemePartSize().

When changing DPI, a "fix blurry apps" popup may appear on Windows 10. The popup may interfere with
other tests as it steals focus, causing them to fail. So set IgnorePerProcessSystemDPIToast to 1 to
temporarily disable the popup.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2022-01-10 15:38:29 +08:00 committed by Alexandre Julliard
parent d16998e0c7
commit 05d3480f87
1 changed files with 13 additions and 0 deletions

View File

@ -997,11 +997,13 @@ todo_wine
static void test_GetThemePartSize(void)
{
static const DWORD enabled = 1;
DPI_AWARENESS_CONTEXT old_context;
unsigned int old_dpi, current_dpi;
HTHEME htheme = NULL;
HWND hwnd = NULL;
SIZE size, size2;
HKEY key = NULL;
HRESULT hr;
HDC hdc;
@ -1011,6 +1013,12 @@ static void test_GetThemePartSize(void)
return;
}
/* Set IgnorePerProcessSystemDPIToast to 1 to disable "fix blurry apps popup" on Windows 10,
* which may interfere other tests because it steals focus */
RegOpenKeyA(HKEY_CURRENT_USER, "Control Panel\\Desktop", &key);
RegSetValueExA(key, "IgnorePerProcessSystemDPIToast", 0, REG_DWORD, (const BYTE *)&enabled,
sizeof(enabled));
old_context = pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
current_dpi = get_primary_monitor_effective_dpi();
old_dpi = current_dpi;
@ -1100,6 +1108,11 @@ done:
CloseThemeData(htheme);
if (get_primary_monitor_effective_dpi() != old_dpi)
set_primary_monitor_effective_dpi(old_dpi);
if (key)
{
RegDeleteValueA(key, "IgnorePerProcessSystemDPIToast");
RegCloseKey(key);
}
pSetThreadDpiAwarenessContext(old_context);
}