Rémi Bernon : ntoskrnl.exe/tests: Add some HidP_GetData tests.

Alexandre Julliard julliard at winehq.org
Wed Jun 16 16:26:24 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Jun 16 11:20:54 2021 +0200

ntoskrnl.exe/tests: Add some HidP_GetData tests.

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

---

 dlls/ntoskrnl.exe/tests/ntoskrnl.c | 43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 161c5842d6a..735d1a0d996 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -1775,6 +1775,18 @@ static void test_hidp(HANDLE file, int report_id)
             .CollectionType = 2,
         },
     };
+    static const HIDP_DATA expect_data[] =
+    {
+        { .DataIndex = 0, },
+        { .DataIndex = 1, },
+        { .DataIndex = 5, .RawValue = 1, },
+        { .DataIndex = 7, .RawValue = 1, },
+        { .DataIndex = 30, },
+        { .DataIndex = 31, },
+        { .DataIndex = 32, .RawValue = 0xfeedcafe, },
+        { .DataIndex = 37, .RawValue = 1, },
+        { .DataIndex = 39, .RawValue = 1, },
+    };
 
     HIDP_LINK_COLLECTION_NODE collections[16];
     PHIDP_PREPARSED_DATA preparsed_data;
@@ -1784,6 +1796,7 @@ static void test_hidp(HANDLE file, int report_id)
     char buffer[200], report[200];
     DWORD collection_count;
     DWORD waveform_list;
+    HIDP_DATA data[32];
     USAGE usages[16];
     NTSTATUS status;
     HIDP_CAPS caps;
@@ -2397,6 +2410,36 @@ static void test_hidp(HANDLE file, int report_id)
     ok(usage_and_pages[3].Usage == 4, "got usage_and_pages[3] Usage %x, expected %x\n",
        usage_and_pages[3].Usage, 4);
 
+    value = HidP_MaxDataListLength(HidP_Feature + 1, preparsed_data);
+    ok(value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0);
+    value = HidP_MaxDataListLength(HidP_Input, preparsed_data);
+    todo_wine
+    ok(value == 50, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 50);
+    value = HidP_MaxDataListLength(HidP_Output, preparsed_data);
+    ok(value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0);
+    value = HidP_MaxDataListLength(HidP_Feature, preparsed_data);
+    ok(value == 13, "HidP_MaxDataListLength(HidP_Feature) returned %d, expected %d\n", value, 13);
+
+    value = 1;
+    status = HidP_GetData(HidP_Input, data, &value, preparsed_data, report, caps.InputReportByteLength);
+    todo_wine_if(report_id)
+    ok(status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetData returned %#x\n", status);
+    todo_wine
+    ok(value == 9, "got data count %d, expected %d\n", value, 9);
+    memset(data, 0, sizeof(data));
+    status = HidP_GetData(HidP_Input, data, &value, preparsed_data, report, caps.InputReportByteLength);
+    todo_wine_if(report_id)
+    ok(status == HIDP_STATUS_SUCCESS, "HidP_GetData returned %#x\n", status);
+    if (status == HIDP_STATUS_SUCCESS) for (i = 0; i < ARRAY_SIZE(expect_data); ++i)
+    {
+        winetest_push_context("data[%d]", i);
+        todo_wine_if(i >= 4)
+        check_member(data[i], expect_data[i], "%d", DataIndex);
+        todo_wine_if(i == 6 || i == 7 || i == 8)
+        check_member(data[i], expect_data[i], "%d", RawValue);
+        winetest_pop_context();
+    }
+
     memset(report, 0xcd, sizeof(report));
     status = HidP_InitializeReportForID(HidP_Feature, 3, preparsed_data, report, caps.FeatureReportByteLength);
     todo_wine_if(!report_id)




More information about the wine-cvs mailing list