From 9a9af8b39a564b08436ca1e3d2ec663d083fbf96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 11 Feb 2020 19:13:45 +0100 Subject: [PATCH] hid/tests: Add tests for HidP_GetLinkCollectionNodes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Aric Stewart Signed-off-by: Alexandre Julliard --- 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 19f450045f1..b3e959d2594 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);