qcap/tests: Add a smart tee filter test.

This commit is contained in:
Damjan Jovanovic 2013-07-06 14:46:32 +02:00 committed by Alexandre Julliard
parent 14619e8626
commit 94c7806481
4 changed files with 121 additions and 0 deletions

1
configure vendored
View File

@ -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

View File

@ -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)

View File

@ -0,0 +1,7 @@
TESTDLL = qcap.dll
IMPORTS = strmiids uuid oleaut32 ole32 advapi32
C_SRCS = \
qcap.c
@MAKE_TEST_RULES@

112
dlls/qcap/tests/qcap.c Normal file
View File

@ -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");
}