Module: wine Branch: master Commit: 3a6e5277787710bfc58de300ff3677f7e655d4fa URL: https://gitlab.winehq.org/wine/wine/-/commit/3a6e5277787710bfc58de300ff3677f...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Jan 2 15:33:44 2023 +0100
dinput/tests: Test W.G.I periodic effect with negative direction.
---
dlls/dinput/tests/force_feedback.c | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index aaa240cdf01..b7289ed60ac 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -5678,6 +5678,45 @@ static void test_windows_gaming_input(void) .report_buf = {3,0x01,0x02,0x04,0x78,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, }, }; + struct hid_expect expect_create_periodic_neg[] = + { + /* create new effect */ + { + .code = IOCTL_HID_SET_FEATURE, + .report_id = 2, + .report_len = 3, + .report_buf = {2,0x02,0x00}, + }, + /* block load */ + { + .code = IOCTL_HID_GET_FEATURE, + .report_id = 3, + .report_len = 5, + .report_buf = {3,0x01,0x01,0x00,0x00}, + }, + /* set periodic */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 7, + .report_len = 10, + .report_buf = {7,0x01,0x10,0x27,0x00,0x00,0x70,0xff,0xe8,0x03}, + }, + /* set envelope (wine) */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 8, + .report_len = 8, + .report_buf = {8,0x01,0x00,0x00,0x00,0x00,0x00,0x00}, + .todo = TRUE, .wine_only = TRUE, + }, + /* update effect */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 3, + .report_len = 18, + .report_buf = {3,0x01,0x02,0x04,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x1a,0x00,0x00,0x00}, + }, + }; struct hid_expect expect_create_condition[] = { /* create new effect */ @@ -6452,6 +6491,32 @@ static void test_windows_gaming_input(void) IAsyncOperation_boolean_Release( bool_async ); set_hid_expect( file, NULL, 0 );
+ + hr = IForceFeedbackEffect_QueryInterface( effect, &IID_IPeriodicForceEffect, (void **)&periodic_effect ); + ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + direction.X = -direction.X; + hr = IPeriodicForceEffect_SetParameters( periodic_effect, direction, 1.0, 0.1, 0.0, duration ); + ok( hr == S_OK, "SetParameters returned %#lx\n", hr ); + direction.X = -direction.X; + IPeriodicForceEffect_Release( periodic_effect ); + + set_hid_expect( file, expect_create_periodic_neg, sizeof(expect_create_periodic_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 );
IPeriodicForceEffectFactory_Release( periodic_factory );