Anton Baskanov : quartz/tests: Don't fail tests when MPEG audio decoder creation fails.
Alexandre Julliard
julliard at winehq.org
Fri May 6 15:38:39 CDT 2022
Module: wine
Branch: master
Commit: b18b7260a2fc7543f47febc3f97021f4dd67ba54
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b18b7260a2fc7543f47febc3f97021f4dd67ba54
Author: Anton Baskanov <baskanov at gmail.com>
Date: Thu May 5 17:24:32 2022 -0500
quartz/tests: Don't fail tests when MPEG audio decoder creation fails.
Signed-off-by: Anton Baskanov <baskanov at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/tests/mpegaudio.c | 60 +++++++++++--------------------------------
1 file changed, 15 insertions(+), 45 deletions(-)
diff --git a/dlls/quartz/tests/mpegaudio.c b/dlls/quartz/tests/mpegaudio.c
index 296f5f479a0..a43adfbbd6d 100644
--- a/dlls/quartz/tests/mpegaudio.c
+++ b/dlls/quartz/tests/mpegaudio.c
@@ -216,16 +216,9 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
static void test_interfaces(void)
{
- IBaseFilter *filter;
+ IBaseFilter *filter = create_mpeg_audio_codec();
IPin *pin;
- filter = create_mpeg_audio_codec();
- if (!filter)
- {
- skip("Failed to create MPEG audio decoder instance, skipping tests.\n");
- return;
- }
-
check_interface(filter, &IID_IBaseFilter, TRUE);
check_interface(filter, &IID_IMediaFilter, TRUE);
check_interface(filter, &IID_IPersist, TRUE);
@@ -322,11 +315,6 @@ static void test_aggregation(void)
hr = CoCreateInstance(&CLSID_CMpegAudioCodec, &test_outer, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&unk);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
- if (FAILED(hr))
- {
- skip("Failed to create MPEG audio decoder instance, skipping tests.\n");
- return;
- }
ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
ref = get_refcount(unk);
@@ -372,18 +360,11 @@ static void test_aggregation(void)
static void test_unconnected_filter_state(void)
{
- IBaseFilter *filter;
+ IBaseFilter *filter = create_mpeg_audio_codec();
FILTER_STATE state;
HRESULT hr;
ULONG ref;
- filter = create_mpeg_audio_codec();
- if (!filter)
- {
- skip("Failed to create MPEG audio decoder instance, skipping tests.\n");
- return;
- }
-
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
@@ -436,19 +417,12 @@ static void test_unconnected_filter_state(void)
static void test_enum_pins(void)
{
- IBaseFilter *filter;
+ IBaseFilter *filter = create_mpeg_audio_codec();
IEnumPins *enum1, *enum2;
ULONG count, ref;
IPin *pins[3];
HRESULT hr;
- filter = create_mpeg_audio_codec();
- if (!filter)
- {
- skip("Failed to create MPEG audio decoder instance, skipping tests.\n");
- return;
- }
-
ref = get_refcount(filter);
ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
@@ -564,19 +538,12 @@ static void test_enum_pins(void)
static void test_find_pin(void)
{
- IBaseFilter *filter;
+ IBaseFilter *filter = create_mpeg_audio_codec();
IEnumPins *enum_pins;
IPin *pin, *pin2;
HRESULT hr;
ULONG ref;
- filter = create_mpeg_audio_codec();
- if (!filter)
- {
- skip("Failed to create MPEG audio decoder instance, skipping tests.\n");
- return;
- }
-
hr = IBaseFilter_EnumPins(filter, &enum_pins);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
@@ -612,7 +579,7 @@ static void test_find_pin(void)
static void test_pin_info(void)
{
- IBaseFilter *filter;
+ IBaseFilter *filter = create_mpeg_audio_codec();
PIN_DIRECTION dir;
PIN_INFO info;
HRESULT hr;
@@ -620,13 +587,6 @@ static void test_pin_info(void)
ULONG ref;
IPin *pin;
- filter = create_mpeg_audio_codec();
- if (!filter)
- {
- skip("Failed to create MPEG audio decoder instance, skipping tests.\n");
- return;
- }
-
hr = IBaseFilter_FindPin(filter, L"In", &pin);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
ref = get_refcount(filter);
@@ -1393,8 +1353,18 @@ static void test_connect_pin(void)
START_TEST(mpegaudio)
{
+ IBaseFilter *filter;
+
CoInitialize(NULL);
+ if (FAILED(CoCreateInstance(&CLSID_CMpegAudioCodec, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IBaseFilter, (void **)&filter)))
+ {
+ skip("Failed to create MPEG audio decoder instance.\n");
+ return;
+ }
+ IBaseFilter_Release(filter);
+
test_interfaces();
test_aggregation();
test_unconnected_filter_state();
More information about the wine-cvs
mailing list