Commit 8f6ab168 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

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
parent 0007925e
...@@ -344,7 +344,8 @@ void test_overlapped_format( DWORD version ) ...@@ -344,7 +344,8 @@ void test_overlapped_format( DWORD version )
hr = IDirectInputDevice_Acquire( keyboard ); 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 ); keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE, 0 );
res = WaitForSingleObject( event, 100 ); res = WaitForSingleObject( event, 100 );
...@@ -405,7 +406,8 @@ void test_overlapped_format( DWORD version ) ...@@ -405,7 +406,8 @@ void test_overlapped_format( DWORD version )
hr = IDirectInputDevice_Acquire( keyboard ); 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 ); keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE, 0 );
res = WaitForSingleObject( event, 100 ); res = WaitForSingleObject( event, 100 );
...@@ -457,6 +459,7 @@ void test_overlapped_format( DWORD version ) ...@@ -457,6 +459,7 @@ void test_overlapped_format( DWORD version )
ok( count == 1, "got count %lu\n", count ); ok( count == 1, "got count %lu\n", count );
cleanup:
IUnknown_Release( keyboard ); IUnknown_Release( keyboard );
DestroyWindow( hwnd ); DestroyWindow( hwnd );
...@@ -1969,7 +1972,8 @@ static void test_sys_mouse( DWORD version ) ...@@ -1969,7 +1972,8 @@ static void test_sys_mouse( DWORD version )
hr = IDirectInputDevice8_Unacquire( device ); hr = IDirectInputDevice8_Unacquire( device );
ok( hr == DI_NOEFFECT, "Unacquire returned %#lx\n", hr ); ok( hr == DI_NOEFFECT, "Unacquire returned %#lx\n", hr );
hr = IDirectInputDevice8_Acquire( device ); 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 ); hr = IDirectInputDevice8_Acquire( device );
ok( hr == DI_NOEFFECT, "Acquire returned %#lx\n", hr ); ok( hr == DI_NOEFFECT, "Acquire returned %#lx\n", hr );
...@@ -1999,7 +2003,8 @@ static void test_sys_mouse( DWORD version ) ...@@ -1999,7 +2003,8 @@ static void test_sys_mouse( DWORD version )
ok( count == 1, "got count %lu\n", count ); ok( count == 1, "got count %lu\n", count );
hr = IDirectInputDevice8_Acquire( device ); 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 ); mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
res = WaitForSingleObject( event, 100 ); res = WaitForSingleObject( event, 100 );
...@@ -2014,7 +2019,9 @@ static void test_sys_mouse( DWORD version ) ...@@ -2014,7 +2019,9 @@ static void test_sys_mouse( DWORD version )
ok( hr == DI_OK, "Unacquire returned %#lx\n", hr ); ok( hr == DI_OK, "Unacquire returned %#lx\n", hr );
hr = IDirectInputDevice8_Acquire( device ); 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; count = 1;
hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 ); hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 );
ok( hr == (version < 0x800 ? DI_OK : DI_BUFFEROVERFLOW), "GetDeviceData returned %#lx\n", hr ); ok( hr == (version < 0x800 ? DI_OK : DI_BUFFEROVERFLOW), "GetDeviceData returned %#lx\n", hr );
...@@ -2065,6 +2072,7 @@ static void test_sys_mouse( DWORD version ) ...@@ -2065,6 +2072,7 @@ static void test_sys_mouse( DWORD version )
DestroyWindow( tmp_hwnd ); DestroyWindow( tmp_hwnd );
cleanup:
CloseHandle( event ); CloseHandle( event );
DestroyWindow( hwnd ); DestroyWindow( hwnd );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment