Commit 9c2dbb55 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap/tests: Clean up test_AviMux_QueryInterface().

parent 554ba1e4
......@@ -4,6 +4,7 @@ IMPORTS = strmiids uuid oleaut32 ole32 advapi32 msvfw32
C_SRCS = \
audiorecord.c \
avico.c \
avimux.c \
qcap.c \
smartteefilter.c \
videocapture.c
/*
* AVI muxer filter unit tests
*
* Copyright 2018 Zebediah Figura
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "dshow.h"
#include "vfw.h"
#include "wine/test.h"
static IBaseFilter *create_avi_mux(void)
{
IBaseFilter *filter = NULL;
HRESULT hr = CoCreateInstance(&CLSID_AviDest, NULL, CLSCTX_INPROC_SERVER,
&IID_IBaseFilter, (void **)&filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
return filter;
}
#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 *iface = iface_ptr;
HRESULT hr, expected_hr;
IUnknown *unk;
expected_hr = supported ? S_OK : E_NOINTERFACE;
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 test_interfaces(void)
{
IBaseFilter *filter = create_avi_mux();
check_interface(filter, &IID_IBaseFilter, TRUE);
check_interface(filter, &IID_IConfigAviMux, TRUE);
check_interface(filter, &IID_IConfigInterleaving, TRUE);
check_interface(filter, &IID_IMediaFilter, TRUE);
check_interface(filter, &IID_IMediaSeeking, TRUE);
check_interface(filter, &IID_IPersist, TRUE);
check_interface(filter, &IID_IPersistMediaPropertyBag, TRUE);
check_interface(filter, &IID_ISpecifyPropertyPages, 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_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(avimux)
{
CoInitialize(NULL);
test_interfaces();
CoUninitialize();
}
......@@ -1131,46 +1131,6 @@ static void init_test_filter(test_filter *This, PIN_DIRECTION dir, filter_type t
This->filter_type = type;
}
static void test_AviMux_QueryInterface(void)
{
IUnknown *avimux, *unk;
HRESULT hr;
hr = CoCreateInstance(&CLSID_AviDest, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&avimux);
ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG),
"couldn't create AVI Mux filter, hr = %08x\n", hr);
if(hr != S_OK) {
win_skip("AVI Mux filter is not registered\n");
return;
}
hr = IUnknown_QueryInterface(avimux, &IID_IBaseFilter, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IBaseFilter) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IConfigAviMux, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IConfigAviMux) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IConfigInterleaving, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IConfigInterleaving) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IMediaSeeking, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IMediaSeeking) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IPersistMediaPropertyBag, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IPersistMediaPropertyBag) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_ISpecifyPropertyPages, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_ISpecifyPropertyPages) failed: %x\n", hr);
IUnknown_Release(unk);
IUnknown_Release(avimux);
}
static HRESULT WINAPI MemAllocator_QueryInterface(IMemAllocator *iface, REFIID riid, void **ppvObject)
{
if(IsEqualIID(riid, &IID_IUnknown)) {
......@@ -1867,7 +1827,6 @@ START_TEST(qcap)
arg_c = winetest_get_mainargs(&arg_v);
test_AviMux_QueryInterface();
test_AviMux(arg_c>2 ? arg_v[2] : NULL);
test_COM_vfwcapture();
......
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