Nikolay Sivov : xmllite/tests: Add basic test structure for IXmlReader.

Alexandre Julliard julliard at winehq.org
Tue Jan 19 11:53:42 CST 2010


Module: wine
Branch: master
Commit: 80a546cad5ed23c3b430180ed4c943631b1d85a5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=80a546cad5ed23c3b430180ed4c943631b1d85a5

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Tue Jan 19 00:05:53 2010 +0300

xmllite/tests: Add basic test structure for IXmlReader.

---

 configure                      |    9 ++++
 configure.ac                   |    1 +
 dlls/xmllite/Makefile.in       |    1 +
 dlls/xmllite/reader.c          |   38 +++++++++++++++
 dlls/xmllite/tests/Makefile.in |   13 +++++
 dlls/xmllite/tests/reader.c    |  100 ++++++++++++++++++++++++++++++++++++++++
 dlls/xmllite/xmllite.spec      |    2 +-
 7 files changed, 163 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index b92e426..018a237 100755
--- a/configure
+++ b/configure
@@ -17409,6 +17409,14 @@ dlls/xmllite/Makefile: dlls/xmllite/Makefile.in dlls/Makedll.rules"
 ac_config_files="$ac_config_files dlls/xmllite/Makefile"
 
 ALL_MAKEFILES="$ALL_MAKEFILES \\
+	dlls/xmllite/tests/Makefile"
+test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\
+	xmllite/tests"
+ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
+dlls/xmllite/tests/Makefile: dlls/xmllite/tests/Makefile.in dlls/Maketest.rules"
+ac_config_files="$ac_config_files dlls/xmllite/tests/Makefile"
+
+ALL_MAKEFILES="$ALL_MAKEFILES \\
 	documentation/Makefile"
 test "x$enable_documentation" != xno && ALL_TOP_DIRS="$ALL_TOP_DIRS \\
 	documentation"
@@ -19218,6 +19226,7 @@ do
     "dlls/xinput1_3/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/xinput1_3/tests/Makefile" ;;
     "dlls/xinput9_1_0/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/xinput9_1_0/Makefile" ;;
     "dlls/xmllite/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/xmllite/Makefile" ;;
