msxml3/tests: Added more tests to ISAXXMLReader_putContentHandler and ISAXXMLReader_getContentHandler, added todo test for ISAXXMLReader_parse.

This commit is contained in:
Piotr Caban 2008-07-10 15:22:14 +02:00 committed by Alexandre Julliard
parent b2ebf709ff
commit 088f3eef9c
1 changed files with 42 additions and 13 deletions

View File

@ -29,6 +29,14 @@
#include "wine/test.h" #include "wine/test.h"
static const WCHAR szSimpleXML[] = {
'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','\"','1','.','0','\"',' ','?','>','\n',
'<','B','a','n','k','A','c','c','o','u','n','t','>','\n',
' ',' ',' ','<','N','u','m','b','e','r','>','1','2','3','4','<','/','N','u','m','b','e','r','>','\n',
' ',' ',' ','<','N','a','m','e','>','C','a','p','t','a','i','n',' ','A','h','a','b','<','/','N','a','m','e','>','\n',
'<','/','B','a','n','k','A','c','c','o','u','n','t','>','\n','\0'
};
typedef struct _contenthandler typedef struct _contenthandler
{ {
const struct ISAXContentHandlerVtbl *lpContentHandlerVtbl; const struct ISAXContentHandlerVtbl *lpContentHandlerVtbl;
@ -61,32 +69,32 @@ static HRESULT WINAPI contentHandler_QueryInterface(
static ULONG WINAPI contentHandler_AddRef( static ULONG WINAPI contentHandler_AddRef(
ISAXContentHandler* iface) ISAXContentHandler* iface)
{ {
return 2; return 2;
} }
static ULONG WINAPI contentHandler_Release( static ULONG WINAPI contentHandler_Release(
ISAXContentHandler* iface) ISAXContentHandler* iface)
{ {
return 1; return 1;
} }
static HRESULT WINAPI contentHandler_putDocumentLocator( static HRESULT WINAPI contentHandler_putDocumentLocator(
ISAXContentHandler* iface, ISAXContentHandler* iface,
ISAXLocator *pLocator) ISAXLocator *pLocator)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_startDocument( static HRESULT WINAPI contentHandler_startDocument(
ISAXContentHandler* iface) ISAXContentHandler* iface)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_endDocument( static HRESULT WINAPI contentHandler_endDocument(
ISAXContentHandler* iface) ISAXContentHandler* iface)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_startPrefixMapping( static HRESULT WINAPI contentHandler_startPrefixMapping(
@ -96,7 +104,7 @@ static HRESULT WINAPI contentHandler_startPrefixMapping(
const WCHAR *pUri, const WCHAR *pUri,
int nUri) int nUri)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_endPrefixMapping( static HRESULT WINAPI contentHandler_endPrefixMapping(
@ -104,7 +112,7 @@ static HRESULT WINAPI contentHandler_endPrefixMapping(
const WCHAR *pPrefix, const WCHAR *pPrefix,
int nPrefix) int nPrefix)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_startElement( static HRESULT WINAPI contentHandler_startElement(
@ -117,7 +125,7 @@ static HRESULT WINAPI contentHandler_startElement(
int nQName, int nQName,
ISAXAttributes *pAttr) ISAXAttributes *pAttr)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_endElement( static HRESULT WINAPI contentHandler_endElement(
@ -129,7 +137,7 @@ static HRESULT WINAPI contentHandler_endElement(
const WCHAR *pQName, const WCHAR *pQName,
int nQName) int nQName)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_characters( static HRESULT WINAPI contentHandler_characters(
@ -137,7 +145,7 @@ static HRESULT WINAPI contentHandler_characters(
const WCHAR *pChars, const WCHAR *pChars,
int nChars) int nChars)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_ignorableWhitespace( static HRESULT WINAPI contentHandler_ignorableWhitespace(
@ -145,7 +153,7 @@ static HRESULT WINAPI contentHandler_ignorableWhitespace(
const WCHAR *pChars, const WCHAR *pChars,
int nChars) int nChars)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_processingInstruction( static HRESULT WINAPI contentHandler_processingInstruction(
@ -155,7 +163,7 @@ static HRESULT WINAPI contentHandler_processingInstruction(
const WCHAR *pData, const WCHAR *pData,
int nData) int nData)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI contentHandler_skippedEntity( static HRESULT WINAPI contentHandler_skippedEntity(
@ -163,7 +171,7 @@ static HRESULT WINAPI contentHandler_skippedEntity(
const WCHAR *pName, const WCHAR *pName,
int nName) int nName)
{ {
return S_OK; return S_OK;
} }
@ -192,6 +200,8 @@ static void test_saxreader(void)
{ {
HRESULT hr; HRESULT hr;
ISAXXMLReader *reader = NULL; ISAXXMLReader *reader = NULL;
VARIANT var;
ISAXContentHandler *lpContentHandler;
hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER,
&IID_ISAXXMLReader, (LPVOID*)&reader); &IID_ISAXXMLReader, (LPVOID*)&reader);
@ -202,9 +212,28 @@ static void test_saxreader(void)
return; return;
} }
hr = ISAXXMLReader_getContentHandler(reader, &lpContentHandler);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(lpContentHandler == NULL, "Expected %p, got %p\n", NULL, lpContentHandler);
hr = ISAXXMLReader_putContentHandler(reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = ISAXXMLReader_putContentHandler(reader, &contentHandler); hr = ISAXXMLReader_putContentHandler(reader, &contentHandler);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = ISAXXMLReader_getContentHandler(reader, &lpContentHandler);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(lpContentHandler == &contentHandler, "Expected %p, got %p\n", &contentHandler, lpContentHandler);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(szSimpleXML);
hr = ISAXXMLReader_parse(reader, var);
todo_wine {
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
}
ISAXXMLReader_Release(reader); ISAXXMLReader_Release(reader);
} }