From: "Erich E. Hoover" Subject: [PATCH 3/2] ddraw/tests: Test DirectDrawEnumerateEx with DDENUM_ATTACHEDSECONDARYDEVICES. Message-Id: Date: Thu, 9 Jan 2014 08:43:20 -0700 This patch demonstrates the behavior of DirectDrawEnumerateEx with and without DDENUM_ATTACHEDSECONDARYDEVICES (without it only primary devices are returned, with it both primary and secondary devices are returned). It's worth noting that the TestBot will not return any secondary devices but that any "normal" system will. From 5602e29bbd852bec126724f7f144a3260a0adf43 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 9 Jan 2014 08:34:46 -0700 Subject: ddraw/tests: Test DirectDrawEnumerateEx with DDENUM_ATTACHEDSECONDARYDEVICES. --- dlls/ddraw/tests/ddrawmodes.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index 515f4d1..643fe9b 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -209,8 +209,22 @@ static BOOL WINAPI test_context_callbackExA(GUID *lpGUID, char *lpDriverDescript return TRUE; } +static BOOL WINAPI test_count_callbackExA(GUID *lpGUID, char *lpDriverDescription, + char *lpDriverName, void *lpContext, HMONITOR hm) +{ + DWORD *count = (DWORD *)lpContext; + + trace("test_count_callbackExA: %p %s %s %p %p\n", lpGUID, + lpDriverDescription, lpDriverName, lpContext, hm); + + (*count)++; + + return TRUE; +} + static void test_DirectDrawEnumerateExA(void) { + DWORD callbackCount; HRESULT ret; if (!pDirectDrawEnumerateExA) @@ -237,6 +251,21 @@ static void test_DirectDrawEnumerateExA(void) ret = pDirectDrawEnumerateExA(test_context_callbackExA, (void *)0xdeadbeef, 0); ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret); + /* Test with valid callback parameter and count the number of primary devices */ + callbackCount = 0; + ret = pDirectDrawEnumerateExA(test_count_callbackExA, &callbackCount, 0); + ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret); + ok(callbackCount == 1, "Expected 1 primary device, got %d\n", callbackCount); + + /* Test with valid callback parameter and count the number of secondary devices */ + callbackCount = 0; + ret = pDirectDrawEnumerateExA(test_count_callbackExA, &callbackCount, + DDENUM_ATTACHEDSECONDARYDEVICES); + ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret); + /* Note: this list includes the primary devices as well and some systems (such as the TestBot) + do not include any secondary devices */ + ok(callbackCount >= 1, "Expected at least one device, got %d\n", callbackCount); + /* Test with valid callback parameter, NULL context parameter, and all flags set. */ trace("Calling DirectDrawEnumerateExA with all flags set and NULL context.\n"); ret = pDirectDrawEnumerateExA(test_nullcontext_callbackExA, NULL, -- 1.7.9.5