From: Fabian Maurer dark.shadow4@web.de
--- dlls/user32/tests/sysparams.c | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c index a3d3785c689..3b8613160dc 100644 --- a/dlls/user32/tests/sysparams.c +++ b/dlls/user32/tests/sysparams.c @@ -49,6 +49,7 @@ static BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); static BOOL (WINAPI *pLogicalToPhysicalPointForPerMonitorDPI)(HWND,POINT*); static BOOL (WINAPI *pPhysicalToLogicalPointForPerMonitorDPI)(HWND,POINT*); static LONG (WINAPI *pGetAutoRotationState)(PAR_STATE); +static BOOL (WINAPI *pAreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT,DPI_AWARENESS_CONTEXT);
static BOOL strict; static int dpi, real_dpi; @@ -3827,6 +3828,54 @@ static void test_ThreadDpiAwarenessContext(ULONG_PTR flags) } }
+static void test_AreDpiAwarenessContextsEqual(ULONG_PTR flags) +{ + int i, j; + ULONG_PTR contexts[] = { + 0x10 | flags, + 0x11 | flags, + 0x12, + 0x22, + 0x80000010 | flags, + 0x80000011 | flags, + 0x80000012, + 0x80000022, + (ULONG_PTR)DPI_AWARENESS_CONTEXT_UNAWARE, + (ULONG_PTR)DPI_AWARENESS_CONTEXT_SYSTEM_AWARE, + (ULONG_PTR)DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE, + (ULONG_PTR)DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, + }; + struct awareness_context_equal + { + BOOL equal; + BOOL todo; + } tests[ARRAY_SIZE(contexts)][ARRAY_SIZE(contexts)] = { + { { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 } }, + { { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 } }, + { { 0 }, { 0 }, { 1 }, { 0, TRUE }, { 0 }, { 0 }, { 1 }, { 0, TRUE }, { 0 }, { 0 }, { 1 }, { 0, TRUE } }, + { { 0 }, { 0 }, { 0, TRUE }, { 1 }, { 0 }, { 0 }, { 0, TRUE }, { 1 }, { 0 }, { 0 }, { 0, TRUE }, { 1 } }, + { { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 } }, + { { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 } }, + { { 0 }, { 0 }, { 1 }, { 0, TRUE }, { 0 }, { 0 }, { 1 }, { 0, TRUE }, { 0 }, { 0 }, { 1 }, { 0, TRUE } }, + { { 0 }, { 0 }, { 0, TRUE }, { 1 }, { 0 }, { 0 }, { 0, TRUE }, { 1 }, { 0 }, { 0 }, { 0, TRUE }, { 1 } }, + { { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 } }, + { { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 }, { 0 } }, + { { 0 }, { 0 }, { 1 }, { 0, TRUE }, { 0 }, { 0 }, { 1 }, { 0, TRUE }, { 0 }, { 0 }, { 1 }, { 0, TRUE } }, + { { 0 }, { 0 }, { 0 , TRUE}, { 1 }, { 0 }, { 0 }, { 0, TRUE }, { 1 }, { 0 }, { 0 }, { 0, TRUE }, { 1 } }, + }; + + for (i = 0; i < ARRAY_SIZE(contexts); i++) + { + for (j = 0; j < ARRAY_SIZE(contexts); j++) + { + struct awareness_context_equal *result = &tests[i][j]; + BOOL equal = pAreDpiAwarenessContextsEqual((DPI_AWARENESS_CONTEXT)contexts[i], (DPI_AWARENESS_CONTEXT)contexts[j]); + todo_wine_if(result->todo) + ok(equal == result->equal, "(%d, %d) (%p == %p) - Expected equal to be %d but got %d\n", i, j, (DPI_AWARENESS_CONTEXT)contexts[i], (DPI_AWARENESS_CONTEXT)contexts[j], result->equal, equal); + } + } +} + static void test_dpi_context(void) { DPI_AWARENESS awareness; @@ -3974,6 +4023,7 @@ static void test_dpi_context(void) ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
test_ThreadDpiAwarenessContext(flags); + test_AreDpiAwarenessContextsEqual(flags);
for (i = 0; i < 0x100; i++) { @@ -4269,6 +4319,7 @@ START_TEST(sysparams) pLogicalToPhysicalPointForPerMonitorDPI = (void*)GetProcAddress(hdll, "LogicalToPhysicalPointForPerMonitorDPI"); pPhysicalToLogicalPointForPerMonitorDPI = (void*)GetProcAddress(hdll, "PhysicalToLogicalPointForPerMonitorDPI"); pGetAutoRotationState = (void*)GetProcAddress(hdll, "GetAutoRotationState"); + pAreDpiAwarenessContextsEqual = (void*)GetProcAddress(hdll, "AreDpiAwarenessContextsEqual");
hInstance = GetModuleHandleA( NULL ); hdc = GetDC(0);