Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/mfplat/main.c | 10 +++++++--- dlls/mfplat/tests/mfplat.c | 27 +++++++++++++++++---------- 2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 25c075781b..6ada39a1c9 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -919,12 +919,16 @@ static HRESULT WINAPI mfattributes_GetCount(IMFAttributes *iface, UINT32 *items) { mfattributes *This = impl_from_IMFAttributes(iface);
- FIXME("%p, %p\n", This, items); + TRACE("(%p, %p)\n", This, items); + + EnterCriticalSection(&This->lock);
if(items) - *items = 0; + *items = This->count;
- return E_NOTIMPL; + LeaveCriticalSection(&This->lock); + + return S_OK; }
static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 index, GUID *key, PROPVARIANT *value) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 4564f410d3..51c6a2abec 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -409,28 +409,30 @@ static void test_MFCreateMediaEvent(void) IMFMediaEvent_Release(mediaevent); }
+#define CHECK_COUNT(obj,expected) _check_count(obj, expected, __LINE__) +static void _check_count(IMFAttributes* obj, ULONG expected, int line) +{ + UINT32 count = 9999; + HRESULT hr; + hr = IMFAttributes_GetCount(obj, &count); + ok_(__FILE__,line)(hr == S_OK, "IMFAttributes_GetCount failed: 0x%08x.\n", hr); + ok_(__FILE__,line)(count == expected, "got %d, expected %d.\n", count, expected); +} + static void test_MFCreateAttributes(void) { IMFAttributes *attributes; HRESULT hr; - UINT32 count; UINT32 uint32_value; UINT64 uint64_value;
hr = MFCreateAttributes( &attributes, 3 ); ok(hr == S_OK, "got 0x%08x\n", hr); - - count = 88; - hr = IMFAttributes_GetCount(attributes, &count); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); - ok(count == 0, "got %d\n", count); + CHECK_COUNT(attributes, 0);
hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 123); ok(hr == S_OK, "IMFAttributes_SetUINT32 failed: 0x%08x.\n", hr); - - hr = IMFAttributes_GetCount(attributes, &count); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); - todo_wine ok(count == 1, "got %d\n", count); + CHECK_COUNT(attributes, 1);
uint32_value = 0xdeadbeef; hr = IMFAttributes_GetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint32_value); @@ -444,6 +446,7 @@ static void test_MFCreateAttributes(void)
hr = IMFAttributes_SetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 65536); ok(hr == S_OK, "IMFAttributes_SetUINT64 failed: 0x%08x.\n", hr); + CHECK_COUNT(attributes, 1);
hr = IMFAttributes_GetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint64_value); ok(hr == S_OK, "IMFAttributes_GetUINT64 failed: 0x%08x.\n", hr); @@ -786,8 +789,10 @@ static void test_IMFAttributes_item(void) hr = IMFAttributes_SetItem(attributes, &DUMMY_GUID3, &propvar); ok(hr == S_OK, "IMFAttributes_SetItem failed: 0x%08x.\n", hr);
+ CHECK_COUNT(attributes, 3); hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr); + CHECK_COUNT(attributes, 2); hr = IMFAttributes_GetItemByIndex(attributes, 0, &key, &ret_propvar); ok(hr == S_OK, "IMFAttributes_GetItemByIndex failed: 0x%08x.\n", hr); ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n"); @@ -801,8 +806,10 @@ static void test_IMFAttributes_item(void) ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n"); ok(IsEqualIID(&key, &DUMMY_GUID1), "got wrong key: %s.\n", wine_dbgstr_guid(&key));
+ CHECK_COUNT(attributes, 2); hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr); + CHECK_COUNT(attributes, 2);
hr = IMFAttributes_GetItemByIndex(attributes, 2, &key, &ret_propvar); ok(hr == E_INVALIDARG, "IMFAttributes_GetItemByIndex should fail: 0x%08x.\n", hr);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=46066
Your paranoid android.
=== wxppro (32 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64 (32 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64_zh_CN (32 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64_fr (32 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64_he (32 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== w7u (32 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== w7pro64 (32 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64 (64 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== w7pro64 (64 bit report) ===
mfplat: mfplat.c:798: Test failed: got wrong property. mfplat.c:799: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:806: Test failed: got wrong property. mfplat.c:807: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.