[PATCH 1/7] dinput/tests: Add test to validate interactions between dinput and raw input devices

Rémi Bernon rbernon at codeweavers.com
Mon Aug 26 09:06:55 CDT 2019


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/tests/keyboard.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index d6ab5b5c7e3..0e399f021c2 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -93,6 +93,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
         };
     DIDATAFORMAT df;
     HKL hkl, hkl_orig;
+    UINT prev_raw_devices_count, raw_devices_count;

     hkl = activate_keyboard_layout(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), &hkl_orig);
     if (!hkl) return;
@@ -165,6 +166,22 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
     }
     keybd_event('Q', 0, KEYEVENTF_KEYUP, 0);

+    prev_raw_devices_count = 0;
+    GetRegisteredRawInputDevices(NULL, &prev_raw_devices_count, sizeof(RAWINPUTDEVICE));
+    ok(prev_raw_devices_count == 0 || broken(prev_raw_devices_count == 1) /* wxppro, w2003std */,
+       "Unexpected raw devices registered: %d\n", prev_raw_devices_count);
+
+    hr = IDirectInputDevice_Acquire(pKeyboard);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
+
+    raw_devices_count = 0;
+    GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
+    ok(raw_devices_count == prev_raw_devices_count,
+       "Unexpected raw devices registered: %d\n", raw_devices_count);
+
+    hr = IDirectInputDevice_Unacquire(pKeyboard);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+
     if (pKeyboard) IUnknown_Release(pKeyboard);

     ActivateKeyboardLayout(hkl_orig, 0);
--
2.23.0.rc1




More information about the wine-devel mailing list