Rémi Bernon : hid/tests: Add tests for HidP_GetLinkCollectionNodes.

Alexandre Julliard julliard at winehq.org
Wed Feb 12 16:21:08 CST 2020


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Feb 11 19:13:45 2020 +0100

hid/tests: Add tests for HidP_GetLinkCollectionNodes.

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

---

 dlls/hid/tests/device.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/dlls/hid/tests/device.c b/dlls/hid/tests/device.c
index 19f450045f..b3e959d259 100644
--- a/dlls/hid/tests/device.c
+++ b/dlls/hid/tests/device.c
@@ -35,9 +35,12 @@ static void test_device_info(HANDLE device)
     PHIDP_PREPARSED_DATA ppd;
     HIDP_CAPS Caps;
     HIDD_ATTRIBUTES attributes;
+    HIDP_LINK_COLLECTION_NODE nodes[16];
+    ULONG nodes_count;
     NTSTATUS status;
     BOOL rc;
     WCHAR device_name[128];
+    int i;
 
     rc = HidD_GetPreparsedData(device, &ppd);
     ok(rc, "Failed to get preparsed data(0x%x)\n", GetLastError());
@@ -46,6 +49,40 @@ static void test_device_info(HANDLE device)
     rc = HidD_GetProductString(device, device_name, sizeof(device_name));
     ok(rc, "Failed to get product string(0x%x)\n", GetLastError());
     trace("Found device %s (%02x, %02x)\n", wine_dbgstr_w(device_name), Caps.UsagePage, Caps.Usage);
+
+    trace("LinkCollectionNodes: (%d)\n", Caps.NumberLinkCollectionNodes);
+    todo_wine
+    ok(Caps.NumberLinkCollectionNodes > 0, "Expected at least one link collection\n");
+
+    nodes_count = 0;
+    status = HidP_GetLinkCollectionNodes(nodes, &nodes_count, ppd);
+    todo_wine
+    ok(status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetLinkCollectionNodes succeeded:%x\n", status);
+
+    nodes_count = ARRAY_SIZE(nodes);
+    status = HidP_GetLinkCollectionNodes(nodes, &nodes_count, ppd);
+    todo_wine
+    ok(status == HIDP_STATUS_SUCCESS, "HidP_GetLinkCollectionNodes failed:%x\n", status);
+
+    for (i = 0; i < nodes_count; ++i)
+    {
+        trace("  [%d] LinkUsage: %x LinkUsagePage: %x Parent: %x "
+              "NumberOfChildren: %x NextSibling: %x FirstChild: %x "
+              "CollectionType: %x IsAlias: %x UserContext: %p\n",
+              i, nodes[i].LinkUsage, nodes[i].LinkUsagePage, nodes[i].Parent,
+              nodes[i].NumberOfChildren, nodes[i].NextSibling, nodes[i].FirstChild,
+              nodes[i].CollectionType, nodes[i].IsAlias, nodes[i].UserContext);
+    }
+
+    todo_wine
+    ok(nodes_count > 0, "Unexpected number of link collection nodes:%u.\n", nodes_count);
+    todo_wine
+    ok(nodes[0].LinkUsagePage == Caps.UsagePage, "Unexpected top collection usage page:%x\n", nodes[0].LinkUsagePage);
+    todo_wine
+    ok(nodes[0].LinkUsage == Caps.Usage, "Unexpected top collection usage:%x\n", nodes[0].LinkUsage);
+    todo_wine
+    ok(nodes[0].CollectionType == 1, "Unexpected top collection type:%x\n", nodes[0].CollectionType);
+
     rc = HidD_FreePreparsedData(ppd);
     ok(rc, "Failed to free preparsed data(0x%x)\n", GetLastError());
     rc = HidD_GetAttributes(device, &attributes);




More information about the wine-cvs mailing list