Module: wine Branch: master Commit: 94c78064818b7174011493dea19ae90d4d29d14d URL: http://source.winehq.org/git/wine.git/?a=commit;h=94c78064818b7174011493dea1...
Author: Damjan Jovanovic damjan.jov@gmail.com Date: Sat Jul 6 14:46:32 2013 +0200
qcap/tests: Add a smart tee filter test.
---
configure | 1 + configure.ac | 1 + dlls/qcap/tests/Makefile.in | 7 +++ dlls/qcap/tests/qcap.c | 112 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 0 deletions(-)
diff --git a/configure b/configure index e977551..d1cb532 100755 --- a/configure +++ b/configure @@ -16153,6 +16153,7 @@ wine_fn_config_dll psapi enable_psapi implib wine_fn_config_test dlls/psapi/tests psapi_test wine_fn_config_dll pstorec enable_pstorec wine_fn_config_dll qcap enable_qcap +wine_fn_config_test dlls/qcap/tests qcap_test wine_fn_config_dll qedit enable_qedit wine_fn_config_test dlls/qedit/tests qedit_test wine_fn_config_dll qmgr enable_qmgr diff --git a/configure.ac b/configure.ac index 74fd134..0ebc688 100644 --- a/configure.ac +++ b/configure.ac @@ -2978,6 +2978,7 @@ WINE_CONFIG_DLL(psapi,,[implib]) WINE_CONFIG_TEST(dlls/psapi/tests) WINE_CONFIG_DLL(pstorec) WINE_CONFIG_DLL(qcap) +WINE_CONFIG_TEST(dlls/qcap/tests) WINE_CONFIG_DLL(qedit) WINE_CONFIG_TEST(dlls/qedit/tests) WINE_CONFIG_DLL(qmgr) diff --git a/dlls/qcap/tests/Makefile.in b/dlls/qcap/tests/Makefile.in new file mode 100644 index 0000000..9658b2d --- /dev/null +++ b/dlls/qcap/tests/Makefile.in @@ -0,0 +1,7 @@ +TESTDLL = qcap.dll +IMPORTS = strmiids uuid oleaut32 ole32 advapi32 + +C_SRCS = \ + qcap.c + +@MAKE_TEST_RULES@ diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c new file mode 100644 index 0000000..48e3797 --- /dev/null +++ b/dlls/qcap/tests/qcap.c @@ -0,0 +1,112 @@ +/* + * QCAP tests + * + * Copyright 2013 Damjan Jovanovic + * + * 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 + */ + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#define COBJMACROS +#include <dshow.h> +#include <guiddef.h> +#include <devguid.h> +#include <stdio.h> + +#include "wine/strmbase.h" +#include "wine/test.h" + +static void test_smart_tee_filter(void) +{ + HRESULT hr; + IBaseFilter *smartTeeFilter = NULL; + IEnumPins *enumPins = NULL; + IPin *pin; + FILTER_INFO filterInfo; + int pinNumber = 0; + + hr = CoCreateInstance(&CLSID_SmartTee, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void**)&smartTeeFilter); + todo_wine ok(SUCCEEDED(hr), "couldn't create smart tee filter, hr=%08x\n", hr); + if (FAILED(hr)) + goto end; + + hr = IBaseFilter_QueryFilterInfo(smartTeeFilter, &filterInfo); + ok(SUCCEEDED(hr), "QueryFilterInfo failed, hr=%08x\n", hr); + if (FAILED(hr)) + goto end; + + ok(lstrlenW(filterInfo.achName) == 0, + "filter's name is meant to be empty but it's %s\n", wine_dbgstr_w(filterInfo.achName)); + + hr = IBaseFilter_EnumPins(smartTeeFilter, &enumPins); + ok(SUCCEEDED(hr), "cannot enum filter pins, hr=%08x\n", hr); + if (FAILED(hr)) + goto end; + + while (IEnumPins_Next(enumPins, 1, &pin, NULL) == S_OK) + { + PIN_INFO pinInfo; + hr = IPin_QueryPinInfo(pin, &pinInfo); + ok(SUCCEEDED(hr), "QueryPinInfo failed, hr=%08x\n", hr); + if (FAILED(hr)) + goto endwhile; + + if (pinNumber == 0) + { + static const WCHAR wszInput[] = {'I','n','p','u','t',0}; + ok(pinInfo.dir == PINDIR_INPUT, "pin 0 isn't an input pin\n"); + ok(!lstrcmpW(pinInfo.achName, wszInput), "pin 0 is called %s, not 'Input'\n", wine_dbgstr_w(pinInfo.achName)); + } + else if (pinNumber == 1) + { + static const WCHAR wszCapture[] = {'C','a','p','t','u','r','e',0}; + ok(pinInfo.dir == PINDIR_OUTPUT, "pin 1 isn't an output pin\n"); + ok(!lstrcmpW(pinInfo.achName, wszCapture), "pin 1 is called %s, not 'Capture'\n", wine_dbgstr_w(pinInfo.achName)); + } + else if (pinNumber == 2) + { + static const WCHAR wszPreview[] = {'P','r','e','v','i','e','w',0}; + ok(pinInfo.dir == PINDIR_OUTPUT, "pin 2 isn't an output pin\n"); + ok(!lstrcmpW(pinInfo.achName, wszPreview), "pin 2 is called %s, not 'Preview'\n", wine_dbgstr_w(pinInfo.achName)); + } + else + ok(0, "pin %d isn't supposed to exist\n", pinNumber); + + endwhile: + IPin_Release(pin); + pinNumber++; + } + +end: + if (smartTeeFilter) + IBaseFilter_Release(smartTeeFilter); + if (enumPins) + IEnumPins_Release(enumPins); +} + +START_TEST(qcap) +{ + if (SUCCEEDED(CoInitialize(NULL))) + { + test_smart_tee_filter(); + CoUninitialize(); + } + else + skip("CoInitialize failed\n"); +}