quartz/tests: Clean up tests for video renderer filter interfaces.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c6ff0e0122
commit
d8f54a7104
|
@ -19,71 +19,60 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
|
||||||
#include "wine/test.h"
|
|
||||||
#include "dshow.h"
|
#include "dshow.h"
|
||||||
|
#include "wine/test.h"
|
||||||
|
|
||||||
#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
|
static IBaseFilter *create_video_renderer(void)
|
||||||
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
|
{
|
||||||
ok(ppv != NULL, "Pointer is NULL\n");
|
IBaseFilter *filter = NULL;
|
||||||
|
HRESULT hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
|
||||||
#define RELEASE_EXPECT(iface, num) if (iface) { \
|
&IID_IBaseFilter, (void **)&filter);
|
||||||
hr = IUnknown_Release((IUnknown*)iface); \
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IUnknown *pVideoRenderer = NULL;
|
#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)
|
||||||
static int create_video_renderer(void)
|
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
IUnknown *iface = iface_ptr;
|
||||||
|
HRESULT hr, expected_hr;
|
||||||
|
IUnknown *unk;
|
||||||
|
|
||||||
hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
|
expected_hr = supported ? S_OK : E_NOINTERFACE;
|
||||||
&IID_IUnknown, (LPVOID*)&pVideoRenderer);
|
|
||||||
return (hr == S_OK && pVideoRenderer != NULL);
|
hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
|
||||||
|
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
IUnknown_Release(unk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_video_renderer(void)
|
static void test_interfaces(void)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
IBaseFilter *filter = create_video_renderer();
|
||||||
|
|
||||||
hr = IUnknown_Release(pVideoRenderer);
|
check_interface(filter, &IID_IBaseFilter, TRUE);
|
||||||
ok(hr == 0, "IUnknown_Release failed with %x\n", hr);
|
check_interface(filter, &IID_IBasicVideo, TRUE);
|
||||||
}
|
todo_wine check_interface(filter, &IID_IBasicVideo2, TRUE);
|
||||||
|
todo_wine check_interface(filter, &IID_IDirectDrawVideo, TRUE);
|
||||||
|
todo_wine check_interface(filter, &IID_IKsPropertySet, TRUE);
|
||||||
|
check_interface(filter, &IID_IMediaFilter, TRUE);
|
||||||
|
check_interface(filter, &IID_IMediaPosition, TRUE);
|
||||||
|
check_interface(filter, &IID_IMediaSeeking, TRUE);
|
||||||
|
check_interface(filter, &IID_IPersist, TRUE);
|
||||||
|
check_interface(filter, &IID_IQualityControl, TRUE);
|
||||||
|
todo_wine check_interface(filter, &IID_IQualProp, TRUE);
|
||||||
|
check_interface(filter, &IID_IUnknown, TRUE);
|
||||||
|
check_interface(filter, &IID_IVideoWindow, TRUE);
|
||||||
|
|
||||||
static void test_query_interface(void)
|
todo_wine check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
|
||||||
{
|
check_interface(filter, &IID_IBasicAudio, FALSE);
|
||||||
HRESULT hr;
|
check_interface(filter, &IID_IDispatch, FALSE);
|
||||||
IBaseFilter *pBaseFilter = NULL;
|
check_interface(filter, &IID_IOverlay, FALSE);
|
||||||
IBasicVideo *pBasicVideo = NULL;
|
check_interface(filter, &IID_IPersistPropertyBag, FALSE);
|
||||||
IDirectDrawVideo *pDirectDrawVideo = NULL;
|
check_interface(filter, &IID_IPin, FALSE);
|
||||||
IKsPropertySet *pKsPropertySet = NULL;
|
check_interface(filter, &IID_IReferenceClock, FALSE);
|
||||||
IMediaPosition *pMediaPosition = NULL;
|
|
||||||
IMediaSeeking *pMediaSeeking = NULL;
|
|
||||||
IQualityControl *pQualityControl = NULL;
|
|
||||||
IQualProp *pQualProp = NULL;
|
|
||||||
IVideoWindow *pVideoWindow = NULL;
|
|
||||||
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IBaseFilter, pBaseFilter);
|
IBaseFilter_Release(filter);
|
||||||
RELEASE_EXPECT(pBaseFilter, 1);
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IBasicVideo, pBasicVideo);
|
|
||||||
RELEASE_EXPECT(pBasicVideo, 1);
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IMediaSeeking, pMediaSeeking);
|
|
||||||
RELEASE_EXPECT(pMediaSeeking, 1);
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IQualityControl, pQualityControl);
|
|
||||||
RELEASE_EXPECT(pQualityControl, 1);
|
|
||||||
todo_wine {
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IDirectDrawVideo, pDirectDrawVideo);
|
|
||||||
RELEASE_EXPECT(pDirectDrawVideo, 1);
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IKsPropertySet, pKsPropertySet);
|
|
||||||
RELEASE_EXPECT(pKsPropertySet, 1);
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IQualProp, pQualProp);
|
|
||||||
RELEASE_EXPECT(pQualProp, 1);
|
|
||||||
}
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IMediaPosition, pMediaPosition);
|
|
||||||
RELEASE_EXPECT(pMediaPosition, 1);
|
|
||||||
QI_SUCCEED(pVideoRenderer, IID_IVideoWindow, pVideoWindow);
|
|
||||||
RELEASE_EXPECT(pVideoWindow, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_pin(IPin *pin)
|
static void test_pin(IPin *pin)
|
||||||
|
@ -105,19 +94,11 @@ static void test_pin(IPin *pin)
|
||||||
static void test_basefilter(void)
|
static void test_basefilter(void)
|
||||||
{
|
{
|
||||||
IEnumPins *pin_enum = NULL;
|
IEnumPins *pin_enum = NULL;
|
||||||
IBaseFilter *base = NULL;
|
IBaseFilter *base = create_video_renderer();
|
||||||
IPin *pins[2];
|
IPin *pins[2];
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
IUnknown_QueryInterface(pVideoRenderer, &IID_IBaseFilter, (void **)&base);
|
|
||||||
if (base == NULL)
|
|
||||||
{
|
|
||||||
/* test_query_interface handles this case */
|
|
||||||
skip("No IBaseFilter\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = IBaseFilter_EnumPins(base, NULL);
|
hr = IBaseFilter_EnumPins(base, NULL);
|
||||||
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
|
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
|
||||||
|
|
||||||
|
@ -153,13 +134,9 @@ static void test_basefilter(void)
|
||||||
START_TEST(videorenderer)
|
START_TEST(videorenderer)
|
||||||
{
|
{
|
||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
if (!create_video_renderer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
test_query_interface();
|
test_interfaces();
|
||||||
test_basefilter();
|
test_basefilter();
|
||||||
|
|
||||||
release_video_renderer();
|
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue