Commit 486e6967 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

mfplat/tests: Add tests for MFCreateAMMediaTypeFromMFMediaType.

parent c763d1b1
......@@ -7534,6 +7534,44 @@ skip_tests:
IMFMediaType_Release(media_type);
}
static void test_MFCreateAMMediaTypeFromMFMediaType(void)
{
IMFMediaType *media_type;
AM_MEDIA_TYPE *am_type;
HRESULT hr;
hr = MFCreateMediaType(&media_type);
ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr);
hr = MFCreateAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type);
todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = MFCreateAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type);
todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = MFCreateAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type);
todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_PCM);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = MFCreateAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (hr != S_OK) goto skip_tests;
ok(IsEqualGUID(&am_type->majortype, &MFMediaType_Audio), "got %s.\n", debugstr_guid(&am_type->majortype));
ok(IsEqualGUID(&am_type->subtype, &MFAudioFormat_PCM), "got %s.\n", debugstr_guid(&am_type->subtype));
ok(IsEqualGUID(&am_type->formattype, &FORMAT_WaveFormatEx), "got %s.\n", debugstr_guid(&am_type->formattype));
ok(am_type->cbFormat == sizeof(WAVEFORMATEX), "got %lu\n", am_type->cbFormat);
CoTaskMemFree(am_type->pbFormat);
CoTaskMemFree(am_type);
skip_tests:
IMFMediaType_Release(media_type);
}
static void test_MFCreateDXSurfaceBuffer(void)
{
IDirect3DSurface9 *backbuffer = NULL, *surface;
......@@ -10279,6 +10317,7 @@ START_TEST(mfplat)
test_MFInitMediaTypeFromWaveFormatEx();
test_MFCreateMFVideoFormatFromMFMediaType();
test_MFInitAMMediaTypeFromMFMediaType();
test_MFCreateAMMediaTypeFromMFMediaType();
test_MFCreateDXSurfaceBuffer();
test_MFCreateTrackedSample();
test_MFFrameRateToAverageTimePerFrame();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment