Trying to reduce the likelihood of spurious failures. Keyboard / mouse devices are more subject to window foreground issues and less reliable than the HID joystick device. This also increases the timeout of some waits that aren't supposed to fail, trying to mitigate possible failures on Gitlab CI, under suspected heavy load.
Supersedes https://gitlab.winehq.org/wine/wine/-/merge_requests/2261.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54558 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54594
From: Francois Gouget fgouget@codeweavers.com
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 );
From: Rémi Bernon rbernon@codeweavers.com
--- include/dinput.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/dinput.h b/include/dinput.h index 71cc55aece5..2ebe1b1e83e 100644 --- a/include/dinput.h +++ b/include/dinput.h @@ -2172,6 +2172,12 @@ extern const DIDATAFORMAT c_dfDIJoystick2; }; #endif
+#define DIVIRTUAL_DRIVING_RACE 0x01000000 +#define DIAXIS_DRIVINGR_STEER 0x01008a01 +#define DIAXIS_DRIVINGR_ACCELERATE 0x01039202 + +#define DIVOICE_CHANNEL1 0x83000401 + #define DIAXIS_ANY_X_1 0xFF00C201 #define DIAXIS_ANY_X_2 0xFF00C202 #define DIAXIS_ANY_Y_1 0xFF014201
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/joystick8.c | 541 ++++++++++++++++++++++++++++++++++ 1 file changed, 541 insertions(+)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 2d00d2e541c..6dbd4f3e9d6 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -47,6 +47,11 @@ #include "windows.gaming.input.h" #undef Size
+#include "initguid.h" + +DEFINE_GUID(GUID_action_mapping_1,0x00000001,0x0002,0x0003,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b); +DEFINE_GUID(GUID_action_mapping_2,0x00010001,0x0002,0x0003,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b); + static HRESULT (WINAPI *pRoGetActivationFactory)( HSTRING, REFIID, void** ); static HRESULT (WINAPI *pRoInitialize)( RO_INIT_TYPE ); static HRESULT (WINAPI *pWindowsCreateString)( const WCHAR*, UINT32, HSTRING* ); @@ -203,6 +208,62 @@ static BOOL CALLBACK check_no_created_effect_objects( IDirectInputEffect *effect return DIENUM_CONTINUE; }
+struct diaction_todo +{ + BOOL instance; + BOOL objid; + BOOL how; +}; + +#define check_diactionw( a, b ) check_diactionw_( __LINE__, a, b, NULL ) +static void check_diactionw_( int line, const DIACTIONW *actual, const DIACTIONW *expected, + const struct diaction_todo *todos ) +{ + check_member_( __FILE__, line, *actual, *expected, "%#Ix", uAppData ); + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwSemantic ); + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwFlags ); + if (actual->lptszActionName && expected->lptszActionName) + check_member_wstr_( __FILE__, line, *actual, *expected, lptszActionName ); + else + check_member_( __FILE__, line, *actual, *expected, "%p", lptszActionName ); + todo_wine_if( todos->instance ) + check_member_guid_( __FILE__, line, *actual, *expected, guidInstance ); + todo_wine_if( todos->objid ) + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwObjID ); + todo_wine_if( todos->how ) + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwHow ); +} + +#define check_diactionformatw( a, b ) check_diactionformatw_( __LINE__, a, b, NULL ) +static void check_diactionformatw_( int line, const DIACTIONFORMATW *actual, const DIACTIONFORMATW *expected, + const struct diaction_todo *todos ) +{ + DWORD i; + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwSize ); + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwActionSize ); + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwDataSize ); + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwNumActions ); + for (i = 0; i < min( actual->dwNumActions, expected->dwNumActions ); ++i) + { + winetest_push_context( "action[%lu]", i ); + check_diactionw_( line, actual->rgoAction + i, expected->rgoAction + i, todos ? todos + i : NULL ); + winetest_pop_context(); + if (expected->dwActionSize != sizeof(DIACTIONW)) break; + if (actual->dwActionSize != sizeof(DIACTIONW)) break; + } + check_member_guid_( __FILE__, line, *actual, *expected, guidActionMap ); + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwGenre ); + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwBufferSize ); + check_member_( __FILE__, line, *actual, *expected, "%+ld", lAxisMin ); + check_member_( __FILE__, line, *actual, *expected, "%+ld", lAxisMax ); + check_member_( __FILE__, line, *actual, *expected, "%p", hInstString ); + check_member_( __FILE__, line, *actual, *expected, "%ld", ftTimeStamp.dwLowDateTime ); + check_member_( __FILE__, line, *actual, *expected, "%ld", ftTimeStamp.dwHighDateTime ); + todo_wine + check_member_( __FILE__, line, *actual, *expected, "%#lx", dwCRC ); + check_member_wstr_( __FILE__, line, *actual, *expected, tszActionMap ); +} + static BOOL CALLBACK enum_device_count( const DIDEVICEINSTANCEW *devinst, void *context ) { DWORD *count = context; @@ -356,6 +417,482 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst ) } }
+static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE event ) +{ + const DIACTIONW expect_actions[] = + { + { + .dwSemantic = DIBUTTON_ANY( 1 ), + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 0 ), + }, + { + .dwSemantic = DIBUTTON_ANY( 2 ), + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 1 ), + }, + { + .dwSemantic = DIAXIS_ANY_X_1, + }, + { + .dwSemantic = DIPOV_ANY_1, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_POV | DIDFT_MAKEINSTANCE( 0 ), + }, + { + .dwSemantic = DIAXIS_DRIVINGR_ACCELERATE, + }, + { + .dwSemantic = DIAXIS_ANY_Z_2, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 ), + }, + { + .dwSemantic = DIAXIS_ANY_4, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 6 ), + }, + { + .dwSemantic = DIAXIS_DRIVINGR_STEER, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 0 ), + }, + }; + const DIACTIONW expect_filled_actions[ARRAY_SIZE(expect_actions)] = + { + { + .dwSemantic = DIBUTTON_ANY( 1 ), + .guidInstance = expect_guid_product, + .dwHow = DIAH_APPREQUESTED, + .dwObjID = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 1 ), + .dwFlags = DIA_APPMAPPED, + .lptszActionName = L"Button 1", + .uAppData = 1, + }, + { + .dwSemantic = DIBUTTON_ANY( 2 ), + .guidInstance = expect_guid_product, + .dwObjID = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 0 ), + .dwFlags = DIA_APPNOMAP, + .lptszActionName = L"Button 2", + .uAppData = 2, + }, + { + .dwSemantic = DIAXIS_ANY_X_1, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 1 ), + .dwFlags = DIA_FORCEFEEDBACK, + .lptszActionName = L"Wheel", + .uAppData = 3, + }, + { + .dwSemantic = DIPOV_ANY_1, + .guidInstance = expect_guid_product, + .dwHow = DIAH_APPREQUESTED, + .dwObjID = DIDFT_POV | DIDFT_MAKEINSTANCE( 0 ), + .dwFlags = DIA_APPMAPPED | DIA_APPFIXED, + .lptszActionName = L"POV", + .uAppData = 4, + }, + { + .dwSemantic = DIAXIS_DRIVINGR_ACCELERATE, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 1 ), + .dwFlags = DIA_NORANGE, + .lptszActionName = L"Accelerate", + .uAppData = 5, + }, + { + .dwSemantic = DIAXIS_ANY_Z_2, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 ), + .dwFlags = DIA_APPFIXED, + .lptszActionName = L"Z", + .uAppData = 6, + }, + { + .dwSemantic = DIAXIS_ANY_4, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 6 ), + .dwFlags = DIA_APPFIXED, + .lptszActionName = L"Axis 4", + .uAppData = 7, + }, + { + .dwSemantic = DIAXIS_DRIVINGR_STEER, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 0 ), + .lptszActionName = L"Steer", + .uAppData = 8, + }, + }; + const DIACTIONFORMATW expect_action_format_1 = + { + .dwSize = sizeof(DIACTIONFORMATW), + .dwActionSize = sizeof(DIACTIONW), + .dwNumActions = 1, + .dwDataSize = 4, + .rgoAction = (DIACTIONW *)expect_actions, + .dwGenre = DIVIRTUAL_DRIVING_RACE, + .guidActionMap = GUID_action_mapping_1, + .dwCRC = 0x6cd1f698, + }; + const DIACTIONFORMATW expect_action_format_2 = + { + .dwSize = sizeof(DIACTIONFORMATW), + .dwActionSize = sizeof(DIACTIONW), + .dwNumActions = ARRAY_SIZE(expect_actions), + .dwDataSize = 4 * ARRAY_SIZE(expect_actions), + .rgoAction = (DIACTIONW *)expect_actions, + .dwGenre = DIVIRTUAL_DRIVING_RACE, + .guidActionMap = GUID_action_mapping_2, + .dwCRC = 0x9a7bb5e6, + }; + const DIACTIONFORMATW expect_action_format_2_filled = + { + .dwSize = sizeof(DIACTIONFORMATW), + .dwActionSize = sizeof(DIACTIONW), + .dwNumActions = ARRAY_SIZE(expect_actions), + .dwDataSize = 4 * ARRAY_SIZE(expect_actions), + .rgoAction = (DIACTIONW *)expect_filled_actions, + .dwGenre = DIVIRTUAL_DRIVING_RACE, + .guidActionMap = GUID_action_mapping_2, + .dwBufferSize = 32, + .lAxisMin = -128, + .lAxisMax = +128, + .tszActionMap = L"Action Map Filled", + .dwCRC = 0x3d98f717, + }; + DIACTIONW voice_actions[] = + { + {.dwSemantic = DIVOICE_CHANNEL1}, + }; + DIACTIONFORMATW voice_action_format = + { + .dwSize = sizeof(DIACTIONFORMATW), + .dwActionSize = sizeof(*voice_actions), + .dwNumActions = 1, + .dwDataSize = 4, + .rgoAction = voice_actions, + .dwGenre = DIVIRTUAL_DRIVING_RACE, + .guidActionMap = GUID_action_mapping_1, + }; + DIACTIONW default_actions[ARRAY_SIZE(expect_actions)] = + { + {.dwSemantic = DIBUTTON_ANY( 1 )}, + {.dwSemantic = DIBUTTON_ANY( 2 )}, + {.dwSemantic = DIAXIS_ANY_X_1}, + {.dwSemantic = DIPOV_ANY_1}, + {.dwSemantic = DIAXIS_DRIVINGR_ACCELERATE}, + {.dwSemantic = DIAXIS_ANY_Z_2}, + {.dwSemantic = DIAXIS_ANY_4}, + {.dwSemantic = DIAXIS_DRIVINGR_STEER}, + }; + DIACTIONFORMATW action_format_1 = + { + .dwSize = sizeof(DIACTIONFORMATW), + .dwActionSize = sizeof(*default_actions), + .dwNumActions = 1, + .dwDataSize = 4, + .rgoAction = default_actions, + .dwGenre = DIVIRTUAL_DRIVING_RACE, + .guidActionMap = GUID_action_mapping_1, + }; + DIACTIONFORMATW action_format_2 = + { + .dwSize = sizeof(DIACTIONFORMATW), + .dwActionSize = sizeof(*default_actions), + .dwNumActions = ARRAY_SIZE(expect_actions), + .dwDataSize = 4 * ARRAY_SIZE(expect_actions), + .rgoAction = default_actions, + .dwGenre = DIVIRTUAL_DRIVING_RACE, + .guidActionMap = GUID_action_mapping_2, + }; + DIACTIONW filled_actions[ARRAY_SIZE(expect_actions)] = + { + { + .dwSemantic = DIBUTTON_ANY( 1 ), + .guidInstance = expect_guid_product, + .dwHow = DIAH_USERCONFIG, + .dwObjID = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 1 ), + .dwFlags = DIA_APPMAPPED, + .lptszActionName = L"Button 1", + .uAppData = 1, + }, + { + .dwSemantic = DIBUTTON_ANY( 2 ), + .guidInstance = expect_guid_product, + .dwObjID = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 0 ), + .dwFlags = DIA_APPNOMAP, + .lptszActionName = L"Button 2", + .uAppData = 2, + }, + { + .dwSemantic = DIAXIS_ANY_X_1, + .guidInstance = expect_guid_product, + .dwHow = DIAH_HWDEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 1 ), + .dwFlags = DIA_FORCEFEEDBACK, + .lptszActionName = L"Wheel", + .uAppData = 3, + }, + { + .dwSemantic = DIPOV_ANY_1, + .guidInstance = expect_guid_product, + .dwHow = DIAH_HWAPP, + .dwObjID = DIDFT_POV | DIDFT_MAKEINSTANCE( 0 ), + .dwFlags = DIA_APPMAPPED | DIA_APPFIXED, + .lptszActionName = L"POV", + .uAppData = 4, + }, + { + .dwSemantic = DIAXIS_DRIVINGR_ACCELERATE, + .guidInstance = expect_guid_product, + .dwHow = DIAH_USERCONFIG, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 1 ), + .dwFlags = DIA_NORANGE, + .lptszActionName = L"Accelerate", + .uAppData = 5, + }, + { + .dwSemantic = DIAXIS_ANY_Z_2, + .guidInstance = expect_guid_product, + .dwHow = DIAH_UNMAPPED, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 3 ), + .dwFlags = DIA_APPFIXED, + .lptszActionName = L"Z", + .uAppData = 6, + }, + { + .dwSemantic = DIAXIS_ANY_4, + .guidInstance = expect_guid_product, + .dwHow = DIAH_DEFAULT, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 5 ), + .dwFlags = DIA_APPFIXED, + .lptszActionName = L"Axis 4", + .uAppData = 7, + }, + { + .dwSemantic = DIAXIS_DRIVINGR_STEER, + .guidInstance = expect_guid_product, + .dwHow = DIAH_USERCONFIG, + .dwObjID = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 4 ), + .lptszActionName = L"Steer", + .uAppData = 8, + }, + }; + DIACTIONFORMATW action_format_2_filled = + { + .dwSize = sizeof(DIACTIONFORMATW), + .dwActionSize = sizeof(*default_actions), + .dwNumActions = ARRAY_SIZE(expect_actions), + .dwDataSize = 4 * ARRAY_SIZE(expect_actions), + .rgoAction = filled_actions, + .dwGenre = DIVIRTUAL_DRIVING_RACE, + .guidActionMap = GUID_action_mapping_2, + .dwBufferSize = 32, + .lAxisMin = -128, + .lAxisMax = +128, + .tszActionMap = L"Action Map Filled", + }; + struct diaction_todo actions_todos_1 = {.instance = TRUE, .objid = TRUE, .how = TRUE}; + struct diaction_todo actions_todos_2[ARRAY_SIZE(expect_actions)] = + { + {.instance = TRUE, .objid = TRUE, .how = TRUE}, + {.instance = TRUE, .objid = TRUE, .how = TRUE}, + {0}, + {.instance = TRUE, .objid = TRUE, .how = TRUE}, + {.instance = TRUE, .objid = TRUE, .how = TRUE}, + {.instance = TRUE, .objid = TRUE, .how = TRUE}, + {.instance = TRUE, .objid = TRUE, .how = TRUE}, + {.objid = TRUE}, + }; + struct diaction_todo actions_todos_2_filled[ARRAY_SIZE(expect_actions)] = + { + {.how = TRUE}, + {0}, + {.instance = TRUE, .how = TRUE}, + {.how = TRUE}, + {.instance = TRUE, .how = TRUE}, + {.objid = TRUE, .how = TRUE}, + {.objid = TRUE}, + {.objid = TRUE, .how = TRUE}, + }; + DIACTIONW actions[ARRAY_SIZE(expect_actions)]; + DIACTIONFORMATW action_format; + DWORD flags; + HRESULT hr; + + + hr = IDirectInputDevice8_BuildActionMap( device, NULL, L"username", DIDBAM_DEFAULT ); + ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); + hr = IDirectInputDevice8_BuildActionMap( device, &action_format_1, L"username", 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); + flags = DIDBAM_HWDEFAULTS | DIDBAM_INITIALIZE; + hr = IDirectInputDevice8_BuildActionMap( device, &action_format_1, L"username", flags ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); + flags = DIDBAM_HWDEFAULTS | DIDBAM_PRESERVE; + hr = IDirectInputDevice8_BuildActionMap( device, &action_format_1, L"username", flags ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); + flags = DIDBAM_INITIALIZE | DIDBAM_PRESERVE; + hr = IDirectInputDevice8_BuildActionMap( device, &action_format_1, L"username", flags ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); + + hr = IDirectInputDevice8_SetActionMap( device, NULL, NULL, DIDSAM_DEFAULT ); + ok( hr == DIERR_INVALIDPARAM, "SetActionMap returned %#lx\n", hr ); + flags = DIDSAM_FORCESAVE | DIDSAM_NOUSER; + hr = IDirectInputDevice8_SetActionMap( device, &action_format_1, NULL, flags ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetActionMap returned %#lx\n", hr ); + + + /* action format with no suitable actions */ + + hr = IDirectInputDevice8_BuildActionMap( device, &voice_action_format, NULL, DIDBAM_DEFAULT ); + ok( hr == DI_NOEFFECT, "BuildActionMap returned %#lx\n", hr ); + + /* first SetActionMap call for a user always return DI_SETTINGSNOTSAVED */ + + hr = IDirectInputDevice8_SetActionMap( device, &voice_action_format, NULL, DIDSAM_FORCESAVE ); + todo_wine + ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr ); + + hr = IDirectInputDevice8_SetActionMap( device, &voice_action_format, NULL, DIDSAM_DEFAULT ); + ok( hr == DI_NOEFFECT, "SetActionMap returned %#lx\n", hr ); + hr = IDirectInputDevice8_SetActionMap( device, &voice_action_format, NULL, DIDSAM_FORCESAVE ); + todo_wine + ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr ); + + + action_format = action_format_1; + action_format.rgoAction = actions; + memset( actions, 0, sizeof(actions) ); + actions[0] = default_actions[0]; + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, NULL, DIDBAM_DEFAULT ); + todo_wine + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_1, &actions_todos_1 ); + hr = IDirectInputDevice8_SetActionMap( device, &action_format, NULL, DIDSAM_DEFAULT ); + todo_wine + ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_1, &actions_todos_1 ); + + + action_format = action_format_1; + action_format.rgoAction = actions; + memset( actions, 0, sizeof(actions) ); + actions[0] = default_actions[0]; + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_DEFAULT ); + todo_wine + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_1, &actions_todos_1 ); + + /* first SetActionMap call for a user always return DI_SETTINGSNOTSAVED */ + + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_DEFAULT ); + todo_wine + ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr ); + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_DEFAULT ); + todo_wine + ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr ); + + /* same SetActionMap call returns DI_OK */ + + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_DEFAULT ); + todo_wine + ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr ); + + /* DIDSAM_FORCESAVE always returns DI_SETTINGSNOTSAVED */ + + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_FORCESAVE ); + todo_wine + ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr ); + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_FORCESAVE ); + todo_wine + ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_1, &actions_todos_1 ); + + + /* action format dwDataSize and dwNumActions have to match, actions require a dwSemantic */ + + action_format = action_format_2; + action_format.rgoAction = actions; + memset( actions, 0, sizeof(actions) ); + actions[0] = default_actions[0]; + action_format.dwDataSize = 8; + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_DEFAULT ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); + action_format.dwNumActions = 2; + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_DEFAULT ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); + action_format.dwNumActions = 1; + action_format.dwDataSize = 4; + + + action_format = action_format_2; + action_format.rgoAction = actions; + memcpy( actions, default_actions, sizeof(default_actions) ); + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_DEFAULT ); + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 ); + + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_DEFAULT ); + ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr ); + + + /* saving action map actually does nothing */ + + action_format = action_format_2_filled; + action_format.rgoAction = actions; + memcpy( actions, filled_actions, sizeof(filled_actions) ); + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_DEFAULT ); + todo_wine + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2_filled, actions_todos_2_filled ); + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_DEFAULT ); + ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2_filled, actions_todos_2_filled ); + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_FORCESAVE ); + todo_wine + ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2_filled, actions_todos_2_filled ); + + + action_format = action_format_2; + action_format.rgoAction = actions; + memcpy( actions, default_actions, sizeof(default_actions) ); + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_HWDEFAULTS ); + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 ); + + action_format = action_format_2; + action_format.rgoAction = actions; + memcpy( actions, default_actions, sizeof(default_actions) ); + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_INITIALIZE ); + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 ); + + action_format = action_format_2; + action_format.rgoAction = actions; + memcpy( actions, default_actions, sizeof(default_actions) ); + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_PRESERVE ); + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 ); +} + static void test_simple_joystick( DWORD version ) { #include "psh_hid_macros.h" @@ -2057,6 +2594,8 @@ static void test_simple_joystick( DWORD version ) todo_wine ok( hr == DIERR_UNSUPPORTED, "Escape returned: %#lx\n", hr );
+ if (version == 0x800) test_action_map( device, file, event ); + ref = IDirectInputDevice8_Release( device ); ok( ref == 0, "Release returned %ld\n", ref );
@@ -4404,6 +4943,8 @@ START_TEST( joystick8 ) dinput_test_init(); if (!bus_device_start()) goto done;
+ winetest_mute_threshold = 3; + if (test_device_types( 0x800 )) { /* This needs to be done before doing anything involving dinput.dll
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/joystick8.c | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 6dbd4f3e9d6..fe31e113e55 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -725,11 +725,29 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e {.objid = TRUE}, {.objid = TRUE, .how = TRUE}, }; + DIPROPSTRING prop_username = + { + .diph = + { + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwSize = sizeof(DIPROPSTRING), + .dwHow = DIPH_DEVICE, + } + }; DIACTIONW actions[ARRAY_SIZE(expect_actions)]; DIACTIONFORMATW action_format; + WCHAR username[256]; DWORD flags; HRESULT hr;
+ res = ARRAY_SIZE(username); + GetUserNameW( username, &res ); + + memset( prop_username.wsz, 0, sizeof(prop_username.wsz) ); + hr = IDirectInputDevice_GetProperty( device, DIPROP_USERNAME, &prop_username.diph ); + ok( hr == DI_NOEFFECT, "GetProperty returned %#lx\n", hr ); + ok( !wcscmp( prop_username.wsz, L"" ), "got username %s\n", debugstr_w(prop_username.wsz) ); +
hr = IDirectInputDevice8_BuildActionMap( device, NULL, L"username", DIDBAM_DEFAULT ); ok( hr == DIERR_INVALIDPARAM, "BuildActionMap returned %#lx\n", hr ); @@ -768,12 +786,26 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e todo_wine ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr );
+ memset( prop_username.wsz, 0, sizeof(prop_username.wsz) ); + hr = IDirectInputDevice_GetProperty( device, DIPROP_USERNAME, &prop_username.diph ); + todo_wine + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( !wcscmp( prop_username.wsz, username ), "got username %s\n", debugstr_w(prop_username.wsz) ); + hr = IDirectInputDevice8_SetActionMap( device, &voice_action_format, NULL, DIDSAM_DEFAULT ); ok( hr == DI_NOEFFECT, "SetActionMap returned %#lx\n", hr ); hr = IDirectInputDevice8_SetActionMap( device, &voice_action_format, NULL, DIDSAM_FORCESAVE ); todo_wine ok( hr == DI_SETTINGSNOTSAVED, "SetActionMap returned %#lx\n", hr );
+ memset( prop_username.wsz, 0, sizeof(prop_username.wsz) ); + hr = IDirectInputDevice_GetProperty( device, DIPROP_USERNAME, &prop_username.diph ); + todo_wine + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( !wcscmp( prop_username.wsz, username ), "got username %s\n", debugstr_w(prop_username.wsz) ); +
action_format = action_format_1; action_format.rgoAction = actions; @@ -891,6 +923,22 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_PRESERVE ); ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 ); + + + /* DIDSAM_NOUSER flag clears the device user property */ + + memset( prop_username.wsz, 0, sizeof(prop_username.wsz) ); + hr = IDirectInputDevice_GetProperty( device, DIPROP_USERNAME, &prop_username.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( !wcscmp( prop_username.wsz, L"username" ), "got username %s\n", debugstr_w(prop_username.wsz) ); + + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_NOUSER ); + ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr ); + + memset( prop_username.wsz, 0, sizeof(prop_username.wsz) ); + hr = IDirectInputDevice_GetProperty( device, DIPROP_USERNAME, &prop_username.diph ); + ok( hr == DI_NOEFFECT, "GetProperty returned %#lx\n", hr ); + ok( !wcscmp( prop_username.wsz, L"" ), "got username %s\n", debugstr_w(prop_username.wsz) ); }
static void test_simple_joystick( DWORD version )
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/joystick8.c | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index fe31e113e55..54fbedb5837 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -734,6 +734,14 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e .dwHow = DIPH_DEVICE, } }; + DIPROPPOINTER prop_pointer = + { + .diph = + { + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwSize = sizeof(DIPROPPOINTER), + } + }; DIACTIONW actions[ARRAY_SIZE(expect_actions)]; DIACTIONFORMATW action_format; WCHAR username[256]; @@ -885,6 +893,14 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr );
+ prop_pointer.diph.dwHow = DIPH_BYUSAGE; + prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); + todo_wine + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( prop_pointer.uData == 0, "got uData %#Ix\n", prop_pointer.uData ); + + /* saving action map actually does nothing */
action_format = action_format_2_filled; @@ -903,6 +919,34 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2_filled, actions_todos_2_filled );
+ prop_pointer.diph.dwHow = DIPH_DEVICE; + prop_pointer.diph.dwObj = 0; + hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); + ok( hr == DIERR_UNSUPPORTED, "GetProperty returned %#lx\n", hr ); + + prop_pointer.diph.dwHow = DIPH_BYID; + prop_pointer.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 3 ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); + todo_wine + ok( hr == DIERR_NOTFOUND, "GetProperty returned %#lx\n", hr ); + + prop_pointer.diph.dwHow = DIPH_BYID; + prop_pointer.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); + todo_wine + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( prop_pointer.uData == 6, "got uData %#Ix\n", prop_pointer.uData ); + + prop_pointer.diph.dwHow = DIPH_BYUSAGE; + prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); + todo_wine + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( prop_pointer.uData == 8, "got uData %#Ix\n", prop_pointer.uData ); + + action_format = action_format_2; action_format.rgoAction = actions; memcpy( actions, default_actions, sizeof(default_actions) ); @@ -925,6 +969,28 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 );
+ /* setting the data format resets action map */ + + prop_pointer.diph.dwHow = DIPH_BYUSAGE; + prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); + todo_wine + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( prop_pointer.uData == 8, "got uData %#Ix\n", prop_pointer.uData ); + + hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 ); + ok( hr == DI_OK, "SetDataFormat returned %#lx\n", hr ); + + prop_pointer.diph.dwHow = DIPH_BYUSAGE; + prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); + todo_wine + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( prop_pointer.uData == -1, "got uData %#Ix\n", prop_pointer.uData ); + + /* DIDSAM_NOUSER flag clears the device user property */
memset( prop_username.wsz, 0, sizeof(prop_username.wsz) );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/joystick8.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 54fbedb5837..0e6f71ee5c7 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -725,6 +725,15 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e {.objid = TRUE}, {.objid = TRUE, .how = TRUE}, }; + DIPROPDWORD prop_dword = + { + .diph = + { + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwSize = sizeof(DIPROPDWORD), + .dwHow = DIPH_DEVICE, + } + }; DIPROPSTRING prop_username = { .diph = @@ -900,6 +909,11 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); ok( prop_pointer.uData == 0, "got uData %#Ix\n", prop_pointer.uData );
+ hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( prop_dword.dwData == 0, "got dwData %#lx\n", prop_dword.dwData ); +
/* saving action map actually does nothing */
@@ -946,6 +960,10 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e todo_wine ok( prop_pointer.uData == 8, "got uData %#Ix\n", prop_pointer.uData );
+ hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( prop_dword.dwData == 32, "got dwData %#lx\n", prop_dword.dwData ); +
action_format = action_format_2; action_format.rgoAction = actions; @@ -990,6 +1008,10 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e todo_wine ok( prop_pointer.uData == -1, "got uData %#Ix\n", prop_pointer.uData );
+ hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( prop_dword.dwData == 32, "got dwData %#lx\n", prop_dword.dwData ); +
/* DIDSAM_NOUSER flag clears the device user property */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/joystick8.c | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 0e6f71ee5c7..c7719cca5f5 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -725,6 +725,15 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e {.objid = TRUE}, {.objid = TRUE, .how = TRUE}, }; + DIPROPRANGE prop_range = + { + .diph = + { + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwSize = sizeof(DIPROPRANGE), + .dwHow = DIPH_DEVICE, + } + }; DIPROPDWORD prop_dword = { .diph = @@ -909,6 +918,24 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); ok( prop_pointer.uData == 0, "got uData %#Ix\n", prop_pointer.uData );
+ prop_range.diph.dwHow = DIPH_BYID; + prop_range.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( prop_range.lMin == +1000, "got lMin %+ld\n", prop_range.lMin ); + todo_wine + ok( prop_range.lMax == +51000, "got lMax %+ld\n", prop_range.lMax ); + + prop_range.diph.dwHow = DIPH_BYUSAGE; + prop_range.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + todo_wine + ok( prop_range.lMin == -14000, "got lMin %+ld\n", prop_range.lMin ); + todo_wine + ok( prop_range.lMax == -4000, "got lMax %+ld\n", prop_range.lMax ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph ); ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); todo_wine @@ -960,6 +987,20 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e todo_wine ok( prop_pointer.uData == 8, "got uData %#Ix\n", prop_pointer.uData );
+ prop_range.diph.dwHow = DIPH_BYID; + prop_range.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( prop_range.lMin == -128, "got lMin %+ld\n", prop_range.lMin ); + ok( prop_range.lMax == +128, "got lMax %+ld\n", prop_range.lMax ); + + prop_range.diph.dwHow = DIPH_BYUSAGE; + prop_range.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( prop_range.lMin == -128, "got lMin %+ld\n", prop_range.lMin ); + ok( prop_range.lMax == +128, "got lMax %+ld\n", prop_range.lMax ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph ); ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); ok( prop_dword.dwData == 32, "got dwData %#lx\n", prop_dword.dwData ); @@ -1008,6 +1049,20 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e todo_wine ok( prop_pointer.uData == -1, "got uData %#Ix\n", prop_pointer.uData );
+ prop_range.diph.dwHow = DIPH_BYID; + prop_range.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( prop_range.lMin == -128, "got lMin %+ld\n", prop_range.lMin ); + ok( prop_range.lMax == +128, "got lMax %+ld\n", prop_range.lMax ); + + prop_range.diph.dwHow = DIPH_BYUSAGE; + prop_range.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); + ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); + ok( prop_range.lMin == -128, "got lMin %+ld\n", prop_range.lMin ); + ok( prop_range.lMax == +128, "got lMax %+ld\n", prop_range.lMax ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph ); ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); ok( prop_dword.dwData == 32, "got dwData %#lx\n", prop_dword.dwData );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/joystick8.c | 130 +++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index c7719cca5f5..be2fbf3b90a 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -570,6 +570,53 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e .tszActionMap = L"Action Map Filled", .dwCRC = 0x3d98f717, }; + struct hid_expect injected_input[] = + { + { + .code = IOCTL_HID_READ_REPORT, + .report_buf = {1,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0}, + }, + { + .code = IOCTL_HID_READ_REPORT, + .report_buf = {1,0x10,0x10,0x38,0x38,0x10,0x10,0x10,0xf8}, + }, + { + .code = IOCTL_HID_READ_REPORT, + .report_buf = {1,0x10,0x10,0x01,0x01,0x10,0x10,0x10,0x00}, + }, + { + .code = IOCTL_HID_READ_REPORT, + .report_buf = {1,0x10,0x10,0x01,0x01,0x10,0x10,0x10,0x00}, + }, + { + .code = IOCTL_HID_READ_REPORT, + .report_buf = {1,0x10,0x10,0x80,0x80,0x10,0x10,0x10,0xff}, + }, + { + .code = IOCTL_HID_READ_REPORT, + .report_buf = {1,0x10,0x10,0x10,0xee,0x10,0x10,0x10,0x54}, + }, + }; + const DWORD expect_state[ARRAY_SIZE(injected_input)][ARRAY_SIZE(expect_actions)] = + { + { 0, 0, 0, -1, 0, 0, 0, 0}, + { 0, 0, 0, -1, 0, 0, 0, 0}, + {+128, 0, 0, +31500, 0, 0, 0, +128}, + { 0, 0, 0, -1, 0, 0, 0, -43}, + { 0, 0, 0, -1, 0, 0, 0, -43}, + {+128, 0, 0, -1, 0, 0, 0, -128}, + }; + const DIDEVICEOBJECTDATA expect_objdata[8] = + { + {.dwOfs = 0x1c, .dwData = +128, .uAppData = 8}, + {.dwOfs = 0xc, .dwData = +31500, .uAppData = 4}, + {.dwOfs = 0, .dwData = +128, .uAppData = 1}, + {.dwOfs = 0x1c, .dwData = -43, .uAppData = 8}, + {.dwOfs = 0xc, .dwData = -1, .uAppData = 4}, + {.dwOfs = 0, .dwData = 0, .uAppData = 1}, + {.dwOfs = 0x1c, .dwData = -128, .uAppData = 8}, + {.dwOfs = 0, .dwData = +128, .uAppData = 1}, + }; DIACTIONW voice_actions[] = { {.dwSemantic = DIVOICE_CHANNEL1}, @@ -760,10 +807,12 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e .dwSize = sizeof(DIPROPPOINTER), } }; + DIDEVICEOBJECTDATA objdata[ARRAY_SIZE(expect_objdata)]; DIACTIONW actions[ARRAY_SIZE(expect_actions)]; + DWORD state[ARRAY_SIZE(expect_actions)]; DIACTIONFORMATW action_format; WCHAR username[256]; - DWORD flags; + DWORD i, res, flags; HRESULT hr;
res = ARRAY_SIZE(username); @@ -1028,6 +1077,85 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 );
+ hr = IDirectInputDevice8_Acquire( device ); + todo_wine + ok( hr == DI_OK, "Acquire returned: %#lx\n", hr ); + if (hr != DI_OK) goto skip_input; + + hr = IDirectInputDevice8_SetActionMap( device, &action_format, L"username", DIDSAM_DEFAULT ); + ok( hr == DIERR_ACQUIRED, "SetActionMap returned %#lx\n", hr ); + + send_hid_input( file, &injected_input[0], sizeof(*injected_input) ); + res = WaitForSingleObject( event, 100 ); + if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ + { + send_hid_input( file, &injected_input[0], sizeof(*injected_input) ); + res = WaitForSingleObject( event, 100 ); + } + todo_wine + ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); + + for (i = 0; i < ARRAY_SIZE(injected_input); ++i) + { + winetest_push_context( "state[%ld]", i ); + + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), state ); + todo_wine + ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr ); + todo_wine_if( expect_state[i][0] ) + ok( state[0] == expect_state[i][0], "got state[0] %+ld\n", state[0] ); + todo_wine_if( expect_state[i][1] ) + ok( state[1] == expect_state[i][1], "got state[1] %+ld\n", state[1] ); + todo_wine_if( expect_state[i][2] ) + ok( state[2] == expect_state[i][2], "got state[2] %+ld\n", state[2] ); + todo_wine_if( expect_state[i][3] ) + ok( state[3] == expect_state[i][3], "got state[3] %+ld\n", state[3] ); + todo_wine_if( expect_state[i][4] ) + ok( state[4] == expect_state[i][4], "got state[4] %+ld\n", state[4] ); + todo_wine_if( expect_state[i][5] ) + ok( state[5] == expect_state[i][5], "got state[5] %+ld\n", state[5] ); + todo_wine_if( expect_state[i][6] ) + ok( state[6] == expect_state[i][6], "got state[6] %+ld\n", state[6] ); + todo_wine_if( expect_state[i][7] ) + ok( state[7] == expect_state[i][7] + || broken(state[7] == -45 && expect_state[i][7] == -43) /* 32-bit rounding */, + "got state[7] %+ld\n", state[7] ); + + send_hid_input( file, &injected_input[i], sizeof(*injected_input) ); + + res = WaitForSingleObject( event, 100 ); + if (i == 0 || i == 3) ok( res == WAIT_TIMEOUT, "WaitForSingleObject succeeded\n" ); + else todo_wine ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); + ResetEvent( event ); + winetest_pop_context(); + } + + res = ARRAY_SIZE(objdata); + hr = IDirectInputDevice8_GetDeviceData( device, sizeof(*objdata), objdata, &res, DIGDD_PEEK ); + todo_wine + ok( hr == DI_BUFFEROVERFLOW, "GetDeviceData returned %#lx\n", hr ); + ok( res == 8, "got %lu expected %u\n", res, 8 ); + while (res--) + { + winetest_push_context( "%lu", res ); + todo_wine_if( expect_objdata[res].dwOfs ) + check_member( objdata[res], expect_objdata[res], "%#lx", dwOfs ); + todo_wine_if( expect_objdata[res].dwData ) + check_member( objdata[res], expect_objdata[res], "%#lx", dwData ); + todo_wine + check_member( objdata[res], expect_objdata[res], "%#Ix", uAppData ); + winetest_pop_context(); + } + +skip_input: + hr = IDirectInputDevice8_BuildActionMap( device, &action_format, L"username", DIDBAM_DEFAULT ); + ok( hr == DI_OK, "BuildActionMap returned %#lx\n", hr ); + + hr = IDirectInputDevice8_Unacquire( device ); + todo_wine + ok( hr == DI_OK, "Acquire returned: %#lx\n", hr ); + + /* setting the data format resets action map */
prop_pointer.diph.dwHow = DIPH_BYUSAGE;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/device8.c | 517 ------------------------------------ 1 file changed, 517 deletions(-)
diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index b9a4ce61eb6..ddc4af00aff 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -42,43 +42,7 @@ struct enum_data IDirectInput8A *dinput8; IDirectInputA *dinput; }; - DIACTIONFORMATA *lpdiaf; - IDirectInputDevice8A *keyboard; - IDirectInputDevice8A *mouse; - const char *username; - int ndevices; - HWND hwnd; -}; - -/* Dummy GUID */ -static const GUID ACTION_MAPPING_GUID = { 0x1, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } }; - -enum { - DITEST_AXIS, - DITEST_BUTTON, - DITEST_KEYBOARDSPACE, - DITEST_MOUSEBUTTON0, - DITEST_YAXIS -}; - -static DIACTIONA actionMapping[]= -{ - /* axis */ - { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer.\0" } }, - /* button */ - { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */, 0, { "Upshift.\0" } }, - /* keyboard key */ - { 2, DIKEYBOARD_SPACE, 0, { "Missile.\0" } }, - /* mouse button */ - { 3, DIMOUSE_BUTTON0, 0, { "Select\0" } }, - /* mouse axis */ - { 4, DIMOUSE_YAXIS, 0, { "Y Axis\0" } } }; -/* By placing the memory pointed to by lptszActionName right before memory with PAGE_NOACCESS - * one can find out that the regular ansi string termination is not respected by EnumDevicesBySemantics. - * Adding a double termination, making it a valid wide string termination, made the test succeed. - * Therefore it looks like ansi version of EnumDevicesBySemantics forwards the string to - * the wide variant without conversation. */
static void flush_events(void) { @@ -574,485 +538,6 @@ static void test_device_input( IDirectInputDevice8A *device, DWORD type, DWORD c CloseHandle( event ); }
-static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *lpdiaf, - int action_index, DWORD expected_type, DWORD expected_inst) -{ - HRESULT hr; - DIACTIONA *actions; - DWORD instance, type, how; - GUID assigned_to; - DIDEVICEINSTANCEA ddi; - - ddi.dwSize = sizeof(ddi); - IDirectInputDevice_GetDeviceInfo(lpdid, &ddi); - - hr = IDirectInputDevice8_BuildActionMap(lpdid, lpdiaf, NULL, DIDBAM_HWDEFAULTS); - ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr); - - actions = lpdiaf->rgoAction; - instance = DIDFT_GETINSTANCE(actions[action_index].dwObjID); - type = DIDFT_GETTYPE(actions[action_index].dwObjID); - how = actions[action_index].dwHow; - assigned_to = actions[action_index].guidInstance; - - ok (how == DIAH_USERCONFIG || how == DIAH_DEFAULT, "Action was not set dwHow=%#lx\n", how); - ok (instance == expected_inst, "Action not mapped correctly instance=%#lx expected=%#lx\n", instance, expected_inst); - ok (type == expected_type, "Action type not mapped correctly type=%#lx expected=%#lx\n", type, expected_type); - ok (IsEqualGUID(&assigned_to, &ddi.guidInstance), "Action and device GUID do not match action=%d\n", action_index); -} - -static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid, - DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef) -{ - HRESULT hr; - DIPROPDWORD dp; - DIPROPRANGE dpr; - DIPROPSTRING dps; - WCHAR usernameW[MAX_PATH]; - DWORD username_size = MAX_PATH; - struct enum_data *data = pvRef; - DWORD cnt; - DIDEVICEOBJECTDATA buffer[5]; - IDirectInputDevice8A *lpdid2; - - if (!data) return DIENUM_CONTINUE; - - data->ndevices++; - - /* Convert username to WCHAR */ - if (data->username != NULL) - { - username_size = MultiByteToWideChar(CP_ACP, 0, data->username, -1, usernameW, 0); - MultiByteToWideChar(CP_ACP, 0, data->username, -1, usernameW, username_size); - } - else - GetUserNameW(usernameW, &username_size); - - /* collect the mouse and keyboard */ - if (IsEqualGUID(&lpddi->guidInstance, &GUID_SysKeyboard)) - { - IDirectInputDevice_AddRef(lpdid); - data->keyboard = lpdid; - - ok (dwFlags & DIEDBS_MAPPEDPRI1, "Keyboard should be mapped as pri1 dwFlags=%#lx\n", dwFlags); - } - - if (IsEqualGUID(&lpddi->guidInstance, &GUID_SysMouse)) - { - IDirectInputDevice_AddRef(lpdid); - data->mouse = lpdid; - - ok (dwFlags & DIEDBS_MAPPEDPRI1, "Mouse should be mapped as pri1 dwFlags=%#lx\n", dwFlags); - } - - /* Creating second device object to check if it has the same username */ - hr = IDirectInput_CreateDevice(data->dinput8, &lpddi->guidInstance, &lpdid2, NULL); - ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr); - - /* Building and setting an action map */ - /* It should not use any pre-stored mappings so we use DIDBAM_HWDEFAULTS */ - hr = IDirectInputDevice8_BuildActionMap(lpdid, data->lpdiaf, NULL, DIDBAM_HWDEFAULTS); - ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr); - - /* Device has no data format and thus can't be acquired */ - hr = IDirectInputDevice8_Acquire(lpdid); - ok (hr == DIERR_INVALIDPARAM, "Device was acquired before SetActionMap hr=%#lx\n", hr); - - hr = IDirectInputDevice8_SetActionMap(lpdid, data->lpdiaf, data->username, 0); - ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr); - - /* Some joysticks may have no suitable actions and thus should not be tested */ - if (hr == DI_NOEFFECT) return DIENUM_CONTINUE; - - /* Test username after SetActionMap */ - dps.diph.dwSize = sizeof(dps); - dps.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dps.diph.dwObj = 0; - dps.diph.dwHow = DIPH_DEVICE; - dps.wsz[0] = '\0'; - - hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_USERNAME, &dps.diph); - ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr); - ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(dps.wsz)); - - dps.wsz[0] = '\0'; - hr = IDirectInputDevice_GetProperty(lpdid2, DIPROP_USERNAME, &dps.diph); - ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr); - ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(dps.wsz)); - - /* Test buffer size */ - memset(&dp, 0, sizeof(dp)); - dp.diph.dwSize = sizeof(dp); - dp.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dp.diph.dwHow = DIPH_DEVICE; - - hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_BUFFERSIZE, &dp.diph); - ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr); - ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%lu\n", dp.dwData); - - cnt = 1; - hr = IDirectInputDevice_GetDeviceData(lpdid, sizeof(buffer[0]), buffer, &cnt, 0); - ok(hr == DIERR_NOTACQUIRED, "GetDeviceData() failed hr=%#lx\n", hr); - - /* Test axis range */ - memset(&dpr, 0, sizeof(dpr)); - dpr.diph.dwSize = sizeof(dpr); - dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dpr.diph.dwHow = DIPH_DEVICE; - - hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_RANGE, &dpr.diph); - /* Only test if device supports the range property */ - if (SUCCEEDED(hr)) - { - ok (dpr.lMin == data->lpdiaf->lAxisMin, "SetActionMap must set the min axis range expected=%ld got=%ld\n", data->lpdiaf->lAxisMin, dpr.lMin); - ok (dpr.lMax == data->lpdiaf->lAxisMax, "SetActionMap must set the max axis range expected=%ld got=%ld\n", data->lpdiaf->lAxisMax, dpr.lMax); - } - - /* SetActionMap has set the data format so now it should work */ - hr = IDirectInputDevice8_Acquire(lpdid); - ok (SUCCEEDED(hr), "Acquire failed hr=%#lx\n", hr); - - cnt = 1; - hr = IDirectInputDevice_GetDeviceData(lpdid, sizeof(buffer[0]), buffer, &cnt, 0); - ok(hr == DI_OK, "GetDeviceData() failed hr=%#lx\n", hr); - - /* SetActionMap should not work on an acquired device */ - hr = IDirectInputDevice8_SetActionMap(lpdid, data->lpdiaf, NULL, 0); - ok (hr == DIERR_ACQUIRED, "SetActionMap succeeded with an acquired device hr=%#lx\n", hr); - - IDirectInputDevice_Release(lpdid2); - - return DIENUM_CONTINUE; -} - -static void test_appdata_property_vs_map(struct enum_data *data) -{ - HRESULT hr; - DIPROPPOINTER dp; - - dp.diph.dwSize = sizeof(dp); - dp.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dp.diph.dwHow = DIPH_BYID; - dp.diph.dwObj = DIDFT_MAKEINSTANCE(DIK_SPACE) | DIDFT_PSHBUTTON; - dp.uData = 10; - hr = IDirectInputDevice8_SetProperty(data->keyboard, DIPROP_APPDATA, &(dp.diph)); - ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr); - - test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_SPACE, 10); - - dp.diph.dwHow = DIPH_BYID; - dp.diph.dwObj = DIDFT_MAKEINSTANCE(DIK_V) | DIDFT_PSHBUTTON; - dp.uData = 11; - hr = IDirectInputDevice8_SetProperty(data->keyboard, DIPROP_APPDATA, &(dp.diph)); - ok(hr == DIERR_OBJECTNOTFOUND, "IDirectInputDevice8_SetProperty should not find key that's not in the action map hr=%#lx\n", hr); - - /* setting format should reset action map */ - hr = IDirectInputDevice8_SetDataFormat(data->keyboard, &c_dfDIKeyboard); - ok(SUCCEEDED(hr), "SetDataFormat failed: %#lx\n", hr); - - test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_SPACE, -1); - - dp.diph.dwHow = DIPH_BYID; - dp.diph.dwObj = DIDFT_MAKEINSTANCE(DIK_V) | DIDFT_PSHBUTTON; - dp.uData = 11; - hr = IDirectInputDevice8_SetProperty(data->keyboard, DIPROP_APPDATA, &(dp.diph)); - ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr); - - test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_V, 11); - - /* back to action map */ - hr = IDirectInputDevice8_SetActionMap(data->keyboard, data->lpdiaf, NULL, 0); - ok(SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr); - - test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_SPACE, 2); -} - -static void test_action_mapping(void) -{ - HRESULT hr; - IDirectInput8A *pDI = NULL; - DIACTIONFORMATA af; - DIPROPSTRING dps; - struct enum_data data = {.version = 0x800, .lpdiaf = &af}; - HWND hwnd; - - hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI); - if (hr == DIERR_OLDDIRECTINPUTVERSION || - hr == DIERR_BETADIRECTINPUTVERSION || - hr == REGDB_E_CLASSNOTREG) - { - win_skip("ActionMapping requires dinput8\n"); - return; - } - ok(SUCCEEDED(hr), "DirectInput8 Create failed: hr=%#lx\n", hr); - if (FAILED(hr)) return; - - hr = IDirectInput8_Initialize(pDI, instance, DIRECTINPUT_VERSION); - if (hr == DIERR_OLDDIRECTINPUTVERSION || hr == DIERR_BETADIRECTINPUTVERSION) - { - win_skip("ActionMapping requires dinput8\n"); - return; - } - ok(SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%#lx\n", hr); - if (FAILED(hr)) return; - - memset (&af, 0, sizeof(af)); - af.dwSize = sizeof(af); - af.dwActionSize = sizeof(DIACTIONA); - af.dwDataSize = 4 * ARRAY_SIZE(actionMapping); - af.dwNumActions = ARRAY_SIZE(actionMapping); - af.rgoAction = actionMapping; - af.guidActionMap = ACTION_MAPPING_GUID; - af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */ - af.dwBufferSize = 32; - - /* This enumeration builds and sets the action map for all devices */ - data.dinput8 = pDI; - hr = IDirectInput8_EnumDevicesBySemantics(pDI, 0, &af, enumeration_callback, &data, DIEDBSFL_ATTACHEDONLY); - ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%#lx\n", hr); - - if (data.keyboard) - IDirectInputDevice_Release(data.keyboard); - - if (data.mouse) - IDirectInputDevice_Release(data.mouse); - - /* Repeat tests with a non NULL user */ - data.username = "Ninja Brian"; - hr = IDirectInput8_EnumDevicesBySemantics(pDI, NULL, &af, enumeration_callback, &data, DIEDBSFL_ATTACHEDONLY); - ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%#lx\n", hr); - - hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", - WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "failed to create window\n"); - SetCursorPos(50, 50); - - if (data.keyboard != NULL) - { - /* Test keyboard BuildActionMap */ - test_build_action_map(data.keyboard, data.lpdiaf, DITEST_KEYBOARDSPACE, DIDFT_PSHBUTTON, DIK_SPACE); - /* Test keyboard input */ - test_device_input(data.keyboard, INPUT_KEYBOARD, DIK_SPACE, 2); - - /* setting format should reset action map */ - hr = IDirectInputDevice8_SetDataFormat(data.keyboard, &c_dfDIKeyboard); - ok (SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %#lx\n", hr); - - test_device_input(data.keyboard, INPUT_KEYBOARD, DIK_SPACE, -1); - - /* back to action map */ - hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0); - ok (SUCCEEDED(hr), "SetActionMap should succeed hr=%#lx\n", hr); - - test_device_input(data.keyboard, INPUT_KEYBOARD, DIK_SPACE, 2); - - test_appdata_property_vs_map(&data); - - /* Test BuildActionMap with no suitable actions for a device */ - IDirectInputDevice_Unacquire(data.keyboard); - af.dwDataSize = 4 * DITEST_KEYBOARDSPACE; - af.dwNumActions = DITEST_KEYBOARDSPACE; - - hr = IDirectInputDevice8_BuildActionMap(data.keyboard, data.lpdiaf, NULL, DIDBAM_HWDEFAULTS); - ok (hr == DI_NOEFFECT, "BuildActionMap should have no effect with no actions hr=%#lx\n", hr); - - hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0); - ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%#lx\n", hr); - - af.dwDataSize = 4 * ARRAY_SIZE(actionMapping); - af.dwNumActions = ARRAY_SIZE(actionMapping); - - /* test DIDSAM_NOUSER */ - dps.diph.dwSize = sizeof(dps); - dps.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dps.diph.dwObj = 0; - dps.diph.dwHow = DIPH_DEVICE; - dps.wsz[0] = '\0'; - - hr = IDirectInputDevice_GetProperty(data.keyboard, DIPROP_USERNAME, &dps.diph); - ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr); - ok (dps.wsz[0] != 0, "Expected any username, got=%s\n", wine_dbgstr_w(dps.wsz)); - - hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, DIDSAM_NOUSER); - ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr); - - dps.diph.dwSize = sizeof(dps); - dps.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dps.diph.dwObj = 0; - dps.diph.dwHow = DIPH_DEVICE; - dps.wsz[0] = '\0'; - - hr = IDirectInputDevice_GetProperty(data.keyboard, DIPROP_USERNAME, &dps.diph); - ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr); - ok (dps.wsz[0] == 0, "Expected empty username, got=%s\n", wine_dbgstr_w(dps.wsz)); - - IDirectInputDevice_Release(data.keyboard); - } - - if (data.mouse != NULL) - { - /* Test mouse BuildActionMap */ - test_build_action_map(data.mouse, data.lpdiaf, DITEST_MOUSEBUTTON0, DIDFT_PSHBUTTON, 0x03); - test_build_action_map(data.mouse, data.lpdiaf, DITEST_YAXIS, DIDFT_RELAXIS, 0x01); - - test_device_input(data.mouse, INPUT_MOUSE, MOUSEEVENTF_LEFTDOWN, 3); - - IDirectInputDevice_Release(data.mouse); - } - - DestroyWindow(hwnd); - IDirectInput_Release(pDI); -} - -static void test_save_settings(void) -{ - HRESULT hr; - IDirectInput8A *pDI = NULL; - DIACTIONFORMATA af; - IDirectInputDevice8A *pKey; - - static const GUID mapping_guid = { 0xcafecafe, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } }; - static const GUID other_guid = { 0xcafe, 0xcafe, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } }; - - static DIACTIONA actions[] = { - { 0, DIKEYBOARD_A , 0, { "Blam" } }, - { 1, DIKEYBOARD_B , 0, { "Kapow"} } - }; - static const DWORD results[] = { - DIDFT_MAKEINSTANCE(DIK_A) | DIDFT_PSHBUTTON, - DIDFT_MAKEINSTANCE(DIK_B) | DIDFT_PSHBUTTON - }; - static const DWORD other_results[] = { - DIDFT_MAKEINSTANCE(DIK_C) | DIDFT_PSHBUTTON, - DIDFT_MAKEINSTANCE(DIK_D) | DIDFT_PSHBUTTON - }; - - hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI); - if (hr == DIERR_OLDDIRECTINPUTVERSION || - hr == DIERR_BETADIRECTINPUTVERSION || - hr == REGDB_E_CLASSNOTREG) - { - win_skip("ActionMapping requires dinput8\n"); - return; - } - ok (SUCCEEDED(hr), "DirectInput8 Create failed: hr=%#lx\n", hr); - if (FAILED(hr)) return; - - hr = IDirectInput8_Initialize(pDI, instance, DIRECTINPUT_VERSION); - if (hr == DIERR_OLDDIRECTINPUTVERSION || hr == DIERR_BETADIRECTINPUTVERSION) - { - win_skip("ActionMapping requires dinput8\n"); - return; - } - ok (SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%#lx\n", hr); - if (FAILED(hr)) return; - - hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKey, NULL); - ok (SUCCEEDED(hr), "IDirectInput_Create device failed hr: 0x%#lx\n", hr); - if (FAILED(hr)) return; - - memset (&af, 0, sizeof(af)); - af.dwSize = sizeof(af); - af.dwActionSize = sizeof(DIACTIONA); - af.dwDataSize = 4 * ARRAY_SIZE(actions); - af.dwNumActions = ARRAY_SIZE(actions); - af.rgoAction = actions; - af.guidActionMap = mapping_guid; - af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */ - af.dwBufferSize = 32; - - /* Easy case. Ask for default mapping, save, ask for previous map and read it back */ - hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, DIDBAM_HWDEFAULTS); - ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr); - ok (results[0] == af.rgoAction[0].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[0], af.rgoAction[0].dwObjID); - - ok (results[1] == af.rgoAction[1].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[1], af.rgoAction[1].dwObjID); - - hr = IDirectInputDevice8_SetActionMap(pKey, &af, NULL, DIDSAM_FORCESAVE); - ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr); - - if (hr == DI_SETTINGSNOTSAVED) - { - skip ("Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n"); - return; - } - - af.rgoAction[0].dwObjID = 0; - af.rgoAction[1].dwObjID = 0; - memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID)); - memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID)); - - hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0); - ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr); - - ok (results[0] == af.rgoAction[0].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[0], af.rgoAction[0].dwObjID); - ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n"); - - ok (results[1] == af.rgoAction[1].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[1], af.rgoAction[1].dwObjID); - ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n"); - - /* Test that a different action map with no pre-stored settings, in spite of the flags, - does not try to load mappings and instead applies the default mapping */ - af.guidActionMap = other_guid; - - af.rgoAction[0].dwObjID = 0; - af.rgoAction[1].dwObjID = 0; - memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID)); - memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID)); - - hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0); - ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr); - - ok (results[0] == af.rgoAction[0].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[0], af.rgoAction[0].dwObjID); - ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n"); - - ok (results[1] == af.rgoAction[1].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[1], af.rgoAction[1].dwObjID); - ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n"); - - af.guidActionMap = mapping_guid; - /* Hard case. Customized mapping, save, ask for previous map and read it back */ - af.rgoAction[0].dwObjID = other_results[0]; - af.rgoAction[0].dwHow = DIAH_USERCONFIG; - af.rgoAction[0].guidInstance = GUID_SysKeyboard; - af.rgoAction[1].dwObjID = other_results[1]; - af.rgoAction[1].dwHow = DIAH_USERCONFIG; - af.rgoAction[1].guidInstance = GUID_SysKeyboard; - - hr = IDirectInputDevice8_SetActionMap(pKey, &af, NULL, DIDSAM_FORCESAVE); - ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr); - - if (hr == DI_SETTINGSNOTSAVED) - { - skip ("Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n"); - return; - } - - af.rgoAction[0].dwObjID = 0; - af.rgoAction[1].dwObjID = 0; - memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID)); - memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID)); - - hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0); - ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr); - - ok (other_results[0] == af.rgoAction[0].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", other_results[0], af.rgoAction[0].dwObjID); - ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n"); - - ok (other_results[1] == af.rgoAction[1].dwObjID, - "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", other_results[1], af.rgoAction[1].dwObjID); - ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n"); - - IDirectInputDevice_Release(pKey); - IDirectInput_Release(pDI); -} - static void test_mouse_keyboard(void) { HRESULT hr; @@ -2724,8 +2209,6 @@ START_TEST(device8) test_sys_keyboard( 0x700 ); test_sys_keyboard( 0x800 );
- test_action_mapping(); - test_save_settings(); test_mouse_keyboard(); test_keyboard_events(); test_appdata_property();
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54594 --- dlls/dinput/tests/device8.c | 48 +++++++++++++++--------------- dlls/dinput/tests/force_feedback.c | 8 ++--- dlls/dinput/tests/joystick8.c | 26 ++++++++-------- 3 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index ddc4af00aff..c50f6e4681a 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -316,12 +316,12 @@ void test_overlapped_format( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
count = 10; @@ -332,7 +332,7 @@ void test_overlapped_format( DWORD version )
/* press D */ keybd_event( 0, DIK_D, KEYEVENTF_SCANCODE, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
count = 10; @@ -352,7 +352,7 @@ void test_overlapped_format( DWORD version )
/* release D */ keybd_event( 0, DIK_D, KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
count = 10; @@ -378,12 +378,12 @@ void test_overlapped_format( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
keybd_event( 0, DIK_F, KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
count = 10; @@ -394,7 +394,7 @@ void test_overlapped_format( DWORD version )
/* press D */ keybd_event( 0, DIK_D, KEYEVENTF_SCANCODE, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
count = 10; @@ -414,7 +414,7 @@ void test_overlapped_format( DWORD version )
/* release D */ keybd_event( 0, DIK_D, KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
count = 10; @@ -458,12 +458,12 @@ static void test_device_input( IDirectInputDevice8A *device, DWORD type, DWORD c if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { keybd_event( 0, code, KEYEVENTF_SCANCODE, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
keybd_event( 0, code, KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res ); } if (type == INPUT_MOUSE) @@ -473,12 +473,12 @@ static void test_device_input( IDirectInputDevice8A *device, DWORD type, DWORD c if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res ); }
@@ -494,21 +494,21 @@ static void test_device_input( IDirectInputDevice8A *device, DWORD type, DWORD c if (type == INPUT_KEYBOARD) { keybd_event( VK_SPACE, DIK_SPACE, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
keybd_event( VK_SPACE, DIK_SPACE, KEYEVENTF_KEYUP, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res ); } if (type == INPUT_MOUSE) { mouse_event( MOUSEEVENTF_LEFTDOWN, 1, 1, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
mouse_event( MOUSEEVENTF_LEFTUP, 1, 1, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res ); } } @@ -1467,7 +1467,7 @@ static void test_sys_mouse( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( !res, "WaitForSingleObject returned %#lx\n", res );
@@ -1477,7 +1477,7 @@ static void test_sys_mouse( DWORD version ) ok( count == 1, "got count %lu\n", count );
mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( !res, "WaitForSingleObject returned %#lx\n", res );
hr = IDirectInputDevice8_Unacquire( device ); @@ -1496,7 +1496,7 @@ static void test_sys_mouse( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( !res, "WaitForSingleObject returned %#lx\n", res );
@@ -1517,14 +1517,14 @@ static void test_sys_mouse( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( !res, "WaitForSingleObject returned %#lx\n", res );
for (i = 0; i < 2; i++) { mouse_event( MOUSEEVENTF_MOVE, 10 + i, 10 + i, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( !res, "WaitForSingleObject returned %#lx\n", res ); }
@@ -1660,7 +1660,7 @@ static void test_dik_codes( IDirectInputDevice8W *device, HANDLE event, HWND hwn if (i == 0 && j == 0 && res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { keybd_event( vkey, scan, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( !res, "WaitForSingleObject returned %#lx\n", res );
@@ -1671,7 +1671,7 @@ static void test_dik_codes( IDirectInputDevice8W *device, HANDLE event, HWND hwn ok( key_state[map[j].dik] == 0x80, "got state %#x\n", key_state[map[j].dik] );
keybd_event( vkey, scan, KEYEVENTF_KEYUP, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( !res, "WaitForSingleObject returned %#lx\n", res );
winetest_pop_context(); @@ -2150,7 +2150,7 @@ static void test_sys_keyboard( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { keybd_event( 'Q', 0, 0, 0 ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( !res, "WaitForSingleObject returned %#lx\n", res );
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index 52afccf6db1..0b7fcb29fa9 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -4175,7 +4175,7 @@ static void test_device_managed_effect(void) res = WaitForSingleObject( event, 100 ); ok( res == WAIT_TIMEOUT, "WaitForSingleObject returned %#lx\n", res ); send_hid_input( file, device_state_input, sizeof(device_state_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
set_hid_expect( file, expect_pool, sizeof(struct hid_expect) ); @@ -4383,7 +4383,7 @@ static void test_device_managed_effect(void) set_hid_expect( file, NULL, 0 );
send_hid_input( file, device_state_input_0, sizeof(device_state_input_0) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res ); set_hid_expect( file, expect_pool, sizeof(struct hid_expect) ); res = 0xdeadbeef; @@ -4394,7 +4394,7 @@ static void test_device_managed_effect(void) set_hid_expect( file, NULL, 0 );
send_hid_input( file, device_state_input_1, sizeof(device_state_input_1) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res ); res = 0xdeadbeef; hr = IDirectInputEffect_GetEffectStatus( effect, &res ); @@ -4409,7 +4409,7 @@ static void test_device_managed_effect(void) set_hid_expect( file, NULL, 0 );
send_hid_input( file, device_state_input_2, sizeof(device_state_input_2) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res ); res = 0xdeadbeef; hr = IDirectInputEffect_GetEffectStatus( effect, &res ); diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index be2fbf3b90a..27a3ca5be07 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -2184,7 +2184,7 @@ static void test_simple_joystick( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { send_hid_input( file, &injected_input[0], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event ); @@ -2215,7 +2215,7 @@ static void test_simple_joystick( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { send_hid_input( file, &injected_input[1], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event ); @@ -2242,11 +2242,11 @@ static void test_simple_joystick( DWORD version ) }
send_hid_input( file, &injected_input[2], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event ); send_hid_input( file, &injected_input[4], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event );
@@ -2277,7 +2277,7 @@ static void test_simple_joystick( DWORD version ) }
send_hid_input( file, &injected_input[3], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event );
@@ -2424,7 +2424,7 @@ static void test_simple_joystick( DWORD version ) ResetEvent( event );
send_hid_input( file, &injected_input[3], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event );
@@ -2450,13 +2450,13 @@ static void test_simple_joystick( DWORD version ) if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */ { send_hid_input( file, &injected_input[4], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); } ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event );
send_hid_input( file, &injected_input[3], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); ResetEvent( event );
@@ -2720,7 +2720,7 @@ static void test_simple_joystick( DWORD version ) ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
send_hid_input( file, &injected_input[ARRAY_SIZE(injected_input) - 1], sizeof(*injected_input) ); - res = WaitForSingleObject( event, 100 ); + res = WaitForSingleObject( event, 5000 ); ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" );
hr = IDirectInputDevice8_Unacquire( device ); @@ -4521,8 +4521,8 @@ static BOOL test_winmm_joystick(void) ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
send_hid_input( file, &injected_input[0], sizeof(struct hid_expect) ); - ret = WaitForSingleObject( event, 100 ); - ok( ret != WAIT_TIMEOUT, "WaitForSingleObject returned %#x\n", ret ); + ret = WaitForSingleObject( event, 5000 ); + ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", ret ); Sleep( 50 ); /* leave some time for winmm to keep up */
memset( &infoex, 0xcd, sizeof(infoex) ); @@ -4543,8 +4543,8 @@ static BOOL test_winmm_joystick(void) check_member( infoex, expect_infoex[1], "%#lx", dwPOV );
send_hid_input( file, &injected_input[1], sizeof(struct hid_expect) ); - ret = WaitForSingleObject( event, 100 ); - ok( ret != WAIT_TIMEOUT, "WaitForSingleObject returned %#x\n", ret ); + ret = WaitForSingleObject( event, 5000 ); + ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", ret ); Sleep( 50 ); /* leave some time for winmm to keep up */
memset( &infoex, 0xcd, sizeof(infoex) );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=130716
Your paranoid android.
=== w7u_el (32 bit report) ===
dinput: device8.c:684: Test failed: IDirectInputDevice8_Acquire failed: 0x80070005 device8.c:686: Test failed: IDirectInputDevice8_Acquire failed: 0x80070005 device8.c:690: Test failed: GetRegisteredRawInputDevices returned 1, raw_devices_count: 3 device8.c:691: Test failed: Unexpected raw device flags: 0 device8.c:692: Test failed: Unexpected raw device flags: 0
=== w8 (32 bit report) ===
dinput: joystick8.c:1144: Test failed: 0x800: 3: got dwData 0xffffffd3
=== debian11 (32 bit report) ===
adsldp: ldap: Timeout