Rémi Bernon : dinput8/tests: Add some HID joystick IDirectInputEffect_(Start|Stop) tests.

Alexandre Julliard julliard at winehq.org
Thu Oct 7 16:21:19 CDT 2021


Module: wine
Branch: master
Commit: 4315d27992f68a4037182e5147a4c790be5665ee
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4315d27992f68a4037182e5147a4c790be5665ee

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Oct  7 10:40:03 2021 +0200

dinput8/tests: Add some HID joystick IDirectInputEffect_(Start|Stop) tests.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput8/tests/hid.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index 7388a7499c4..eb774dd5fe3 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -5122,6 +5122,46 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
             .report_buf = {0x02,0x01,0x01,0x01},
         },
     };
+    struct hid_expect expect_start =
+    {
+        .code = IOCTL_HID_WRITE_REPORT,
+        .todo = TRUE,
+        .report_id = 2,
+        .report_len = 4,
+        .report_buf = {0x02, 0x01, 0x01, 0x01},
+    };
+    struct hid_expect expect_start_solo =
+    {
+        .code = IOCTL_HID_WRITE_REPORT,
+        .todo = TRUE,
+        .report_id = 2,
+        .report_len = 4,
+        .report_buf = {0x02, 0x01, 0x02, 0x01},
+    };
+    struct hid_expect expect_start_0 =
+    {
+        .code = IOCTL_HID_WRITE_REPORT,
+        .todo = TRUE,
+        .report_id = 2,
+        .report_len = 4,
+        .report_buf = {0x02, 0x01, 0x01, 0x00},
+    };
+    struct hid_expect expect_start_4 =
+    {
+        .code = IOCTL_HID_WRITE_REPORT,
+        .todo = TRUE,
+        .report_id = 2,
+        .report_len = 4,
+        .report_buf = {0x02, 0x01, 0x01, 0x04},
+    };
+    struct hid_expect expect_stop =
+    {
+        .code = IOCTL_HID_WRITE_REPORT,
+        .todo = TRUE,
+        .report_id = 2,
+        .report_len = 4,
+        .report_buf = {0x02, 0x01, 0x03, 0x00},
+    };
     struct hid_expect expect_unload[] =
     {
         {
@@ -5131,6 +5171,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
             .report_len = 4,
             .report_buf = {0x02,0x01,0x03,0x00},
         },
+        /* device reset, when unloaded from Unacquire */
         {
             .code = IOCTL_HID_WRITE_REPORT,
             .report_id = 1,
@@ -5723,6 +5764,13 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
     todo_wine
     check_member( periodic, expect_periodic, "%u", dwPeriod );
 
+    hr = IDirectInputEffect_Start( effect, 1, DIES_NODOWNLOAD );
+    todo_wine
+    ok( hr == DIERR_NOTDOWNLOADED, "Start returned %#x\n", hr );
+    hr = IDirectInputEffect_Stop( effect );
+    todo_wine
+    ok( hr == DIERR_NOTDOWNLOADED, "Stop returned %#x\n", hr );
+
     set_hid_expect( file, expect_download, 3 * sizeof(struct hid_expect) );
     hr = IDirectInputEffect_Download( effect );
     todo_wine
@@ -5733,6 +5781,40 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
     todo_wine
     ok( hr == DI_NOEFFECT, "Download returned %#x\n", hr );
 
+    hr = IDirectInputEffect_Start( effect, 1, 0xdeadbeef );
+    todo_wine
+    ok( hr == DIERR_INVALIDPARAM, "Start returned %#x\n", hr );
+
+    set_hid_expect( file, &expect_start_solo, sizeof(expect_start_solo) );
+    hr = IDirectInputEffect_Start( effect, 1, DIES_SOLO );
+    todo_wine
+    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    set_hid_expect( file, NULL, 0 );
+
+    set_hid_expect( file, &expect_stop, sizeof(expect_stop) );
+    hr = IDirectInputEffect_Stop( effect );
+    todo_wine
+    ok( hr == DI_OK, "Stop returned %#x\n", hr );
+    set_hid_expect( file, NULL, 0 );
+
+    set_hid_expect( file, &expect_start, sizeof(expect_start) );
+    hr = IDirectInputEffect_Start( effect, 1, 0 );
+    todo_wine
+    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    set_hid_expect( file, NULL, 0 );
+
+    set_hid_expect( file, &expect_start_4, sizeof(expect_start_4) );
+    hr = IDirectInputEffect_Start( effect, 4, 0 );
+    todo_wine
+    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    set_hid_expect( file, NULL, 0 );
+
+    set_hid_expect( file, &expect_start_0, sizeof(expect_start_4) );
+    hr = IDirectInputEffect_Start( effect, 0, 0 );
+    todo_wine
+    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    set_hid_expect( file, NULL, 0 );
+
     set_hid_expect( file, expect_unload, sizeof(struct hid_expect) );
     hr = IDirectInputEffect_Unload( effect );
     todo_wine
@@ -5762,6 +5844,13 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
     ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
     set_hid_expect( file, NULL, 0 );
 
+    hr = IDirectInputEffect_Start( effect, 1, DIES_NODOWNLOAD );
+    todo_wine
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Start returned %#x\n", hr );
+    hr = IDirectInputEffect_Stop( effect );
+    todo_wine
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Stop returned %#x\n", hr );
+
     set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) );
     hr = IDirectInputDevice8_Acquire( device );
     ok( hr == DI_OK, "Acquire returned: %#x\n", hr );




More information about the wine-cvs mailing list