Module: wine Branch: master Commit: d348cf37221e40a7d584d910faa14ce1eaf6be33 URL: https://gitlab.winehq.org/wine/wine/-/commit/d348cf37221e40a7d584d910faa14ce...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Dec 21 12:31:42 2022 +0100
dinput/tests: Test windows.gaming.input infinite effect duration.
---
dlls/dinput/tests/force_feedback.c | 77 +++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index 6c7d4791c84..353a8968f89 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -20,6 +20,7 @@
#include <stdarg.h> #include <stddef.h> +#include <stdint.h>
#include "ntstatus.h" #define WIN32_NO_STATUS @@ -5024,7 +5025,7 @@ static void test_windows_gaming_input(void) LOGICAL_MINIMUM(1, 0), LOGICAL_MAXIMUM(2, 0x7fff), PHYSICAL_MINIMUM(1, 0), - PHYSICAL_MAXIMUM(2, 0x7fff), + PHYSICAL_MAXIMUM(1, 0), REPORT_SIZE(1, 16), REPORT_COUNT(1, 4), OUTPUT(1, Data|Var|Abs), @@ -5709,6 +5710,54 @@ static void test_windows_gaming_input(void) .report_buf = {3,0x01,0x05,0x04,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, }, }; + struct hid_expect expect_create_ramp_inf[] = + { + /* 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,0xe8,0x03,0xa0,0x0f}, + }, + /* 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 (wine) */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 3, + .report_len = 18, + .report_buf = {3,0x01,0x05,0x04,0x8f,0xe4,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, + .todo = TRUE, .wine_only = 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, @@ -5756,7 +5805,7 @@ static void test_windows_gaming_input(void) .dwHow = DIPH_DEVICE, }, }; - TimeSpan delay = {100000}, attack_duration = {200000}, release_duration = {300000}, duration = {400000}; + TimeSpan delay = {100000}, attack_duration = {200000}, release_duration = {300000}, duration = {400000}, infinite_duration = {INT64_MAX}; Vector3 direction = {0.1, 0.2, 0.3}, end_direction = {0.4, 0.5, 0.6}; DIDEVICEINSTANCEW devinst = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; IAsyncOperation_ForceFeedbackLoadEffectResult *result_async; @@ -6441,6 +6490,30 @@ static void test_windows_gaming_input(void) IAsyncOperation_boolean_Release( bool_async ); set_hid_expect( file, NULL, 0 );
+ + hr = IForceFeedbackEffect_QueryInterface( effect, &IID_IRampForceEffect, (void **)&ramp_effect ); + ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + hr = IRampForceEffect_SetParameters( ramp_effect, direction, end_direction, infinite_duration ); + ok( hr == S_OK, "SetParameters returned %#lx\n", hr ); + IRampForceEffect_Release( ramp_effect ); + + set_hid_expect( file, expect_create_ramp_inf, sizeof(expect_create_ramp_inf) ); + 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 );