From: Brendan Shanks Subject: [PATCH 4/6] user32/tests: Test additional flag values with GetDisplayConfigBufferSizes(). Message-Id: <20200630045524.15178-5-bshanks@codeweavers.com> Date: Mon, 29 Jun 2020 21:55:22 -0700 In-Reply-To: <20200630045524.15178-1-bshanks@codeweavers.com> References: <20200630045524.15178-1-bshanks@codeweavers.com> Signed-off-by: Brendan Shanks --- 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