[PATCH] amstream/tests: Beginning of tests.
Christian Costa
titan.costa at wanadoo.fr
Mon Apr 13 03:07:35 CDT 2009
---
configure.ac | 1
dlls/amstream/tests/Makefile.in | 13 ++++++
dlls/amstream/tests/amstream.c | 91 +++++++++++++++++++++++++++++++++++++++
3 files changed, 105 insertions(+), 0 deletions(-)
create mode 100644 dlls/amstream/tests/Makefile.in
create mode 100644 dlls/amstream/tests/amstream.c
-------------- next part --------------
diff --git a/configure.ac b/configure.ac
index e6d9688..1ef3191 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/Makedll.rules],[dlls],[ALL_DLL_DIRS])
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..85f290f
--- /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-patches
mailing list