Francois Gouget : dinput/tests: Skip the tests if acquiring the device fails.
Module: wine Branch: master Commit: 8f6ab16839cba42e8cd5b1cc4984a5e8d09d341c URL: https://gitlab.winehq.org/wine/wine/-/commit/8f6ab16839cba42e8cd5b1cc4984a5e... Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Wed Feb 22 19:01:19 2023 +0100 dinput/tests: Skip the tests if acquiring the device fails. All the tests that follow would fail anyway, making it hard to filter them out to avoid false positives. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54558 --- dlls/dinput/tests/device8.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index 1f29c9af519..b9a4ce61eb6 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -344,7 +344,8 @@ void test_overlapped_format( DWORD version ) hr = IDirectInputDevice_Acquire( keyboard ); - ok( hr == DI_OK, "Acquire returned %#lx\n", hr ); + ok( hr == DI_OK, "Acquire returned %#lx, skipping test_overlapped_format\n", hr ); + if (hr != DI_OK) goto cleanup; keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE, 0 ); res = WaitForSingleObject( event, 100 ); @@ -405,7 +406,8 @@ void test_overlapped_format( DWORD version ) hr = IDirectInputDevice_Acquire( keyboard ); - ok( hr == DI_OK, "Acquire returned %#lx\n", hr ); + ok( hr == DI_OK, "Acquire returned %#lx, skipping test_overlapped_format\n", hr ); + if (hr != DI_OK) goto cleanup; keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE, 0 ); res = WaitForSingleObject( event, 100 ); @@ -457,6 +459,7 @@ void test_overlapped_format( DWORD version ) ok( count == 1, "got count %lu\n", count ); +cleanup: IUnknown_Release( keyboard ); DestroyWindow( hwnd ); @@ -1969,7 +1972,8 @@ static void test_sys_mouse( DWORD version ) hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_NOEFFECT, "Unacquire returned %#lx\n", hr ); hr = IDirectInputDevice8_Acquire( device ); - ok( hr == DI_OK, "Acquire returned %#lx\n", hr ); + ok( hr == DI_OK, "Acquire returned %#lx, skipping test_sys_mouse\n", hr ); + if (hr != DI_OK) goto cleanup; hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_NOEFFECT, "Acquire returned %#lx\n", hr ); @@ -1999,7 +2003,8 @@ static void test_sys_mouse( DWORD version ) ok( count == 1, "got count %lu\n", count ); hr = IDirectInputDevice8_Acquire( device ); - ok( hr == DI_OK, "Acquire returned %#lx\n", hr ); + ok( hr == DI_OK, "Acquire returned %#lx, skipping test_sys_mouse\n", hr ); + if (hr != DI_OK) goto cleanup; mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 ); res = WaitForSingleObject( event, 100 ); @@ -2014,7 +2019,9 @@ static void test_sys_mouse( DWORD version ) ok( hr == DI_OK, "Unacquire returned %#lx\n", hr ); hr = IDirectInputDevice8_Acquire( device ); - ok( hr == DI_OK, "Acquire returned %#lx\n", hr ); + ok( hr == DI_OK, "Acquire returned %#lx, skipping test_sys_mouse\n", hr ); + if (hr != DI_OK) goto cleanup; + count = 1; hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 ); ok( hr == (version < 0x800 ? DI_OK : DI_BUFFEROVERFLOW), "GetDeviceData returned %#lx\n", hr ); @@ -2065,6 +2072,7 @@ static void test_sys_mouse( DWORD version ) DestroyWindow( tmp_hwnd ); +cleanup: CloseHandle( event ); DestroyWindow( hwnd );
participants (1)
-
Alexandre Julliard