Alexandre Julliard : user32/tests: Fix some test failures on latest Windows 10.
Alexandre Julliard
julliard at winehq.org
Tue Dec 11 15:58:17 CST 2018
Module: wine
Branch: master
Commit: ec94d0d58de8996c453da0ee6eff601776f5d54d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ec94d0d58de8996c453da0ee6eff601776f5d54d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Dec 11 15:36:27 2018 +0100
user32/tests: Fix some test failures on latest Windows 10.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/sysparams.c | 55 +++++++++++++++++++++++++++----------------
include/windef.h | 1 +
2 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c
index 8f9defc..c50acbe 100644
--- a/dlls/user32/tests/sysparams.c
+++ b/dlls/user32/tests/sysparams.c
@@ -3537,14 +3537,16 @@ static void test_dpi_context(void)
{
DPI_AWARENESS awareness;
DPI_AWARENESS_CONTEXT context;
- ULONG_PTR i;
+ ULONG_PTR i, flags;
BOOL ret;
UINT dpi;
HDC hdc = GetDC( 0 );
context = pGetThreadDpiAwarenessContext();
+ /* Windows 10 >= 1709 adds extra 0x6000 flags */
+ flags = (ULONG_PTR)context & 0x6000;
todo_wine
- ok( context == (DPI_AWARENESS_CONTEXT)0x10, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x10 | flags), "wrong context %p\n", context );
awareness = pGetAwarenessFromDpiAwarenessContext( context );
todo_wine
ok( awareness == DPI_AWARENESS_UNAWARE, "wrong awareness %u\n", awareness );
@@ -3561,7 +3563,7 @@ static void test_dpi_context(void)
ok( !ret, "got %d\n", ret );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
SetLastError( 0xdeadbeef );
- ret = pSetProcessDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-5 );
+ ret = pSetProcessDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-6 );
ok( !ret, "got %d\n", ret );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
@@ -3596,7 +3598,7 @@ static void test_dpi_context(void)
ret = pIsProcessDPIAware();
ok(ret, "got %d\n", ret);
context = pGetThreadDpiAwarenessContext();
- ok( context == (DPI_AWARENESS_CONTEXT)0x11, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
awareness = pGetAwarenessFromDpiAwarenessContext( context );
ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong awareness %u\n", awareness );
SetLastError( 0xdeadbeef );
@@ -3604,11 +3606,11 @@ static void test_dpi_context(void)
ok( !context, "got %p\n", context );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
SetLastError( 0xdeadbeef );
- context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-5 );
+ context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-6 );
ok( !context, "got %p\n", context );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
- ok( context == (DPI_AWARENESS_CONTEXT)0x80000011, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x80000011 | flags), "wrong context %p\n", context );
awareness = pGetAwarenessFromDpiAwarenessContext( context );
ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong awareness %u\n", awareness );
dpi = pGetDpiForSystem();
@@ -3617,11 +3619,11 @@ static void test_dpi_context(void)
ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
ok( !pIsProcessDPIAware(), "still aware\n" );
context = pGetThreadDpiAwarenessContext();
- ok( context == (DPI_AWARENESS_CONTEXT)0x10, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x10 | flags), "wrong context %p\n", context );
awareness = pGetAwarenessFromDpiAwarenessContext( context );
ok( awareness == DPI_AWARENESS_UNAWARE, "wrong awareness %u\n", awareness );
context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
- ok( context == (DPI_AWARENESS_CONTEXT)0x10, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x10 | flags), "wrong context %p\n", context );
awareness = pGetAwarenessFromDpiAwarenessContext( context );
ok( awareness == DPI_AWARENESS_UNAWARE, "wrong awareness %u\n", awareness );
dpi = pGetDpiForSystem();
@@ -3642,21 +3644,21 @@ static void test_dpi_context(void)
ok( dpi == real_dpi, "wrong dpi %u\n", dpi );
ok( pIsProcessDPIAware(), "not aware\n" );
context = pGetThreadDpiAwarenessContext();
- ok( context == (DPI_AWARENESS_CONTEXT)0x11, "wrong context %p\n", context );
- context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)0x80000010 );
- ok( context == (DPI_AWARENESS_CONTEXT)0x11, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
+ context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(0x80000010 | flags) );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
context = pGetThreadDpiAwarenessContext();
- ok( context == (DPI_AWARENESS_CONTEXT)0x11, "wrong context %p\n", context );
- context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)0x80000011 );
- ok( context == (DPI_AWARENESS_CONTEXT)0x80000011, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
+ context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(0x80000011 | flags) );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x80000011 | flags), "wrong context %p\n", context );
context = pGetThreadDpiAwarenessContext();
- ok( context == (DPI_AWARENESS_CONTEXT)0x11, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)0x12 );
- ok( context == (DPI_AWARENESS_CONTEXT)0x80000011, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x80000011 | flags), "wrong context %p\n", context );
context = pSetThreadDpiAwarenessContext( context );
- ok( context == (DPI_AWARENESS_CONTEXT)0x12, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x12), "wrong context %p\n", context );
context = pGetThreadDpiAwarenessContext();
- ok( context == (DPI_AWARENESS_CONTEXT)0x11, "wrong context %p\n", context );
+ ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
for (i = 0; i < 0x100; i++)
{
awareness = pGetAwarenessFromDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)i );
@@ -3698,6 +3700,18 @@ static void test_dpi_context(void)
ok( awareness == i, "%lx: wrong value %u\n", ~i, awareness );
ok( pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%lx: not valid\n", ~i );
break;
+ case (ULONG_PTR)DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2:
+ if (pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ))
+ ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "%lx: wrong value %u\n", ~i, awareness );
+ else
+ ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
+ break;
+ case (ULONG_PTR)DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED:
+ if (pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ))
+ ok( awareness == DPI_AWARENESS_UNAWARE, "%lx: wrong value %u\n", ~i, awareness );
+ else
+ ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
+ break;
default:
ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
ok( !pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%lx: valid\n", ~i );
@@ -3805,10 +3819,11 @@ static void test_dpi_window(void)
ok( dpi == (j == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
"%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
ret = SetParent( child, hwnd );
- ok( ret != 0, "SetParent failed err %u\n", GetLastError() );
+ ok( ret != 0 || GetLastError() == ERROR_INVALID_STATE,
+ "SetParent failed err %u\n", GetLastError() );
context = pGetWindowDpiAwarenessContext( child );
awareness = pGetAwarenessFromDpiAwarenessContext( context );
- ok( awareness == i, "%lu/%lu: wrong awareness %u\n", i, j, awareness );
+ ok( awareness == (ret ? i : j), "%lu/%lu: wrong awareness %u\n", i, j, awareness );
dpi = pGetDpiForWindow( child );
ok( dpi == (i == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
"%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
diff --git a/include/windef.h b/include/windef.h
index 8e8a08a..f9a570d 100644
--- a/include/windef.h
+++ b/include/windef.h
@@ -450,6 +450,7 @@ typedef enum DPI_AWARENESS
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
+#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
#ifdef __cplusplus
}
More information about the wine-cvs
mailing list