[PATCH v2 3/4] hid/tests: Add tests for HidP_GetLinkCollectionNodes.

Aric Stewart aric at codeweavers.com
Wed Feb 12 10:00:37 CST 2020


Signed-off-by: Aric Stewart <aric at codeweavers.com>

On 2/11/20 12:13 PM, Rémi Bernon wrote:
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
>   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);
> 



More information about the wine-devel mailing list