Commit 42263f9a authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/tests: Clean up test_query_interface().

parent d9456cc9
/* /*
* Unit tests for the MPEG-1 stream splitter functions * MPEG-1 splitter filter unit tests
* *
* Copyright 2015 Anton Baskanov * Copyright 2015 Anton Baskanov
* *
...@@ -19,40 +19,64 @@ ...@@ -19,40 +19,64 @@
*/ */
#define COBJMACROS #define COBJMACROS
#include "wine/test.h"
#include "dshow.h" #include "dshow.h"
#include "wine/test.h"
static IUnknown *create_mpeg_splitter(void) static IBaseFilter *create_mpeg_splitter(void)
{ {
IUnknown *mpeg_splitter = NULL; IBaseFilter *filter = NULL;
HRESULT result = CoCreateInstance(&CLSID_MPEG1Splitter, NULL, CLSCTX_INPROC_SERVER, HRESULT hr = CoCreateInstance(&CLSID_MPEG1Splitter, NULL, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&mpeg_splitter); &IID_IBaseFilter, (void **)&filter);
ok(S_OK == result, "got 0x%08x\n", result); ok(hr == S_OK, "Got hr %#x.\n", hr);
return mpeg_splitter; return filter;
} }
static void test_query_interface(void) #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
{ {
IUnknown *mpeg_splitter = create_mpeg_splitter(); IUnknown *iface = iface_ptr;
HRESULT hr, expected_hr;
IAMStreamSelect *stream_select = NULL; IUnknown *unk;
HRESULT result = IUnknown_QueryInterface(
mpeg_splitter, &IID_IAMStreamSelect, (void **)&stream_select); expected_hr = supported ? S_OK : E_NOINTERFACE;
ok(S_OK == result, "got 0x%08x\n", result);
if (S_OK == result) hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
{ ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
IAMStreamSelect_Release(stream_select); if (SUCCEEDED(hr))
} IUnknown_Release(unk);
}
IUnknown_Release(mpeg_splitter);
static void test_interfaces(void)
{
IBaseFilter *filter = create_mpeg_splitter();
check_interface(filter, &IID_IAMStreamSelect, TRUE);
check_interface(filter, &IID_IBaseFilter, TRUE);
check_interface(filter, &IID_IPersist, TRUE);
check_interface(filter, &IID_IMediaFilter, TRUE);
check_interface(filter, &IID_IUnknown, TRUE);
check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
check_interface(filter, &IID_IBasicAudio, FALSE);
check_interface(filter, &IID_IBasicVideo, FALSE);
check_interface(filter, &IID_IKsPropertySet, FALSE);
check_interface(filter, &IID_IMediaPosition, FALSE);
check_interface(filter, &IID_IMediaSeeking, FALSE);
check_interface(filter, &IID_IPersistPropertyBag, FALSE);
check_interface(filter, &IID_IPin, FALSE);
check_interface(filter, &IID_IQualityControl, FALSE);
check_interface(filter, &IID_IQualProp, FALSE);
check_interface(filter, &IID_IReferenceClock, FALSE);
check_interface(filter, &IID_IVideoWindow, FALSE);
IBaseFilter_Release(filter);
} }
START_TEST(mpegsplit) START_TEST(mpegsplit)
{ {
CoInitialize(NULL); CoInitialize(NULL);
test_query_interface(); test_interfaces();
CoUninitialize(); CoUninitialize();
} }
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