Christian Costa : amstream/tests: Beginning of tests.
Alexandre Julliard
julliard at winehq.org
Tue Apr 14 16:00:00 CDT 2009
Module: wine
Branch: master
Commit: b5dbbd4f3a16d074f0bdff39077973efdffe6c55
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b5dbbd4f3a16d074f0bdff39077973efdffe6c55
Author: Christian Costa <titan.costa at wanadoo.fr>
Date: Mon Apr 13 10:07:35 2009 +0200
amstream/tests: Beginning of tests.
---
configure | 9 ++++
configure.ac | 1 +
dlls/amstream/tests/Makefile.in | 13 ++++++
dlls/amstream/tests/amstream.c | 91 +++++++++++++++++++++++++++++++++++++++
4 files changed, 114 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index ee42ce0..a98e04e 100755
--- a/configure
+++ b/configure
@@ -24363,6 +24363,14 @@ 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 \\
appwiz.cpl"
@@ -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" ;;
diff --git a/configure.ac b/configure.ac
index e6d9688..f156bbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/dlls/amstream/tests/Makefile.in b/dlls/amstream/tests/Makefile.in
new file mode 100644
index 0000000..07e98b4
--- /dev/null
+++ b/dlls/amstream/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+TESTDLL = amstream.dll
+IMPORTS = kernel32 oleaut32 ole32 quartz strmiids
+
+CTESTS = \
+ amstream.c
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
new file mode 100644
index 0000000..15b8a7b
--- /dev/null
+++ b/dlls/amstream/tests/amstream.c
@@ -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();
+}
More information about the wine-cvs
mailing list