quartz/tests: Test filter mapper interfaces.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cecd09ceb9
commit
e1c57c27cd
|
@ -27,6 +27,15 @@
|
||||||
#include "initguid.h"
|
#include "initguid.h"
|
||||||
#include "wine/fil_data.h"
|
#include "wine/fil_data.h"
|
||||||
|
|
||||||
|
static IFilterMapper3 *create_mapper(void)
|
||||||
|
{
|
||||||
|
IFilterMapper3 *ret;
|
||||||
|
HRESULT hr;
|
||||||
|
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper3, (void **)&ret);
|
||||||
|
ok(hr == S_OK, "Failed to create filter mapper, hr %#x.\n", hr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static ULONG get_refcount(void *iface)
|
static ULONG get_refcount(void *iface)
|
||||||
{
|
{
|
||||||
IUnknown *unknown = iface;
|
IUnknown *unknown = iface;
|
||||||
|
@ -34,6 +43,36 @@ static ULONG get_refcount(void *iface)
|
||||||
return IUnknown_Release(unknown);
|
return IUnknown_Release(unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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)
|
||||||
|
{
|
||||||
|
IFilterMapper3 *mapper = create_mapper();
|
||||||
|
|
||||||
|
check_interface(mapper, &IID_IAMFilterData, TRUE);
|
||||||
|
check_interface(mapper, &IID_IFilterMapper, TRUE);
|
||||||
|
check_interface(mapper, &IID_IFilterMapper2, TRUE);
|
||||||
|
check_interface(mapper, &IID_IFilterMapper3, TRUE);
|
||||||
|
check_interface(mapper, &IID_IUnknown, TRUE);
|
||||||
|
|
||||||
|
check_interface(mapper, &IID_IFilterGraph, FALSE);
|
||||||
|
|
||||||
|
IFilterMapper3_Release(mapper);
|
||||||
|
}
|
||||||
|
|
||||||
/* Helper function, checks if filter with given name was enumerated. */
|
/* Helper function, checks if filter with given name was enumerated. */
|
||||||
static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum)
|
static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum)
|
||||||
{
|
{
|
||||||
|
@ -624,6 +663,7 @@ START_TEST(filtermapper)
|
||||||
{
|
{
|
||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
test_interfaces();
|
||||||
test_fm2_enummatchingfilters();
|
test_fm2_enummatchingfilters();
|
||||||
test_legacy_filter_registration();
|
test_legacy_filter_registration();
|
||||||
test_ifiltermapper_from_filtergraph();
|
test_ifiltermapper_from_filtergraph();
|
||||||
|
|
Loading…
Reference in New Issue