From d7916cdf4f8f8cbed7225cfdd0e37c566c9b1eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 26 Aug 2019 16:06:55 +0200 Subject: [PATCH] dinput/tests: Add test to validate interactions between dinput and raw input devices. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- 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);