mf/tests: Add some more tests for SAR current type.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-04-10 17:06:22 +03:00 committed by Alexandre Julliard
parent 09630fc92e
commit 5d09f46150
1 changed files with 44 additions and 1 deletions

View File

@ -2798,15 +2798,58 @@ if (SUCCEEDED(hr))
hr = IMFMediaTypeHandler_IsMediaTypeSupported(handler, mediatype, NULL);
ok(hr == MF_E_INVALIDMEDIATYPE, "Unexpected hr %#x.\n", hr);
hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, mediatype);
ok(hr == MF_E_INVALIDMEDIATYPE, "Unexpected hr %#x.\n", hr);
hr = IMFMediaTypeHandler_GetMediaTypeByIndex(handler, 0, &mediatype2);
ok(hr == S_OK, "Failed to get media type, hr %#x.\n", hr);
hr = IMFMediaTypeHandler_IsMediaTypeSupported(handler, mediatype2, NULL);
ok(hr == MF_E_INVALIDMEDIATYPE, "Unexpected hr %#x.\n", hr);
IMFMediaType_Release(mediatype2);
IMFMediaType_Release(mediatype);
hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, mediatype2);
ok(hr == S_OK, "Failed to set current type, hr %#x.\n", hr);
hr = IMFMediaTypeHandler_GetCurrentMediaType(handler, &mediatype);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(mediatype == mediatype2, "Unexpected instance.\n");
IMFMediaType_Release(mediatype);
IMFMediaType_Release(mediatype2);
/* Set partial type. */
hr = MFCreateMediaType(&mediatype);
ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
hr = IMFMediaType_GetGUID(mediatype2, &MF_MT_SUBTYPE, &guid);
ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr);
hr = IMFMediaType_SetGUID(mediatype, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
hr = IMFMediaType_SetGUID(mediatype, &MF_MT_SUBTYPE, &guid);
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, mediatype);
ok(hr == S_OK, "Failed to set current type, hr %#x.\n", hr);
hr = IMFMediaTypeHandler_GetCurrentMediaType(handler, &mediatype2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(mediatype == mediatype2, "Unexpected instance.\n");
IMFMediaType_Release(mediatype2);
hr = IMFMediaType_GetCount(mediatype, &count);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(count == 2, "Unexpected attribute count %u.\n", count);
IMFMediaType_Release(mediatype);
/* Reset back to uninitialized state. */
hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
IMFMediaTypeHandler_Release(handler);
}
IMFStreamSink_Release(stream_sink);