amstream/tests: Beginning of tests.

This commit is contained in:
Christian Costa 2009-04-13 10:07:35 +02:00 committed by Alexandre Julliard
parent 73eff344f0
commit b5dbbd4f3a
4 changed files with 114 additions and 0 deletions

9
configure vendored
View File

@ -24362,6 +24362,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/amstream/Makefile: dlls/amstream/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/amstream/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/amstream/tests/Makefile"
test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\
amstream/tests"
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/amstream/tests/Makefile: dlls/amstream/tests/Makefile.in dlls/Maketest.rules"
ac_config_files="$ac_config_files dlls/amstream/tests/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/appwiz.cpl/Makefile"
test "x$enable_appwiz_cpl" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
@ -28899,6 +28907,7 @@ do
"dlls/advpack/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/advpack/Makefile" ;;
"dlls/advpack/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/advpack/tests/Makefile" ;;
"dlls/amstream/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/amstream/Makefile" ;;
"dlls/amstream/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/amstream/tests/Makefile" ;;
"dlls/appwiz.cpl/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/appwiz.cpl/Makefile" ;;
"dlls/atl/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/atl/Makefile" ;;
"dlls/authz/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/authz/Makefile" ;;

View File

@ -1874,6 +1874,7 @@ WINE_CONFIG_MAKEFILE([dlls/advapi32/tests/Makefile],[dlls/Maketest.rules],[dlls]
WINE_CONFIG_MAKEFILE([dlls/advpack/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/advpack/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
WINE_CONFIG_MAKEFILE([dlls/amstream/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/amstream/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
WINE_CONFIG_MAKEFILE([dlls/appwiz.cpl/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/atl/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/authz/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])

View File

@ -0,0 +1,13 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = amstream.dll
IMPORTS = kernel32 oleaut32 ole32 quartz strmiids
CTESTS = \
amstream.c
@MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -0,0 +1,91 @@
/*
* Unit tests for MultiMedia Stream functions
*
* Copyright (C) 2009 Christian Costa
*
* 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 <assert.h>
#define COBJMACROS
#include "wine/test.h"
#include "amstream.h"
#define FILE_LEN 9
static const char fileA[FILE_LEN] = "test.avi";
IAMMultiMediaStream* pams;
static int create_ammultimediastream(void)
{
return S_OK == CoCreateInstance(
&CLSID_AMMultiMediaStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMultiMediaStream, (LPVOID*)&pams);
}
static void release_ammultimediastream(void)
{
IAMMultiMediaStream_Release(pams);
}
static void renderfile(const char * fileA)
{
HRESULT hr;
WCHAR fileW[FILE_LEN];
IGraphBuilder* pgraph;
MultiByteToWideChar(CP_ACP, 0, fileA, -1, fileW, FILE_LEN);
hr = IAMMultiMediaStream_GetFilterGraph(pams, &pgraph);
ok(hr==S_OK, "GetFilterGraph returned: %x\n", hr);
ok(pgraph==NULL, "Filtergraph should not be created yet\n");
if (pgraph)
IGraphBuilder_Release(pgraph);
hr = IAMMultiMediaStream_OpenFile(pams, fileW, 0);
ok(hr==S_OK, "OpenFile returned: %x\n", hr);
hr = IAMMultiMediaStream_GetFilterGraph(pams, &pgraph);
ok(hr==S_OK, "GetFilterGraph returned: %x\n", hr);
ok(pgraph!=NULL, "Filtergraph should be created\n");
if (pgraph)
IGraphBuilder_Release(pgraph);
}
static void test_render(void)
{
HANDLE h;
if (!create_ammultimediastream())
return;
h = CreateFileA(fileA, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
if (h != INVALID_HANDLE_VALUE) {
CloseHandle(h);
renderfile(fileA);
}
release_ammultimediastream();
}
START_TEST(amstream)
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
test_render();
CoUninitialize();
}