Lucas Fialho Zawacki : dinput/tests: Tests for EnumObjects with different types of device objects.
Alexandre Julliard
julliard at winehq.org
Fri Jul 15 11:45:19 CDT 2011
Module: wine
Branch: master
Commit: d1a6d70e89275bfba436a99662ea078f0bcfc929
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d1a6d70e89275bfba436a99662ea078f0bcfc929
Author: Lucas Fialho Zawacki <lfzawacki at gmail.com>
Date: Thu Jul 14 16:24:17 2011 -0300
dinput/tests: Tests for EnumObjects with different types of device objects.
---
dlls/dinput/tests/device.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c
index ea25482..e79c564 100644
--- a/dlls/dinput/tests/device.c
+++ b/dlls/dinput/tests/device.c
@@ -64,11 +64,20 @@ static BOOL CALLBACK enum_callback(LPCDIDEVICEOBJECTINSTANCE oi, LPVOID info)
return DIENUM_CONTINUE;
}
+static BOOL CALLBACK enum_type_callback(LPCDIDEVICEOBJECTINSTANCE oi, LPVOID info)
+{
+ DWORD expected = *(DWORD*)info;
+ ok (expected & DIDFT_GETTYPE(oi->dwType), "EnumObjects() enumerated wrong type for obj %s, expected: %08x got: %08x\n", oi->tszName, expected, oi->dwType);
+ return DIENUM_CONTINUE;
+}
+
static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd)
{
HRESULT hr;
DIPROPDWORD dp;
DIDEVICEOBJECTINSTANCE obj_info;
+ DWORD obj_types[] = {DIDFT_BUTTON, DIDFT_AXIS, DIDFT_POV};
+ int type_index;
int cnt = 0, cnt1 = 0;
hr = IDirectInputDevice_EnumObjects(device, enum_callback, &cnt, DIDFT_ALL);
@@ -82,6 +91,13 @@ static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd)
if (0) /* fails for joystick only */
ok(cnt == cnt1, "Enum count changed from %d to %d\n", cnt, cnt1);
+ /* Testing EnumObjects with different types of device objects */
+ for (type_index=0; type_index < sizeof(obj_types)/sizeof(obj_types[0]); type_index++)
+ {
+ hr = IDirectInputDevice_EnumObjects(device, enum_type_callback, &obj_types[type_index], obj_types[type_index]);
+ ok(SUCCEEDED(hr), "EnumObjects() failed: %08x\n", hr);
+ }
+
/* No need to test devices without axis */
obj_info.dwSize = sizeof(obj_info);
hr = IDirectInputDevice_GetObjectInfo(device, &obj_info, 16, DIPH_BYOFFSET);
More information about the wine-cvs
mailing list