From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/force_feedback.c | 71 ++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index d6eab3850c5..96600240521 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -5833,6 +5833,46 @@ static void test_windows_gaming_input(void) .todo = TRUE, }, }; + struct hid_expect expect_create_ramp_neg[] = + { + /* create new effect */ + { + .code = IOCTL_HID_SET_FEATURE, + .report_id = 2, + .report_len = 3, + .report_buf = {2,0x05,0x00}, + }, + /* block load */ + { + .code = IOCTL_HID_GET_FEATURE, + .report_id = 3, + .report_len = 5, + .report_buf = {3,0x01,0x01,0x00,0x00}, + }, + /* set ramp */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 10, + .report_len = 6, + .report_buf = {10,0x01,0x18,0xfc,0x60,0xf0}, + }, + /* update effect (wine) */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 3, + .report_len = 18, + .report_buf = {3,0x01,0x05,0x04,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x99,0x00,0x00,0x00}, + .wine_only = TRUE, .todo = TRUE, + }, + /* update effect */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 3, + .report_len = 18, + .report_buf = {3,0x01,0x05,0x04,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, + .todo = TRUE, + }, + }; struct hid_expect expect_effect_start = { .code = IOCTL_HID_WRITE_REPORT, @@ -6589,6 +6629,37 @@ static void test_windows_gaming_input(void) set_hid_expect( file, NULL, 0 );
+ hr = IForceFeedbackEffect_QueryInterface( effect, &IID_IRampForceEffect, (void **)&ramp_effect ); + ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + direction.X = -direction.X; + direction.Y = -direction.Y; + end_direction.X = -end_direction.X; + end_direction.Z = -end_direction.Z; + hr = IRampForceEffect_SetParameters( ramp_effect, direction, end_direction, infinite_duration ); + ok( hr == S_OK, "SetParameters returned %#lx\n", hr ); + direction.X = -direction.X; + direction.Y = -direction.Y; + end_direction.X = -end_direction.X; + end_direction.Z = -end_direction.Z; + IRampForceEffect_Release( ramp_effect ); + + set_hid_expect( file, expect_create_ramp_neg, sizeof(expect_create_ramp_neg) ); + hr = IForceFeedbackMotor_LoadEffectAsync( motor, effect, &result_async ); + ok( hr == S_OK, "LoadEffectAsync returned %#lx\n", hr ); + await_result( result_async ); + check_result_async( result_async, 1, Completed, S_OK, ForceFeedbackLoadEffectResult_Succeeded ); + IAsyncOperation_ForceFeedbackLoadEffectResult_Release( result_async ); + set_hid_expect( file, NULL, 0 ); + + set_hid_expect( file, expect_unload, sizeof(expect_unload) ); + hr = IForceFeedbackMotor_TryUnloadEffectAsync( motor, effect, &bool_async ); + ok( hr == S_OK, "TryUnloadEffectAsync returned %#lx\n", hr ); + await_bool( bool_async ); + check_bool_async( bool_async, 1, Completed, S_OK, TRUE ); + IAsyncOperation_boolean_Release( bool_async ); + set_hid_expect( file, NULL, 0 ); + + IForceFeedbackEffect_Release( effect );