From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- configure | 1 + configure.ac | 1 + dlls/l3codecx.ax/tests/Makefile.in | 5 ++ dlls/l3codecx.ax/tests/l3codecx.c | 119 +++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 dlls/l3codecx.ax/tests/Makefile.in create mode 100644 dlls/l3codecx.ax/tests/l3codecx.c
diff --git a/configure b/configure index 541dcc931ab..a7f0df379e3 100755 --- a/configure +++ b/configure @@ -21612,6 +21612,7 @@ wine_fn_config_makefile dlls/ksuser enable_ksuser wine_fn_config_makefile dlls/ktmw32 enable_ktmw32 wine_fn_config_makefile dlls/l3codeca.acm enable_l3codeca_acm wine_fn_config_makefile dlls/l3codecx.ax enable_l3codecx_ax +wine_fn_config_makefile dlls/l3codecx.ax/tests enable_tests wine_fn_config_makefile dlls/light.msstyles enable_light_msstyles wine_fn_config_makefile dlls/loadperf enable_loadperf wine_fn_config_makefile dlls/localspl enable_localspl diff --git a/configure.ac b/configure.ac index 2b53c2c1152..9c6ac1cd2fa 100644 --- a/configure.ac +++ b/configure.ac @@ -2715,6 +2715,7 @@ WINE_CONFIG_MAKEFILE(dlls/ksuser) WINE_CONFIG_MAKEFILE(dlls/ktmw32) WINE_CONFIG_MAKEFILE(dlls/l3codeca.acm) WINE_CONFIG_MAKEFILE(dlls/l3codecx.ax) +WINE_CONFIG_MAKEFILE(dlls/l3codecx.ax/tests) WINE_CONFIG_MAKEFILE(dlls/light.msstyles) WINE_CONFIG_MAKEFILE(dlls/loadperf) WINE_CONFIG_MAKEFILE(dlls/localspl) diff --git a/dlls/l3codecx.ax/tests/Makefile.in b/dlls/l3codecx.ax/tests/Makefile.in new file mode 100644 index 00000000000..aad3f652f60 --- /dev/null +++ b/dlls/l3codecx.ax/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = l3codecx.ax +IMPORTS = ole32 strmiids uuid + +C_SRCS = \ + l3codecx.c diff --git a/dlls/l3codecx.ax/tests/l3codecx.c b/dlls/l3codecx.ax/tests/l3codecx.c new file mode 100644 index 00000000000..0fc958544d5 --- /dev/null +++ b/dlls/l3codecx.ax/tests/l3codecx.c @@ -0,0 +1,119 @@ +/* + * Copyright 2022 Anton Baskanov + * 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 "wine/test.h" + +#include "initguid.h" +DEFINE_GUID(CLSID_mpeg_layer3_decoder, 0x38be3000, 0xdbf4, 0x11d0, 0x86, 0x0e, 0x00, 0xa0, 0x24, 0xcf, 0xef, 0x6d); + +static IBaseFilter *create_mpeg_layer3_decoder(void) +{ + IBaseFilter *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_mpeg_layer3_decoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#lx.\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 %#lx, expected %#lx.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IBaseFilter *filter = create_mpeg_layer3_decoder(); + IPin *pin; + + check_interface(filter, &IID_IBaseFilter, TRUE); + check_interface(filter, &IID_IMediaFilter, TRUE); + check_interface(filter, &IID_IPersist, TRUE); + check_interface(filter, &IID_IUnknown, TRUE); + + check_interface(filter, &IID_IMpegAudioDecoder, FALSE); + 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_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); + check_interface(filter, &IID_IPersistPropertyBag, FALSE); + + IBaseFilter_FindPin(filter, L"In", &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + check_interface(pin, &IID_IPin, TRUE); + check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IMediaPosition, FALSE); + check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, L"Out", &pin); + + check_interface(pin, &IID_IPin, TRUE); + check_interface(pin, &IID_IMediaPosition, TRUE); + check_interface(pin, &IID_IMediaSeeking, TRUE); + check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IAsyncReader, FALSE); + + IPin_Release(pin); + + IBaseFilter_Release(filter); +} + +START_TEST(l3codecx) +{ + IBaseFilter *filter; + + CoInitialize(NULL); + + if (FAILED(CoCreateInstance(&CLSID_mpeg_layer3_decoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter))) + { + skip("Failed to create MPEG layer-3 decoder instance.\n"); + return; + } + IBaseFilter_Release(filter); + + test_interfaces(); + + CoUninitialize(); +}