From dc184b526ce1fcfabcf36ac201ad7675fee98eb8 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 9 Jan 2014 08:34:46 -0700 Subject: [PATCH] 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 515f4d17d2e..643fe9b0926 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, -- 2.11.4.GIT