dinput/tests: Add test to validate interactions between dinput and raw input devices.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2019-08-26 16:06:55 +02:00 committed by Alexandre Julliard
parent 42a9b58b06
commit d7916cdf4f
1 changed files with 17 additions and 0 deletions

View File

@ -93,6 +93,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
}; };
DIDATAFORMAT df; DIDATAFORMAT df;
HKL hkl, hkl_orig; HKL hkl, hkl_orig;
UINT prev_raw_devices_count, raw_devices_count;
hkl = activate_keyboard_layout(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), &hkl_orig); hkl = activate_keyboard_layout(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), &hkl_orig);
if (!hkl) return; if (!hkl) return;
@ -165,6 +166,22 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
} }
keybd_event('Q', 0, KEYEVENTF_KEYUP, 0); 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); if (pKeyboard) IUnknown_Release(pKeyboard);
ActivateKeyboardLayout(hkl_orig, 0); ActivateKeyboardLayout(hkl_orig, 0);