Module: wine Branch: master Commit: 6b2b004c0ca0427a3337953efab4e59c0e67cd8f URL: https://source.winehq.org/git/wine.git/?a=commit;h=6b2b004c0ca0427a3337953ef...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Thu Nov 7 22:04:31 2019 +0800
user32/tests: Fix test failures on multiple monitor setup.
The desktop window rectangle is the same as that of primary monitor for compatibility reasons. It equals to virtual screen rectangle only when there are no more than two active and non-mirrored monitors.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/tests/sysparams.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c index f74c9e7561..645c188008 100644 --- a/dlls/user32/tests/sysparams.c +++ b/dlls/user32/tests/sysparams.c @@ -3225,6 +3225,7 @@ static void test_dpi_mapping(void) ULONG_PTR i, j, k; WINDOWPLACEMENT wpl_orig, wpl; HMONITOR monitor; + INT monitor_count; MONITORINFO mon_info; DPI_AWARENESS_CONTEXT context;
@@ -3235,6 +3236,7 @@ static void test_dpi_mapping(void) } context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ); GetWindowRect( GetDesktopWindow(), &desktop ); + monitor_count = GetSystemMetrics( SM_CMONITORS ); for (i = DPI_AWARENESS_UNAWARE; i <= DPI_AWARENESS_PER_MONITOR_AWARE; i++) { pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ); @@ -3247,9 +3249,12 @@ static void test_dpi_mapping(void) SetRect( &rect, 0, 0, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN )); ok( EqualRect( &expect, &rect ), "%lu: wrong desktop rect %s expected %s\n", i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) ); - SetRect( &rect, 0, 0, GetSystemMetrics( SM_CXVIRTUALSCREEN ), GetSystemMetrics( SM_CYVIRTUALSCREEN )); - ok( EqualRect( &expect, &rect ), "%lu: wrong virt desktop rect %s expected %s\n", - i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) ); + if (monitor_count < 2) + { + SetRect( &rect, 0, 0, GetSystemMetrics( SM_CXVIRTUALSCREEN ), GetSystemMetrics( SM_CYVIRTUALSCREEN )); + ok( EqualRect( &expect, &rect ), "%lu: wrong virt desktop rect %s expected %s\n", + i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) ); + } SetRect( &rect, 0, 0, 1, 1 ); monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY ); ok( monitor != 0, "failed to get monitor\n" );