Piotr Caban : msxml3/test: Added ISAXXMLReader test.
Alexandre Julliard
julliard at winehq.org
Wed Jul 9 06:10:21 CDT 2008
Module: wine
Branch: master
Commit: cabbe8fa35bc143aa34e805c45aa81b02d8a251d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cabbe8fa35bc143aa34e805c45aa81b02d8a251d
Author: Piotr Caban <piotr.caban at gmail.com>
Date: Tue Jul 8 20:53:43 2008 +0200
msxml3/test: Added ISAXXMLReader test.
---
dlls/msxml3/tests/Makefile.in | 1 +
dlls/msxml3/tests/saxreader.c | 221 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 222 insertions(+), 0 deletions(-)
diff --git a/dlls/msxml3/tests/Makefile.in b/dlls/msxml3/tests/Makefile.in
index 3376252..5e1740c 100644
--- a/dlls/msxml3/tests/Makefile.in
+++ b/dlls/msxml3/tests/Makefile.in
@@ -7,6 +7,7 @@ IMPORTS = oleaut32 ole32 user32 kernel32
CTESTS = \
domdoc.c \
+ saxreader.c \
schema.c \
xmldoc.c \
xmlelem.c
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
new file mode 100644
index 0000000..64ad625
--- /dev/null
+++ b/dlls/msxml3/tests/saxreader.c
@@ -0,0 +1,221 @@
+/*
+ * XML test
+ *
+ * Copyright 2008 Piotr Caban
+ *
+ * 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
+#define CONST_VTABLE
+
+#include <stdio.h>
+#include "windows.h"
+#include "ole2.h"
+#include "msxml2.h"
+#include "ocidl.h"
+
+#include "wine/test.h"
+
+typedef struct _contenthandler
+{
+ const struct ISAXContentHandlerVtbl *lpContentHandlerVtbl;
+} contenthandler;
+
+static inline contenthandler *impl_from_ISAXContentHandler(ISAXContentHandler *iface)
+{
+ return (contenthandler *)((char*)iface - FIELD_OFFSET(contenthandler, lpContentHandlerVtbl));
+}
+
+static HRESULT WINAPI contentHandler_QueryInterface(
+ ISAXContentHandler* iface,
+ REFIID riid,
+ void **ppvObject)
+{
+ *ppvObject = NULL;
+
+ if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ISAXContentHandler))
+ {
+ *ppvObject = iface;
+ }
+ else
+ {
+ return E_NOINTERFACE;
+ }
+
+ return S_OK;
+}
+
+static ULONG WINAPI contentHandler_AddRef(
+ ISAXContentHandler* iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI contentHandler_Release(
+ ISAXContentHandler* iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI contentHandler_putDocumentLocator(
+ ISAXContentHandler* iface,
+ ISAXLocator *pLocator)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_startDocument(
+ ISAXContentHandler* iface)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_endDocument(
+ ISAXContentHandler* iface)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_startPrefixMapping(
+ ISAXContentHandler* iface,
+ const WCHAR *pPrefix,
+ int nPrefix,
+ const WCHAR *pUri,
+ int nUri)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_endPrefixMapping(
+ ISAXContentHandler* iface,
+ const WCHAR *pPrefix,
+ int nPrefix)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_startElement(
+ ISAXContentHandler* iface,
+ const WCHAR *pNamespaceUri,
+ int nNamespaceUri,
+ const WCHAR *pLocalName,
+ int nLocalName,
+ const WCHAR *pQName,
+ int nQName,
+ ISAXAttributes *pAttr)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_endElement(
+ ISAXContentHandler* iface,
+ const WCHAR *pNamespaceUri,
+ int nNamespaceUri,
+ const WCHAR *pLocalName,
+ int nLocalName,
+ const WCHAR *pQName,
+ int nQName)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_characters(
+ ISAXContentHandler* iface,
+ const WCHAR *pChars,
+ int nChars)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_ignorableWhitespace(
+ ISAXContentHandler* iface,
+ const WCHAR *pChars,
+ int nChars)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_processingInstruction(
+ ISAXContentHandler* iface,
+ const WCHAR *pTarget,
+ int nTarget,
+ const WCHAR *pData,
+ int nData)
+{
+ return S_OK;
+}
+
+static HRESULT WINAPI contentHandler_skippedEntity(
+ ISAXContentHandler* iface,
+ const WCHAR *pName,
+ int nName)
+{
+ return S_OK;
+}
+
+
+static const ISAXContentHandlerVtbl contentHandlerVtbl =
+{
+ contentHandler_QueryInterface,
+ contentHandler_AddRef,
+ contentHandler_Release,
+ contentHandler_putDocumentLocator,
+ contentHandler_startDocument,
+ contentHandler_endDocument,
+ contentHandler_startPrefixMapping,
+ contentHandler_endPrefixMapping,
+ contentHandler_startElement,
+ contentHandler_endElement,
+ contentHandler_characters,
+ contentHandler_ignorableWhitespace,
+ contentHandler_processingInstruction,
+ contentHandler_skippedEntity
+};
+
+static ISAXContentHandler contentHandler = { &contentHandlerVtbl };
+
+
+static void test_saxreader(void)
+{
+ HRESULT hr;
+ ISAXXMLReader *reader = NULL;
+
+ hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER,
+ &IID_ISAXXMLReader, (LPVOID*)&reader);
+
+ if(FAILED(hr))
+ {
+ skip("Failed to create SAXXMLReader instance\n");
+ return;
+ }
+
+ hr = ISAXXMLReader_putContentHandler(reader, &contentHandler);
+ ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+
+ ISAXXMLReader_Release(reader);
+}
+
+START_TEST(saxreader)
+{
+ HRESULT hr;
+
+ hr = CoInitialize(NULL);
+ ok(hr == S_OK, "failed to init com\n");
+
+ test_saxreader();
+
+ CoUninitialize();
+}
More information about the wine-cvs
mailing list