Zhiyi Zhang : user32/tests: Do not change adapters to every available modes.

Alexandre Julliard julliard at winehq.org
Mon May 17 15:45:32 CDT 2021


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Mon May 17 15:20:21 2021 +0800

user32/tests: Do not change adapters to every available modes.

This reduce the time to run the monitor test from 6 minutes to 25 seconds.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50086
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/monitor.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 6b233970ace..4510e15b79b 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -333,6 +333,7 @@ static void test_ChangeDisplaySettingsEx(void)
     DISPLAY_DEVICEA dd;
     POINTL position;
     DEVMODEW dmW;
+    BOOL found;
     LONG res;
     int i;
 
@@ -732,7 +733,7 @@ static void test_ChangeDisplaySettingsEx(void)
         ok(count == old_count - 1, "Expect monitor count %d, got %d\n", old_count - 1, count);
     }
 
-    /* Test changing each adapter to every available mode */
+    /* Test changing each adapter to different width, height, frequency and depth */
     position.x = 0;
     position.y = 0;
     for (device = 0; device < device_count; ++device)
@@ -741,6 +742,42 @@ static void test_ChangeDisplaySettingsEx(void)
         dm.dmSize = sizeof(dm);
         for (mode = 0; EnumDisplaySettingsExA(devices[device].name, mode, &dm, 0); ++mode)
         {
+            if (mode == 0)
+            {
+                dm2 = dm;
+            }
+            else
+            {
+                found = FALSE;
+                if (dm2.dmPelsWidth && dm.dmPelsWidth != dm2.dmPelsWidth)
+                {
+                    dm2.dmPelsWidth = 0;
+                    found = TRUE;
+                }
+                if (dm2.dmPelsHeight && dm.dmPelsHeight != dm2.dmPelsHeight)
+                {
+                    dm2.dmPelsHeight = 0;
+                    found = TRUE;
+                }
+                if (dm2.dmDisplayFrequency && dm.dmDisplayFrequency != dm2.dmDisplayFrequency)
+                {
+                    dm2.dmDisplayFrequency = 0;
+                    found = TRUE;
+                }
+                if (dm2.dmBitsPerPel && dm.dmBitsPerPel != dm2.dmBitsPerPel)
+                {
+                    dm2.dmBitsPerPel = 0;
+                    found = TRUE;
+                }
+
+                if (!dm2.dmPelsWidth && !dm2.dmPelsHeight && !dm2.dmDisplayFrequency
+                        && !dm2.dmBitsPerPel)
+                    break;
+
+                if (!found)
+                    continue;
+            }
+
             dm.dmPosition = position;
             dm.dmFields |= DM_POSITION;
             /* Reattach detached non-primary adapters, otherwise ChangeDisplaySettingsExA with only CDS_RESET fails */




More information about the wine-cvs mailing list