hid/tests: Add tests for HidP_GetLinkCollectionNodes.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2020-02-11 19:13:45 +01:00 committed by Alexandre Julliard
parent 5c145acd4b
commit 9a9af8b39a
1 changed files with 37 additions and 0 deletions

View File

@ -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);