Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index ce2a3792593..533c4a8ca42 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4593,7 +4593,7 @@ struct device_desc HIDP_CAPS hid_caps; };
-static void test_device_types( void ) +static BOOL test_device_types(void) { #include "psh_hid_macros.h" static const unsigned char unknown_desc[] = @@ -4837,11 +4837,12 @@ static void test_device_types( void ) DIDEVCAPS caps = {.dwSize = sizeof(DIDEVCAPS)}; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; IDirectInputDevice8W *device; + BOOL success = TRUE; IDirectInput8W *di; ULONG i, ref; HRESULT hr;
- for (i = 0; i < ARRAY_SIZE(device_desc); ++i) + for (i = 0; i < ARRAY_SIZE(device_desc) && success; ++i) { winetest_push_context( "desc[%d]", i ); GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd ); @@ -4852,7 +4853,7 @@ static void test_device_types( void ) if (!dinput_driver_start( device_desc[i].report_desc_buf, device_desc[i].report_desc_len, &device_desc[i].hid_caps )) { - i = ARRAY_SIZE(device_desc); + success = FALSE; goto done; }
@@ -4860,7 +4861,7 @@ static void test_device_types( void ) if (FAILED(hr)) { win_skip( "DirectInput8Create returned %#x\n", hr ); - i = ARRAY_SIZE(device_desc); + success = FALSE; goto done; }
@@ -4870,7 +4871,7 @@ static void test_device_types( void ) { win_skip( "device not found, skipping tests\n" ); IDirectInput8_Release( di ); - i = ARRAY_SIZE(device_desc); + success = FALSE; goto done; }
@@ -4918,6 +4919,8 @@ static void test_device_types( void ) SetCurrentDirectoryW( cwd ); winetest_pop_context(); } + + return success; }
static void test_force_feedback_joystick( void ) @@ -5345,9 +5348,11 @@ START_TEST( hid ) test_hid_driver( 1, TRUE );
CoInitialize( NULL ); - test_device_types(); - test_simple_joystick(); - test_force_feedback_joystick(); + if (test_device_types()) + { + test_simple_joystick(); + test_force_feedback_joystick(); + } CoUninitialize();
UnmapViewOfFile( test_data );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 81 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 533c4a8ca42..c8d0588e128 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3343,6 +3343,44 @@ static BOOL CALLBACK check_object_count( const DIDEVICEOBJECTINSTANCEW *obj, voi return DIENUM_CONTINUE; }
+struct check_effects_params +{ + UINT index; + UINT expect_count; + const DIEFFECTINFOW *expect_effects; +}; + +static BOOL CALLBACK check_effects( const DIEFFECTINFOW *effect, void *args ) +{ + static const DIEFFECTINFOW unexpected_effect = {0}; + struct check_effects_params *params = args; + const DIEFFECTINFOW *exp = params->expect_effects + params->index; + + winetest_push_context( "effect[%d]", params->index ); + + ok( params->index < params->expect_count, "unexpected extra object\n" ); + if (params->index >= params->expect_count) exp = &unexpected_effect; + + check_member( *effect, *exp, "%u", dwSize ); + check_member_guid( *effect, *exp, guid ); + check_member( *effect, *exp, "%#x", dwEffType ); + check_member( *effect, *exp, "%#x", dwStaticParams ); + check_member( *effect, *exp, "%#x", dwDynamicParams ); + check_member_wstr( *effect, *exp, tszName ); + + winetest_pop_context(); + params->index++; + + return DIENUM_CONTINUE; +} + +static BOOL CALLBACK check_effect_count( const DIEFFECTINFOW *effect, void *args ) +{ + DWORD *count = args; + *count = *count + 1; + return DIENUM_CONTINUE; +} + static void test_simple_joystick(void) { #include "psh_hid_macros.h" @@ -3580,6 +3618,7 @@ static void test_simple_joystick(void) }, }; const struct check_objects_todos objects_todos[ARRAY_SIZE(expect_objects)] = {}; + const DIEFFECTINFOW expect_effects[] = {};
struct check_objects_params check_objects_params = { @@ -3587,6 +3626,11 @@ static void test_simple_joystick(void) .expect_objs = expect_objects, .todo_objs = objects_todos, }; + struct check_effects_params check_effects_params = + { + .expect_count = ARRAY_SIZE(expect_effects), + .expect_effects = expect_effects, + }; DIPROPGUIDANDPATH prop_guid_path = { .diph = @@ -3989,6 +4033,22 @@ static void test_simple_joystick(void) check_member( objinst, expect_objects[5], "%#04x", wExponent ); check_member( objinst, expect_objects[5], "%u", wReportId );
+ hr = IDirectInputDevice8_EnumEffects( device, NULL, NULL, DIEFT_ALL ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + res = 0; + hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, 0xfe ); + ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + ok( res == 0, "got %u expected %u\n", res, 0 ); + res = 0; + hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, DIEFT_PERIODIC ); + ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + ok( res == 0, "got %u expected %u\n", res, 0 ); + hr = IDirectInputDevice8_EnumEffects( device, check_effects, &check_effects_params, DIEFT_ALL ); + ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + ok( check_effects_params.index >= check_effects_params.expect_count, "missing %u effects\n", + check_effects_params.expect_count - check_effects_params.index ); + hr = IDirectInputDevice8_SetDataFormat( device, NULL ); ok( hr == E_POINTER, "IDirectInputDevice8_SetDataFormat returned: %#x\n", hr ); hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); @@ -5192,6 +5252,7 @@ static void test_force_feedback_joystick( void ) {.type = TRUE, .flags = TRUE}, {.type = TRUE, .flags = TRUE}, }; + const DIEFFECTINFOW expect_effects[] = {};
struct check_objects_params check_objects_params = { @@ -5199,6 +5260,11 @@ static void test_force_feedback_joystick( void ) .expect_objs = expect_objects, .todo_objs = objects_todos, }; + struct check_effects_params check_effects_params = + { + .expect_count = ARRAY_SIZE(expect_effects), + .expect_effects = expect_effects, + }; DIPROPDWORD prop_dword = { .diph = @@ -5213,8 +5279,8 @@ static void test_force_feedback_joystick( void ) IDirectInputDevice8W *device; DIDEVCAPS caps = {0}; IDirectInput8W *di; + ULONG res, ref; HRESULT hr; - ULONG ref;
GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd ); GetTempPathW( ARRAY_SIZE(tempdir), tempdir ); @@ -5293,6 +5359,19 @@ static void test_force_feedback_joystick( void ) ok( check_objects_params.index >= check_objects_params.expect_count, "missing %u objects\n", check_objects_params.expect_count - check_objects_params.index );
+ res = 0; + hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, 0xfe ); + ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + ok( res == 0, "got %u expected %u\n", res, 0 ); + res = 0; + hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, DIEFT_PERIODIC ); + ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + ok( res == 0, "got %u expected %u\n", res, 0 ); + hr = IDirectInputDevice8_EnumEffects( device, check_effects, &check_effects_params, DIEFT_ALL ); + ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + ok( check_effects_params.index >= check_effects_params.expect_count, "missing %u effects\n", + check_effects_params.expect_count - check_effects_params.index ); + hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 ); ok( hr == DI_OK, "IDirectInputDevice8_SetDataFormat returned: %#x\n", hr );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 184 ++++++++++++++++++++++++++++++++++----- 1 file changed, 163 insertions(+), 21 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index c8d0588e128..cf47216cd9e 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5018,6 +5018,12 @@ static void test_force_feedback_joystick( void ) INPUT(1, Cnst|Var|Abs), END_COLLECTION,
+ USAGE_PAGE(1, HID_USAGE_PAGE_PID), + USAGE(1, PID_USAGE_STATE_REPORT), + COLLECTION(1, Report), + REPORT_ID(1, 2), + END_COLLECTION, + USAGE_PAGE(1, HID_USAGE_PAGE_PID), USAGE(1, PID_USAGE_DEVICE_CONTROL_REPORT), COLLECTION(1, Report), @@ -5060,6 +5066,49 @@ static void test_force_feedback_joystick( void ) REPORT_COUNT(1, 1), OUTPUT(1, Data|Var|Abs), END_COLLECTION, + + USAGE(1, PID_USAGE_SET_EFFECT_REPORT), + COLLECTION(1, Report), + REPORT_ID(1, 3), + + USAGE(1, PID_USAGE_EFFECT_BLOCK_INDEX), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 0x7f), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 0x7f), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + + USAGE(1, PID_USAGE_EFFECT_TYPE), + COLLECTION(1, NamedArray), + USAGE(1, PID_USAGE_ET_SINE), + LOGICAL_MINIMUM(1, 1), + LOGICAL_MAXIMUM(1, 1), + PHYSICAL_MINIMUM(1, 1), + PHYSICAL_MAXIMUM(1, 1), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Ary|Abs), + END_COLLECTION, + + USAGE(1, PID_USAGE_AXES_ENABLE), + COLLECTION(1, Logical), + USAGE(4, (HID_USAGE_PAGE_GENERIC << 16)|HID_USAGE_GENERIC_X), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 1), + REPORT_SIZE(1, 1), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + END_COLLECTION, + USAGE(1, PID_USAGE_DIRECTION_ENABLE), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + REPORT_COUNT(1, 6), + OUTPUT(1, Cnst|Var|Abs), + END_COLLECTION, END_COLLECTION, }; #undef REPORT_ID_OR_USAGE_PAGE @@ -5072,7 +5121,7 @@ static void test_force_feedback_joystick( void ) static const DIDEVCAPS expect_caps = { .dwSize = sizeof(DIDEVCAPS), - .dwFlags = DIDC_ATTACHED | DIDC_EMULATED, + .dwFlags = DIDC_FORCEFEEDBACK | DIDC_ATTACHED | DIDC_EMULATED, .dwDevType = DIDEVTYPE_HID | (DI8DEVTYPEJOYSTICK_LIMITED << 8) | DI8DEVTYPE_JOYSTICK, .dwAxes = 2, .dwButtons = 2, @@ -5111,8 +5160,8 @@ static void test_force_feedback_joystick( void ) .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_XAxis, .dwOfs = 0x4, - .dwType = DIDFT_ABSAXIS|DIDFT_MAKEINSTANCE(0), - .dwFlags = DIDOI_ASPECTPOSITION, + .dwType = DIDFT_ABSAXIS|DIDFT_MAKEINSTANCE(0)|DIDFT_FFACTUATOR, + .dwFlags = DIDOI_ASPECTPOSITION|DIDOI_FFACTUATOR, .tszName = L"X Axis", .wCollectionNumber = 1, .wUsagePage = HID_USAGE_PAGE_GENERIC, @@ -5122,7 +5171,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = 0x10, + .dwOfs = 0x14, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(0)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 0", @@ -5134,7 +5183,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = 0x11, + .dwOfs = 0x15, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(1)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 1", @@ -5150,7 +5199,7 @@ static void test_force_feedback_joystick( void ) .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(4)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Effect Block Index", - .wCollectionNumber = 3, + .wCollectionNumber = 4, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_EFFECT_BLOCK_INDEX, .wReportId = 2, @@ -5158,11 +5207,11 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x12, + .dwOfs = 0x16, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(5)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start", - .wCollectionNumber = 4, + .wCollectionNumber = 5, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_OP_EFFECT_START, .wReportId = 2, @@ -5170,11 +5219,11 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x13, + .dwOfs = 0x17, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(6)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start Solo", - .wCollectionNumber = 4, + .wCollectionNumber = 5, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_OP_EFFECT_START_SOLO, .wReportId = 2, @@ -5182,11 +5231,11 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x14, + .dwOfs = 0x18, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(7)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Stop", - .wCollectionNumber = 4, + .wCollectionNumber = 5, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_OP_EFFECT_STOP, .wReportId = 2, @@ -5198,11 +5247,59 @@ static void test_force_feedback_joystick( void ) .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(8)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Loop Count", - .wCollectionNumber = 3, + .wCollectionNumber = 4, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_LOOP_COUNT, .wReportId = 2, }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwOfs = 0x10, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(9)|DIDFT_OUTPUT, + .dwFlags = 0x80008000, + .tszName = L"Effect Block Index", + .wCollectionNumber = 6, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_EFFECT_BLOCK_INDEX, + .wReportId = 3, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwOfs = 0x19, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(10)|DIDFT_OUTPUT, + .dwFlags = 0x80008000, + .tszName = L"ET Sine", + .wCollectionNumber = 7, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_ET_SINE, + .wReportId = 3, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwOfs = 0x1a, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(11)|DIDFT_OUTPUT, + .dwFlags = 0x80008000, + .tszName = L"X Axis", + .wCollectionNumber = 8, + .wUsagePage = HID_USAGE_PAGE_GENERIC, + .wUsage = HID_USAGE_GENERIC_X, + .wReportId = 3, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwOfs = 0x1b, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(12)|DIDFT_OUTPUT, + .dwFlags = 0x80008000, + .tszName = L"Direction Enable", + .wCollectionNumber = 6, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_DIRECTION_ENABLE, + .wReportId = 3, + }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, @@ -5223,36 +5320,79 @@ static void test_force_feedback_joystick( void ) .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(2), - .tszName = L"Collection 2 - PID Device Control Report", + .tszName = L"Collection 2 - PID State Report", .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_DEVICE_CONTROL_REPORT, + .wUsage = PID_USAGE_STATE_REPORT, }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(3), - .tszName = L"Collection 3 - Effect Operation Report", + .tszName = L"Collection 3 - PID Device Control Report", .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_EFFECT_OPERATION_REPORT, + .wUsage = PID_USAGE_DEVICE_CONTROL_REPORT, }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(4), - .tszName = L"Collection 4 - Effect Operation", - .wCollectionNumber = 3, + .tszName = L"Collection 4 - Effect Operation Report", + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_EFFECT_OPERATION_REPORT, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(5), + .tszName = L"Collection 5 - Effect Operation", + .wCollectionNumber = 4, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_EFFECT_OPERATION, }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(6), + .tszName = L"Collection 6 - Set Effect Report", + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_SET_EFFECT_REPORT, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(7), + .tszName = L"Collection 7 - Effect Type", + .wCollectionNumber = 6, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_EFFECT_TYPE, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(8), + .tszName = L"Collection 8 - Axes Enable", + .wCollectionNumber = 6, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_AXES_ENABLE, + }, }; const struct check_objects_todos objects_todos[ARRAY_SIZE(expect_objects)] = { {}, - {}, + {.type = TRUE, .flags = TRUE}, {.type = TRUE, .flags = TRUE}, {.type = TRUE, .flags = TRUE}, }; - const DIEFFECTINFOW expect_effects[] = {}; + const DIEFFECTINFOW expect_effects[] = + { + { + .dwSize = sizeof(DIEFFECTINFOW), + .guid = GUID_Sine, + .dwStaticParams = DIEP_AXES | DIEP_TYPESPECIFICPARAMS, + .dwDynamicParams = DIEP_AXES | DIEP_TYPESPECIFICPARAMS, + .tszName = L"GUID_Sine", + } + };
struct check_objects_params check_objects_params = { @@ -5328,6 +5468,7 @@ static void test_force_feedback_joystick( void ) hr = IDirectInputDevice8_GetCapabilities( device, &caps ); ok( hr == DI_OK, "IDirectInputDevice8_GetCapabilities returned %#x\n", hr ); check_member( caps, expect_caps, "%d", dwSize ); + todo_wine check_member( caps, expect_caps, "%#x", dwFlags ); check_member( caps, expect_caps, "%#x", dwDevType ); check_member( caps, expect_caps, "%d", dwAxes ); @@ -5369,6 +5510,7 @@ static void test_force_feedback_joystick( void ) ok( res == 0, "got %u expected %u\n", res, 0 ); hr = IDirectInputDevice8_EnumEffects( device, check_effects, &check_effects_params, DIEFT_ALL ); ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); + todo_wine ok( check_effects_params.index >= check_effects_params.expect_count, "missing %u effects\n", check_effects_params.expect_count - check_effects_params.index );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index cf47216cd9e..149790f1484 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3679,6 +3679,7 @@ static void test_simple_joystick(void) DIDEVICEOBJECTDATA objdata[32] = {{0}}; DIDEVICEOBJECTINSTANCEW objinst = {0}; DIDEVICEINSTANCEW devinst = {0}; + DIEFFECTINFOW effectinfo = {0}; DIDATAFORMAT dataformat = {0}; IDirectInputDevice8W *device; DIDEVCAPS caps = {0}; @@ -4049,6 +4050,21 @@ static void test_simple_joystick(void) ok( check_effects_params.index >= check_effects_params.expect_count, "missing %u effects\n", check_effects_params.expect_count - check_effects_params.index );
+ hr = IDirectInputDevice8_GetEffectInfo( device, NULL, &GUID_Sine ); + todo_wine + ok( hr == E_POINTER, "IDirectInputDevice8_GetEffectInfo returned %#x\n", hr ); + effectinfo.dwSize = sizeof(DIEFFECTINFOW) + 1; + hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_Sine ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetEffectInfo returned %#x\n", hr ); + effectinfo.dwSize = sizeof(DIEFFECTINFOW); + hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_NULL ); + todo_wine + ok( hr == DIERR_DEVICENOTREG, "IDirectInputDevice8_GetEffectInfo returned %#x\n", hr ); + hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_Sine ); + todo_wine + ok( hr == DIERR_DEVICENOTREG, "IDirectInputDevice8_GetEffectInfo returned %#x\n", hr ); + hr = IDirectInputDevice8_SetDataFormat( device, NULL ); ok( hr == E_POINTER, "IDirectInputDevice8_SetDataFormat returned: %#x\n", hr ); hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); @@ -5416,6 +5432,7 @@ static void test_force_feedback_joystick( void ) }; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; DIDEVICEINSTANCEW devinst = {0}; + DIEFFECTINFOW effectinfo = {0}; IDirectInputDevice8W *device; DIDEVCAPS caps = {0}; IDirectInput8W *di; @@ -5514,6 +5531,19 @@ static void test_force_feedback_joystick( void ) ok( check_effects_params.index >= check_effects_params.expect_count, "missing %u effects\n", check_effects_params.expect_count - check_effects_params.index );
+ effectinfo.dwSize = sizeof(DIEFFECTINFOW); + hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_Sine ); + ok( hr == DI_OK, "IDirectInputDevice8_GetEffectInfo returned %#x\n", hr ); + todo_wine + check_member_guid( effectinfo, expect_effects[0], guid ); + check_member( effectinfo, expect_effects[0], "%#x", dwEffType ); + todo_wine + check_member( effectinfo, expect_effects[0], "%#x", dwStaticParams ); + todo_wine + check_member( effectinfo, expect_effects[0], "%#x", dwDynamicParams ); + todo_wine + check_member_wstr( effectinfo, expect_effects[0], tszName ); + hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 ); ok( hr == DI_OK, "IDirectInputDevice8_SetDataFormat returned: %#x\n", hr );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/driver_hid.c | 15 ++- dlls/dinput8/tests/driver_hid.h | 1 + dlls/dinput8/tests/hid.c | 184 +++++++++++++++++++++++++------- 3 files changed, 163 insertions(+), 37 deletions(-)
diff --git a/dlls/dinput8/tests/driver_hid.c b/dlls/dinput8/tests/driver_hid.c index f484710e498..4c6273ff56a 100644 --- a/dlls/dinput8/tests/driver_hid.c +++ b/dlls/dinput8/tests/driver_hid.c @@ -96,9 +96,15 @@ static void expect_queue_reset( struct expect_queue *queue, void *buffer, unsign { winetest_push_context( "%s expect[%d]", tmp->context, tmp - missing ); if (tmp->broken) + { + todo_wine_if( tmp->todo ) win_skip( "broken (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len ); + } else + { + todo_wine_if( tmp->todo ) ok( 0, "missing (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len ); + } winetest_pop_context(); tmp++; } @@ -123,7 +129,8 @@ static void expect_queue_next( struct expect_queue *queue, ULONG code, HID_XFER_ tmp = queue->pos; while (tmp < queue->end) { - if (!tmp->broken || running_under_wine) break; + if (running_under_wine && !tmp->todo) break; + if (!running_under_wine && !tmp->broken) break; if (tmp->code == code && tmp->report_id == id && tmp->report_len == len && (!compare_buf || RtlCompareMemory( tmp->report_buf, buf, len ) == len)) break; @@ -142,9 +149,15 @@ static void expect_queue_next( struct expect_queue *queue, ULONG code, HID_XFER_ { winetest_push_context( "%s expect[%d]", tmp->context, tmp - missing ); if (tmp->broken) + { + todo_wine_if( tmp->todo ) win_skip( "broken (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len ); + } else + { + todo_wine_if( tmp->todo ) ok( 0, "missing (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len ); + } winetest_pop_context(); tmp++; } diff --git a/dlls/dinput8/tests/driver_hid.h b/dlls/dinput8/tests/driver_hid.h index 538d6205ab9..f41de44b87a 100644 --- a/dlls/dinput8/tests/driver_hid.h +++ b/dlls/dinput8/tests/driver_hid.h @@ -47,6 +47,7 @@ struct hid_expect DWORD code; DWORD ret_length; DWORD ret_status; + BYTE todo; /* missing on wine */ BYTE broken; /* missing on some win versions */ BYTE report_id; BYTE report_len; diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 149790f1484..1ec5726d34b 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5044,6 +5044,18 @@ static void test_force_feedback_joystick( void ) USAGE(1, PID_USAGE_DEVICE_CONTROL_REPORT), COLLECTION(1, Report), REPORT_ID(1, 1), + + USAGE(1, PID_USAGE_DEVICE_CONTROL), + COLLECTION(1, Logical), + USAGE(1, PID_USAGE_DC_DEVICE_RESET), + LOGICAL_MINIMUM(1, 1), + LOGICAL_MAXIMUM(1, 2), + PHYSICAL_MINIMUM(1, 1), + PHYSICAL_MAXIMUM(1, 2), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Ary|Abs), + END_COLLECTION, END_COLLECTION,
USAGE(1, PID_USAGE_EFFECT_OPERATION_REPORT), @@ -5146,6 +5158,14 @@ static void test_force_feedback_joystick( void ) .dwHardwareRevision = 1, .dwFFDriverVersion = 1, }; + struct hid_expect expect_dc_reset = + { + .code = IOCTL_HID_WRITE_REPORT, + .todo = TRUE, + .report_id = 1, + .report_len = 2, + .report_buf = {1, 0x01}, + };
const DIDEVICEINSTANCEW expect_devinst = { @@ -5211,25 +5231,25 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x8, + .dwOfs = 0x16, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(4)|DIDFT_OUTPUT, .dwFlags = 0x80008000, - .tszName = L"Effect Block Index", + .tszName = L"DC Device Reset", .wCollectionNumber = 4, .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_EFFECT_BLOCK_INDEX, - .wReportId = 2, + .wUsage = PID_USAGE_DC_DEVICE_RESET, + .wReportId = 1, }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x16, + .dwOfs = 0x8, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(5)|DIDFT_OUTPUT, .dwFlags = 0x80008000, - .tszName = L"Op Effect Start", + .tszName = L"Effect Block Index", .wCollectionNumber = 5, .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_OP_EFFECT_START, + .wUsage = PID_USAGE_EFFECT_BLOCK_INDEX, .wReportId = 2, }, { @@ -5238,10 +5258,10 @@ static void test_force_feedback_joystick( void ) .dwOfs = 0x17, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(6)|DIDFT_OUTPUT, .dwFlags = 0x80008000, - .tszName = L"Op Effect Start Solo", - .wCollectionNumber = 5, + .tszName = L"Op Effect Start", + .wCollectionNumber = 6, .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_OP_EFFECT_START_SOLO, + .wUsage = PID_USAGE_OP_EFFECT_START, .wReportId = 2, }, { @@ -5250,8 +5270,20 @@ static void test_force_feedback_joystick( void ) .dwOfs = 0x18, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(7)|DIDFT_OUTPUT, .dwFlags = 0x80008000, + .tszName = L"Op Effect Start Solo", + .wCollectionNumber = 6, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_OP_EFFECT_START_SOLO, + .wReportId = 2, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwOfs = 0x19, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(8)|DIDFT_OUTPUT, + .dwFlags = 0x80008000, .tszName = L"Op Effect Stop", - .wCollectionNumber = 5, + .wCollectionNumber = 6, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_OP_EFFECT_STOP, .wReportId = 2, @@ -5260,10 +5292,10 @@ static void test_force_feedback_joystick( void ) .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwOfs = 0xc, - .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(8)|DIDFT_OUTPUT, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(9)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Loop Count", - .wCollectionNumber = 4, + .wCollectionNumber = 5, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_LOOP_COUNT, .wReportId = 2, @@ -5272,10 +5304,10 @@ static void test_force_feedback_joystick( void ) .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwOfs = 0x10, - .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(9)|DIDFT_OUTPUT, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(10)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Effect Block Index", - .wCollectionNumber = 6, + .wCollectionNumber = 7, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_EFFECT_BLOCK_INDEX, .wReportId = 3, @@ -5283,11 +5315,11 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x19, - .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(10)|DIDFT_OUTPUT, + .dwOfs = 0x1a, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(11)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Sine", - .wCollectionNumber = 7, + .wCollectionNumber = 8, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_ET_SINE, .wReportId = 3, @@ -5295,11 +5327,11 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x1a, - .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(11)|DIDFT_OUTPUT, + .dwOfs = 0x1b, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(12)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"X Axis", - .wCollectionNumber = 8, + .wCollectionNumber = 9, .wUsagePage = HID_USAGE_PAGE_GENERIC, .wUsage = HID_USAGE_GENERIC_X, .wReportId = 3, @@ -5307,11 +5339,11 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x1b, - .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(12)|DIDFT_OUTPUT, + .dwOfs = 0x1c, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(13)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Direction Enable", - .wCollectionNumber = 6, + .wCollectionNumber = 7, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_DIRECTION_ENABLE, .wReportId = 3, @@ -5352,42 +5384,51 @@ static void test_force_feedback_joystick( void ) .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(4), - .tszName = L"Collection 4 - Effect Operation Report", + .tszName = L"Collection 4 - PID Device Control", + .wCollectionNumber = 3, .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_EFFECT_OPERATION_REPORT, + .wUsage = PID_USAGE_DEVICE_CONTROL, }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(5), - .tszName = L"Collection 5 - Effect Operation", - .wCollectionNumber = 4, + .tszName = L"Collection 5 - Effect Operation Report", .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_EFFECT_OPERATION, + .wUsage = PID_USAGE_EFFECT_OPERATION_REPORT, }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(6), - .tszName = L"Collection 6 - Set Effect Report", + .tszName = L"Collection 6 - Effect Operation", + .wCollectionNumber = 5, .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_SET_EFFECT_REPORT, + .wUsage = PID_USAGE_EFFECT_OPERATION, }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(7), - .tszName = L"Collection 7 - Effect Type", - .wCollectionNumber = 6, + .tszName = L"Collection 7 - Set Effect Report", .wUsagePage = HID_USAGE_PAGE_PID, - .wUsage = PID_USAGE_EFFECT_TYPE, + .wUsage = PID_USAGE_SET_EFFECT_REPORT, }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(8), - .tszName = L"Collection 8 - Axes Enable", - .wCollectionNumber = 6, + .tszName = L"Collection 8 - Effect Type", + .wCollectionNumber = 7, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_EFFECT_TYPE, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(9), + .tszName = L"Collection 9 - Axes Enable", + .wCollectionNumber = 7, .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_AXES_ENABLE, }, @@ -5430,6 +5471,15 @@ static void test_force_feedback_joystick( void ) .dwHow = DIPH_DEVICE, }, }; + DIPROPGUIDANDPATH prop_guid_path = + { + .diph = + { + .dwSize = sizeof(DIPROPGUIDANDPATH), + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwHow = DIPH_DEVICE, + }, + }; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; DIDEVICEINSTANCEW devinst = {0}; DIEFFECTINFOW effectinfo = {0}; @@ -5437,7 +5487,9 @@ static void test_force_feedback_joystick( void ) DIDEVCAPS caps = {0}; IDirectInput8W *di; ULONG res, ref; + HANDLE file; HRESULT hr; + HWND hwnd;
GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd ); GetTempPathW( ARRAY_SIZE(tempdir), tempdir ); @@ -5547,9 +5599,69 @@ static void test_force_feedback_joystick( void ) hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 ); ok( hr == DI_OK, "IDirectInputDevice8_SetDataFormat returned: %#x\n", hr );
+ hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph ); + ok( hr == DI_OK, "IDirectInputDevice8_GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr ); + + file = CreateFileW( prop_guid_path.wszPath, FILE_READ_ACCESS | FILE_WRITE_ACCESS, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL ); + ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() ); + + hwnd = CreateWindowW( L"static", L"dinput", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 200, 200, + NULL, NULL, NULL, NULL ); + + hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, 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 ); + + prop_dword.diph.dwHow = DIPH_DEVICE; + prop_dword.diph.dwObj = 0; + prop_dword.dwData = 0xdeadbeef; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + prop_dword.dwData = 1000; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + todo_wine + ok( hr == DI_OK, "IDirectInputDevice8_SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + + prop_dword.dwData = 0xdeadbeef; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); + ok( hr == DIERR_READONLY, "IDirectInputDevice8_SetProperty DIPROP_FFLOAD returned %#x\n", hr ); + hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); + todo_wine + ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "IDirectInputDevice8_GetProperty DIPROP_FFLOAD returned %#x\n", hr ); + + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr ); + hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE ); + ok( hr == DI_OK, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr ); + + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + hr = IDirectInputDevice8_Acquire( device ); + ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr ); + set_hid_expect( file, NULL, 0 ); + + prop_dword.dwData = 0xdeadbeef; + hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); + todo_wine + ok( hr == 0x80040301, "IDirectInputDevice8_GetProperty DIPROP_FFLOAD returned %#x\n", hr ); + + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr ); + set_hid_expect( file, NULL, 0 ); + + /* 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 );
+ DestroyWindow( hwnd ); + CloseHandle( file ); + ref = IDirectInput8_Release( di ); ok( ref == 0, "IDirectInput8_Release returned %d\n", ref );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 1ec5726d34b..080f2c944ca 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3682,9 +3682,11 @@ static void test_simple_joystick(void) DIEFFECTINFOW effectinfo = {0}; DIDATAFORMAT dataformat = {0}; IDirectInputDevice8W *device; + DIEFFESCAPE escape = {0}; DIDEVCAPS caps = {0}; IDirectInput8W *di; HANDLE event, file; + char buffer[1024]; DIJOYSTATE2 state; ULONG i, res, ref; HRESULT hr; @@ -4644,6 +4646,26 @@ static void test_simple_joystick(void) hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
+ hr = IDirectInputDevice8_Escape( device, NULL ); + todo_wine + ok( hr == E_POINTER, "IDirectInputDevice8_Escape returned: %#x\n", hr ); + hr = IDirectInputDevice8_Escape( device, &escape ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_Escape returned: %#x\n", hr ); + escape.dwSize = sizeof(DIEFFESCAPE) + 1; + hr = IDirectInputDevice8_Escape( device, &escape ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_Escape returned: %#x\n", hr ); + escape.dwSize = sizeof(DIEFFESCAPE); + escape.dwCommand = 0; + escape.lpvInBuffer = buffer; + escape.cbInBuffer = 10; + escape.lpvOutBuffer = buffer + 10; + escape.cbOutBuffer = 10; + hr = IDirectInputDevice8_Escape( device, &escape ); + todo_wine + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_Escape returned: %#x\n", hr ); + /* FIXME: we have to wait a bit because Wine DInput internal thread keeps a reference */ Sleep( 100 );
@@ -5484,8 +5506,10 @@ static void test_force_feedback_joystick( void ) DIDEVICEINSTANCEW devinst = {0}; DIEFFECTINFOW effectinfo = {0}; IDirectInputDevice8W *device; + DIEFFESCAPE escape = {0}; DIDEVCAPS caps = {0}; IDirectInput8W *di; + char buffer[1024]; ULONG res, ref; HANDLE file; HRESULT hr; @@ -5633,6 +5657,16 @@ static void test_force_feedback_joystick( void ) todo_wine ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "IDirectInputDevice8_GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+ escape.dwSize = sizeof(DIEFFESCAPE); + escape.dwCommand = 0; + escape.lpvInBuffer = buffer; + escape.cbInBuffer = 10; + escape.lpvOutBuffer = buffer + 10; + escape.cbOutBuffer = 10; + hr = IDirectInputDevice8_Escape( device, &escape ); + todo_wine + ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "IDirectInputDevice8_Escape returned: %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr ); hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE ); @@ -5643,6 +5677,10 @@ static void test_force_feedback_joystick( void ) ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 );
+ hr = IDirectInputDevice8_Escape( device, &escape ); + todo_wine + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_Escape returned: %#x\n", hr ); + prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); todo_wine
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 080f2c944ca..918db40d444 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4643,6 +4643,14 @@ static void test_simple_joystick(void) check_member( state, expect_state_rel[i], "%#x", rgbButtons[2] ); winetest_pop_context();
+ hr = IDirectInputDevice8_GetForceFeedbackState( device, NULL ); + todo_wine + ok( hr == E_POINTER, "IDirectInputDevice8_GetForceFeedbackState returned %#x\n", hr ); + res = 0xdeadbeef; + hr = IDirectInputDevice8_GetForceFeedbackState( device, &res ); + todo_wine + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetForceFeedbackState returned %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
@@ -5656,6 +5664,9 @@ static void test_force_feedback_joystick( void ) hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); todo_wine ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "IDirectInputDevice8_GetProperty DIPROP_FFLOAD returned %#x\n", hr ); + hr = IDirectInputDevice8_GetForceFeedbackState( device, &res ); + todo_wine + ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "IDirectInputDevice8_GetForceFeedbackState returned %#x\n", hr );
escape.dwSize = sizeof(DIEFFESCAPE); escape.dwCommand = 0; @@ -5685,6 +5696,10 @@ static void test_force_feedback_joystick( void ) hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); todo_wine ok( hr == 0x80040301, "IDirectInputDevice8_GetProperty DIPROP_FFLOAD returned %#x\n", hr ); + res = 0xdeadbeef; + hr = IDirectInputDevice8_GetForceFeedbackState( device, &res ); + todo_wine + ok( hr == 0x80040301, "IDirectInputDevice8_GetForceFeedbackState returned %#x\n", hr );
set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Unacquire( device );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 918db40d444..43834d1f602 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4651,6 +4651,13 @@ static void test_simple_joystick(void) todo_wine ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetForceFeedbackState returned %#x\n", hr );
+ hr = IDirectInputDevice8_SendForceFeedbackCommand( device, 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET ); + todo_wine + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
@@ -5667,6 +5674,9 @@ static void test_force_feedback_joystick( void ) hr = IDirectInputDevice8_GetForceFeedbackState( device, &res ); todo_wine ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "IDirectInputDevice8_GetForceFeedbackState returned %#x\n", hr ); + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET ); + todo_wine + ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr );
escape.dwSize = sizeof(DIEFFESCAPE); escape.dwCommand = 0; @@ -5701,6 +5711,32 @@ static void test_force_feedback_joystick( void ) todo_wine ok( hr == 0x80040301, "IDirectInputDevice8_GetForceFeedbackState returned %#x\n", hr );
+ hr = IDirectInputDevice8_SendForceFeedbackCommand( device, 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET ); + todo_wine + ok( hr == DI_OK, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + set_hid_expect( file, NULL, 0 ); + + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_STOPALL ); + todo_wine + ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_PAUSE ); + todo_wine + ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_CONTINUE ); + todo_wine + ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_SETACTUATORSON ); + todo_wine + ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_SETACTUATORSOFF ); + todo_wine + ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr ); + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 43834d1f602..7e48a7ef5d6 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4658,6 +4658,21 @@ static void test_simple_joystick(void) todo_wine ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr );
+ objdata[0].dwOfs = 0xd; + objdata[0].dwData = 0x80; + res = 1; + hr = IDirectInputDevice8_SendDeviceData( device, sizeof(DIDEVICEOBJECTDATA), objdata, &res, 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr ); + res = 1; + hr = IDirectInputDevice8_SendDeviceData( device, sizeof(DIDEVICEOBJECTDATA), objdata, &res, 1 /*DISDD_CONTINUE*/ ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr ); + res = 1; + hr = IDirectInputDevice8_SendDeviceData( device, sizeof(DIDEVICEOBJECTDATA), objdata, &res, 0 ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
@@ -5518,6 +5533,7 @@ static void test_force_feedback_joystick( void ) }, }; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; + DIDEVICEOBJECTDATA objdata = {0}; DIDEVICEINSTANCEW devinst = {0}; DIEFFECTINFOW effectinfo = {0}; IDirectInputDevice8W *device; @@ -5737,6 +5753,13 @@ static void test_force_feedback_joystick( void ) todo_wine ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr );
+ objdata.dwOfs = 0x16; + objdata.dwData = 0x80; + res = 1; + hr = IDirectInputDevice8_SendDeviceData( device, sizeof(DIDEVICEOBJECTDATA), &objdata, &res, 0 ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr ); + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/driver_hid.c | 5 +++ dlls/dinput8/tests/hid.c | 59 +++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 11 deletions(-)
diff --git a/dlls/dinput8/tests/driver_hid.c b/dlls/dinput8/tests/driver_hid.c index 4c6273ff56a..4a5bca85abc 100644 --- a/dlls/dinput8/tests/driver_hid.c +++ b/dlls/dinput8/tests/driver_hid.c @@ -144,6 +144,11 @@ static void expect_queue_next( struct expect_queue *queue, ULONG code, HID_XFER_
ok( tmp != &queue->spurious, "got spurious packet\n" );
+ winetest_push_context( "%s expect[%d]", tmp->context, tmp - queue->buffer ); + todo_wine_if( tmp->todo ) + ok( 1, "found code %#x id %u len %u\n", tmp->code, tmp->report_id, tmp->report_len ); + winetest_pop_context(); + tmp = missing; while (tmp != missing_end) { diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 7e48a7ef5d6..f93c2b471f4 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5189,6 +5189,20 @@ static void test_force_feedback_joystick( void ) REPORT_COUNT(1, 6), OUTPUT(1, Cnst|Var|Abs), END_COLLECTION, + + USAGE(1, PID_USAGE_SET_PERIODIC_REPORT), + COLLECTION(1, Logical), + REPORT_ID(1, 5), + + USAGE(1, PID_USAGE_MAGNITUDE), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(2, 0x00ff), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(2, 0x2710), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + END_COLLECTION, END_COLLECTION, }; #undef REPORT_ID_OR_USAGE_PAGE @@ -5259,7 +5273,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = 0x14, + .dwOfs = 0x18, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(0)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 0", @@ -5271,7 +5285,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = 0x15, + .dwOfs = 0x19, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(1)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 1", @@ -5283,7 +5297,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x16, + .dwOfs = 0x1a, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(4)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"DC Device Reset", @@ -5307,7 +5321,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x17, + .dwOfs = 0x1b, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(6)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start", @@ -5319,7 +5333,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x18, + .dwOfs = 0x1c, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(7)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start Solo", @@ -5331,7 +5345,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x19, + .dwOfs = 0x1d, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(8)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Stop", @@ -5367,7 +5381,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x1a, + .dwOfs = 0x1e, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(11)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Sine", @@ -5379,7 +5393,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x1b, + .dwOfs = 0x1f, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(12)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"X Axis", @@ -5391,7 +5405,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x1c, + .dwOfs = 0x20, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(13)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Direction Enable", @@ -5400,6 +5414,18 @@ static void test_force_feedback_joystick( void ) .wUsage = PID_USAGE_DIRECTION_ENABLE, .wReportId = 3, }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwOfs = 0x14, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(14)|DIDFT_OUTPUT, + .dwFlags = 0x80008000, + .tszName = L"Magnitude", + .wCollectionNumber = 10, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_MAGNITUDE, + .wReportId = 5, + }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, @@ -5484,6 +5510,14 @@ static void test_force_feedback_joystick( void ) .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_AXES_ENABLE, }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(10), + .tszName = L"Collection 10 - Set Periodic Report", + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_SET_PERIODIC_REPORT, + }, }; const struct check_objects_todos objects_todos[ARRAY_SIZE(expect_objects)] = { @@ -5497,6 +5531,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIEFFECTINFOW), .guid = GUID_Sine, + .dwEffType = DIEFT_PERIODIC, .dwStaticParams = DIEP_AXES | DIEP_TYPESPECIFICPARAMS, .dwDynamicParams = DIEP_AXES | DIEP_TYPESPECIFICPARAMS, .tszName = L"GUID_Sine", @@ -5631,7 +5666,8 @@ static void test_force_feedback_joystick( void ) res = 0; hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, DIEFT_PERIODIC ); ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); - ok( res == 0, "got %u expected %u\n", res, 0 ); + todo_wine + ok( res == 1, "got %u expected %u\n", res, 1 ); hr = IDirectInputDevice8_EnumEffects( device, check_effects, &check_effects_params, DIEFT_ALL ); ok( hr == DI_OK, "IDirectInputDevice8_EnumEffects returned %#x\n", hr ); todo_wine @@ -5643,6 +5679,7 @@ static void test_force_feedback_joystick( void ) ok( hr == DI_OK, "IDirectInputDevice8_GetEffectInfo returned %#x\n", hr ); todo_wine check_member_guid( effectinfo, expect_effects[0], guid ); + todo_wine check_member( effectinfo, expect_effects[0], "%#x", dwEffType ); todo_wine check_member( effectinfo, expect_effects[0], "%#x", dwStaticParams ); @@ -5753,7 +5790,7 @@ static void test_force_feedback_joystick( void ) todo_wine ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "IDirectInputDevice8_SendForceFeedbackCommand returned %#x\n", hr );
- objdata.dwOfs = 0x16; + objdata.dwOfs = 0x1e; objdata.dwData = 0x80; res = 1; hr = IDirectInputDevice8_SendDeviceData( device, sizeof(DIDEVICEOBJECTDATA), &objdata, &res, 0 );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 1 + dlls/dinput8/tests/hid.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 11496640049..d869f439101 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1578,6 +1578,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("(%p)->(%s,%p,%p,%p): stub!\n", This, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter); + if (!ppdef) return E_POINTER;
FIXME("not available in the generic implementation\n"); *ppdef = NULL; diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index f93c2b471f4..1ab6e645947 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3682,6 +3682,7 @@ static void test_simple_joystick(void) DIEFFECTINFOW effectinfo = {0}; DIDATAFORMAT dataformat = {0}; IDirectInputDevice8W *device; + IDirectInputEffect *effect; DIEFFESCAPE escape = {0}; DIDEVCAPS caps = {0}; IDirectInput8W *di; @@ -4673,9 +4674,21 @@ static void test_simple_joystick(void) todo_wine ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr );
+ hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, NULL, NULL ); + ok( hr == E_POINTER, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL ); + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL ); + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL ); + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
+ hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL ); + ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_Escape( device, NULL ); todo_wine ok( hr == E_POINTER, "IDirectInputDevice8_Escape returned: %#x\n", hr ); @@ -5051,6 +5064,30 @@ static BOOL test_device_types(void) return success; }
+static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) +{ + IDirectInputEffect *effect; + HRESULT hr; + ULONG ref; + + hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, NULL, NULL ); + ok( hr == E_POINTER, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL ); + todo_wine + ok( hr == E_POINTER, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL ); + todo_wine + ok( hr == DIERR_DEVICENOTREG, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + + hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL ); + todo_wine + ok( hr == DI_OK, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + if (hr != DI_OK) return; + + ref = IDirectInputEffect_Release( effect ); + ok( ref == 0, "IDirectInputDeviceW_Release returned %d\n", ref ); +} + static void test_force_feedback_joystick( void ) { #include "psh_hid_macros.h" @@ -5797,6 +5834,8 @@ static void test_force_feedback_joystick( void ) todo_wine ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr );
+ test_periodic_effect( device, file ); + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );