Module: wine Branch: master Commit: 11374e7020999e94d3f2366db068b3b72490fc2a URL: https://gitlab.winehq.org/wine/wine/-/commit/11374e7020999e94d3f2366db068b3b...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Dec 21 12:55:41 2022 +0100
dinput/tests: Test dinput force feedback effect envelope removal.
---
dlls/dinput/tests/force_feedback.c | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index 353a8968f89..145f6108ab6 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -425,6 +425,55 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_buf = {0x03,0x01,0x02,0x08,0x01,0x00,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, }, }; + struct hid_expect expect_download_3[] = + { + /* set periodic */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 5, + .report_len = 2, + .report_buf = {0x05,0x19}, + }, + /* set envelope */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 6, + .report_len = 7, + .report_buf = {0x06,0x19,0x4c,0x01,0x00,0x04,0x00}, + }, + /* update effect */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 3, + .report_len = 11, + .report_buf = {0x03,0x01,0x02,0x08,0xff,0xff,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, + }, + }; + struct hid_expect expect_download_4[] = + { + /* set periodic */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 5, + .report_len = 2, + .report_buf = {0x05,0x19}, + }, + /* set envelope (wine) */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 6, + .report_len = 7, + .report_buf = {0x06,0x19,0x4c,0x01,0x00,0x04,0x00}, + .todo = TRUE, .wine_only = TRUE, + }, + /* update effect */ + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 3, + .report_len = 11, + .report_buf = {0x03,0x01,0x02,0x08,0xff,0xff,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, + }, + }; struct hid_expect expect_update[] = { /* update effect */ @@ -1441,6 +1490,32 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO ok( hr == DI_OK, "SetParameters returned %#lx\n", hr ); wait_hid_expect( file, 100 ); /* these updates are sent asynchronously */
+ set_hid_expect( file, &expect_stop, sizeof(expect_stop) ); + hr = IDirectInputEffect_Unload( effect ); + ok( hr == DI_OK, "Unload returned %#lx\n", hr ); + set_hid_expect( file, NULL, 0 ); + + hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_NODOWNLOAD ); + ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr ); + set_hid_expect( file, expect_download_3, sizeof(expect_download_3) ); + hr = IDirectInputEffect_SetParameters( effect, &expect_desc, 0 ); + ok( hr == DI_OK, "SetParameters returned %#lx\n", hr ); + wait_hid_expect( file, 100 ); /* these updates are sent asynchronously */ + + set_hid_expect( file, &expect_stop, sizeof(expect_stop) ); + hr = IDirectInputEffect_Unload( effect ); + ok( hr == DI_OK, "Unload returned %#lx\n", hr ); + set_hid_expect( file, NULL, 0 ); + + desc = expect_desc; + desc.lpEnvelope = NULL; + hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD | DIEP_ENVELOPE ); + ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr ); + set_hid_expect( file, expect_download_4, sizeof(expect_download_4) ); + hr = IDirectInputEffect_SetParameters( effect, &expect_desc, 0 ); + ok( hr == DI_OK, "SetParameters returned %#lx\n", hr ); + wait_hid_expect( file, 100 ); /* these updates are sent asynchronously */ + set_hid_expect( file, &expect_stop, sizeof(expect_stop) ); ref = IDirectInputEffect_Release( effect ); ok( ref == 0, "Release returned %ld\n", ref );