[PATCH 6/6] dinput8/tests: Add some HID joystick IDirectInputDevice8_(Un)Acquire tests.
Rémi Bernon
rbernon at codeweavers.com
Thu Sep 16 03:20:43 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/dinput8/tests/hid.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index fd1949ed650..310be9990d6 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -3729,11 +3729,31 @@ static void test_simple_joystick(void)
ok( hr == DI_OK, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
ok( hr == DI_OK, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
+
+ hr = IDirectInputDevice8_Unacquire( device );
+ ok( hr == DI_NOEFFECT, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
+ hr = IDirectInputDevice8_Acquire( device );
+ ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr );
+ hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
+ todo_wine
+ ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
+ hr = IDirectInputDevice8_Unacquire( device );
+ ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
+
DestroyWindow( hwnd );
hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE );
ok( hr == DI_OK, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
+ hr = IDirectInputDevice8_Acquire( device );
+ ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr );
+
+ hr = IDirectInputDevice8_Unacquire( device );
+ ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
+
+ /* FIXME: we have to wait a bit because Wine DInput internal thread keeps a reference */
+ Sleep( 100 );
+
ref = IDirectInputDevice8_Release( device );
ok( ref == 0, "IDirectInputDeviceW_Release returned %d\n", ref );
--
2.33.0
More information about the wine-devel
mailing list