Zhiyi Zhang : user32/tests: Fix a ChangeDisplaySettings() test.

Alexandre Julliard julliard at winehq.org
Tue May 5 14:48:52 CDT 2020


Module: wine
Branch: master
Commit: 1bb2b160424a14a1162b6ae3429e49693150f406
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1bb2b160424a14a1162b6ae3429e49693150f406

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue May  5 20:30:19 2020 +0800

user32/tests: Fix a ChangeDisplaySettings() test.

Overlapped monitor rectangles should be automatically
adjusted to avoid overlaps.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/monitor.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 080f040c3f..05e70c4b62 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -757,26 +757,35 @@ static void test_ChangeDisplaySettingsEx(void)
 
         if (res)
         {
+            /* The secondary adapter should be to the right of the primary adapter */
+            todo_wine ok(dm2.dmPosition.x == dm.dmPosition.x + dm.dmPelsWidth,
+               "Expected dm2.dmPosition.x %d, got %d.\n", dm.dmPosition.x + dm.dmPelsWidth,
+               dm2.dmPosition.x);
+            ok(dm2.dmPosition.y == dm.dmPosition.y, "Expected dm2.dmPosition.y %d, got %d.\n",
+               dm.dmPosition.y, dm2.dmPosition.y);
+
             /* Test position conflict */
-            dm2.dmPosition.x = dm.dmPosition.x;
+            dm2.dmPosition.x = dm.dmPosition.x - dm2.dmPelsWidth + 1;
             dm2.dmPosition.y = dm.dmPosition.y;
             res = ChangeDisplaySettingsExA(devices[1].name, &dm2, NULL, CDS_RESET, NULL);
             ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[1].name, res);
 
-            /* Position is not changed even if ChangeDisplaySettingsExA returned DISP_CHANGE_SUCCESSFUL */
+            /* Position is changed and automatically moved */
             memset(&dm2, 0, sizeof(dm2));
             dm2.dmSize = sizeof(dm2);
             res = EnumDisplaySettingsA(devices[1].name, ENUM_CURRENT_SETTINGS, &dm2);
             ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[1].name, GetLastError());
-            todo_wine ok(dm2.dmPosition.x != dm.dmPosition.x, "Expect position change not applied.\n");
+            todo_wine ok((dm2.dmPosition.x == dm.dmPosition.x - dm2.dmPelsWidth),
+               "Expected dmPosition.x %d, got %d.\n", dm.dmPosition.x - dm2.dmPelsWidth,
+               dm2.dmPosition.x);
 
             /* Test position with extra space. The extra space will be removed */
-            dm2.dmPosition.x = dm.dmPosition.x - dm2.dmPelsWidth - dm2.dmPelsWidth / 2;
+            dm2.dmPosition.x = dm.dmPosition.x + dm.dmPelsWidth + 1;
             dm2.dmPosition.y = dm.dmPosition.y;
             res = ChangeDisplaySettingsExA(devices[1].name, &dm2, NULL, CDS_RESET, NULL);
             ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[1].name, res);
 
-            dm2.dmPosition.x = dm.dmPosition.x - dm2.dmPelsWidth;
+            dm2.dmPosition.x = dm.dmPosition.x + dm.dmPelsWidth;
             expect_dm(dm2, devices[1].name, 0);
 
             /* Test placing the secondary adapter to all sides of the primary adapter */




More information about the wine-cvs mailing list