+    "dlls/xmllite/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/xmllite/tests/Makefile" ;;
     "documentation/Makefile") CONFIG_FILES="$CONFIG_FILES documentation/Makefile" ;;
     "fonts/Makefile") CONFIG_FILES="$CONFIG_FILES fonts/Makefile" ;;
     "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 943938b..01cf3a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2587,6 +2587,7 @@ WINE_CONFIG_MAKEFILE([dlls/xinput1_3/Makefile],[dlls/Makedll.rules],[dlls],[ALL_
 WINE_CONFIG_MAKEFILE([dlls/xinput1_3/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
 WINE_CONFIG_MAKEFILE([dlls/xinput9_1_0/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/xmllite/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
+WINE_CONFIG_MAKEFILE([dlls/xmllite/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
 WINE_CONFIG_MAKEFILE([documentation/Makefile],[Make.rules],[],[ALL_TOP_DIRS])
 WINE_CONFIG_MAKEFILE([fonts/Makefile],[Make.rules],[],[ALL_TOP_DIRS])
 WINE_CONFIG_MAKEFILE([include/Makefile],[Make.rules],[],[ALL_TOP_DIRS])
diff --git a/dlls/xmllite/Makefile.in b/dlls/xmllite/Makefile.in
index 17d8dd1..9268f7d 100644
--- a/dlls/xmllite/Makefile.in
+++ b/dlls/xmllite/Makefile.in
@@ -6,6 +6,7 @@ MODULE    = xmllite.dll
 IMPORTS   = kernel32
 
 C_SRCS = \
+	reader.c \
 	xmllite_main.c
 
 @MAKE_DLL_RULES@
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
new file mode 100644
index 0000000..76097a5
--- /dev/null
+++ b/dlls/xmllite/reader.c
@@ -0,0 +1,38 @@
+/*
+ * IXmlReader implementation
+ *
+ * Copyright 2010 Nikolay Sivov
+ *
+ * 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
+ */
+
+#define COBJMACROS
+
+#include <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "initguid.h"
+#include "objbase.h"
+#include "xmllite.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(xmllite);
+
+HRESULT WINAPI CreateXmlReader(REFIID riid, void **pObject, IMalloc *pMalloc)
+{
+    FIXME("(%s, %p, %p)\n", wine_dbgstr_guid(riid), pObject, pMalloc);
+    return E_NOTIMPL;
+}
diff --git a/dlls/xmllite/tests/Makefile.in b/dlls/xmllite/tests/Makefile.in
new file mode 100644
index 0000000..250c493
--- /dev/null
+++ b/dlls/xmllite/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = xmllite.dll
+IMPORTS   = kernel32 ole32
+
+CTESTS = \
+	reader.c
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c
new file mode 100644
index 0000000..4d95353
--- /dev/null
+++ b/dlls/xmllite/tests/reader.c
@@ -0,0 +1,100 @@
+/*
+ * XMLLite IXmlReader tests
+ *
+ * Copyright 2010 (C) Nikolay Sivov
+ *
+ * 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
+ */
+
+#define COBJMACROS
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+#include "xmllite.h"
+#include "initguid.h"
+#include "wine/test.h"
+
+DEFINE_GUID(IID_IXmlReader, 0x7279fc81, 0x709d, 0x4095, 0xb6, 0x3d, 0x69,
+                            0xfe, 0x4b, 0x0d, 0x90, 0x30);
+
+HRESULT WINAPI (*pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc);
+
+static BOOL init_pointers(void)
+{
+    /* don't free module here, it's to be unloaded on exit */
+    HMODULE mod = LoadLibraryA("xmllite.dll");
+
+    if (!mod)
+    {
+        win_skip("xmllite library not available\n");
+        return FALSE;
+    }
+
+    pCreateXmlReader = (void*)GetProcAddress(mod, "CreateXmlReader");
+    if (!pCreateXmlReader) return FALSE;
+
+    return TRUE;
+}
+
+static void test_reader_create(void)
+{
+    HRESULT hr;
+    IXmlReader *reader;
+    IMalloc *imalloc;
+
+    /* crashes native */
+    if (0)
+    {
+        hr = pCreateXmlReader(&IID_IXmlReader, NULL, NULL);
+        hr = pCreateXmlReader(NULL, (LPVOID*)&reader, NULL);
+    }
+
+    hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
+    todo_wine ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    if (hr != S_OK)
+    {
+        skip("Failed to create IXmlReader instance\n");
+        return;
+    }
+
+    hr = CoGetMalloc(1, &imalloc);
+    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+
+    hr = IMalloc_DidAlloc(imalloc, reader);
+    ok(hr != 1, "Expected 0 or -1, got %08x\n", hr);
+
+    IXmlReader_Release(reader);
+}
+
+START_TEST(reader)
+{
+    HRESULT r;
+
+    r = CoInitialize( NULL );
+    ok( r == S_OK, "failed to init com\n");
+
+    if (!init_pointers())
+    {
+       CoUninitialize();
+       return;
+    }
+
+    test_reader_create();
+
+    CoUninitialize();
+}
diff --git a/dlls/xmllite/xmllite.spec b/dlls/xmllite/xmllite.spec
index cf43637..9b5a84a 100644
--- a/dlls/xmllite/xmllite.spec
+++ b/dlls/xmllite/xmllite.spec
@@ -1,4 +1,4 @@
-@ stub CreateXmlReader
+@ stdcall CreateXmlReader(ptr ptr ptr)
 @ stub CreateXmlReaderInputWithEncodingCodePage
 @ stub CreateXmlReaderInputWithEncodingName
 @ stub CreateXmlWriter




More information about the wine-cvs mailing list