[PATCH 3/6] mfreadwrite/tests: Add some audio media type attributes tests.

Nikolay Sivov nsivov at codeweavers.com
Tue Nov 9 14:50:16 CST 2021



On 11/8/21 5:08 PM, Rémi Bernon wrote:
> +    for (i = 0; i < count; i++)
> +    {
> +        PropVariantInit(&value);
> +        hr = IMFMediaType_GetItemByIndex(media_type, i, &key, &value);
> +        ok(hr == S_OK, "GetItemByIndex returned hr %#x\n", hr);
> +
> +        for (j = 0; expect->items[j].key; j++) if (IsEqualGUID(expect->items[j].key, &key)) break;
> +        if (!expect->items[j].key)
> +        {
> +            todo_wine_if(expect->todo_spurious > spurious_count)
> +            ok(0, "spurious attribute %s\n", debugstr_guid(&key));
> +            spurious_count++;
> +            continue;
> +        }
So this basically ignores "extra" attributes a type might have, that are
not accounted for in "expect"?
A rather arbitrary number of attributes we don't know about will be ignored.

Will it work if you checked for expected attributes only, doing a loop
over "expect" array,
and simply checking with CompareItem(expect.key, expect.value) ? This
way you don't know secondary search,
and we'll know that all of expected attributes matched.

> +
> +        ok(!found[j], "duplicate attribute %s\n", debugstr_guid(&key));
> +        found[j] = TRUE;
I don't understand this duplicate detection. If you're iterating once
through all attributes with zeroed "found[]",
how is it possible to get duplicated keys?
> +
> +        if (!strcmp(winetest_platform, "wine"))
> +            ok(!expect->items[j].todo_missing, "attribute not missing %s\n", debugstr_guid(&key));
> +        ok(!PropVariantCompareEx(&value, &expect->items[j].value, 0, 0), "got %s, expected %s.\n",
> +                debugstr_propvariant(&value), debugstr_propvariant(&expect->items[j].value));
> +        PropVariantClear(&value);
> +    }
Like I meantioned CompareItem() should probably work?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20211109/aca27452/attachment.htm>


More information about the wine-devel mailing list