[PATCH 4/6] user32/tests: Test additional flag values with GetDisplayConfigBufferSizes().

Brendan Shanks bshanks at codeweavers.com
Mon Jun 29 23:55:22 CDT 2020


Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
 dlls/user32/tests/monitor.c | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index e00c2bc6bd5..8b3e7236c7e 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -1126,15 +1126,6 @@ static void test_GetDisplayConfigBufferSizes(void)
     ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
     ok(modes == 100, "got %u\n", modes);
 
-    paths = modes = 0;
-    ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, &paths, &modes);
-    if (!ret)
-        ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
-    else
-        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
-
-    /* Invalid flags, non-zero invalid flags validation is version (or driver?) dependent,
-       it's unreliable to use in tests. */
     ret = pGetDisplayConfigBufferSizes(0, NULL, NULL);
     ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
 
@@ -1148,10 +1139,38 @@ static void test_GetDisplayConfigBufferSizes(void)
     ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
     ok(modes == 100, "got %u\n", modes);
 
+    /* Flag validation on Windows is driver-dependent */
     paths = modes = 100;
     ret = pGetDisplayConfigBufferSizes(0, &paths, &modes);
     ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
     ok((modes == 0 || modes == 100) && paths == 0, "got %u, %u\n", modes, paths);
+
+    paths = modes = 100;
+    ret = pGetDisplayConfigBufferSizes(0xFF, &paths, &modes);
+    ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok((modes == 0 || modes == 100) && paths == 0, "got %u, %u\n", modes, paths);
+
+    /* Test success */
+    paths = modes = 0;
+    ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, &paths, &modes);
+    if (!ret)
+        ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
+    else
+        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+
+    paths = modes = 0;
+    ret = pGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &paths, &modes);
+    if (!ret)
+        ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
+    else
+        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+
+    paths = modes = 0;
+    ret = pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT, &paths, &modes);
+    if (!ret)
+        ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
+    else
+        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
 }
 
 static BOOL CALLBACK test_EnumDisplayMonitors_normal_cb(HMONITOR monitor, HDC hdc, LPRECT rect,
-- 
2.26.2




More information about the wine-devel mailing list