msxml3/tests: Use wide string literals in more tests.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-10-05 14:55:00 +03:00 committed by Alexandre Julliard
parent 38844dc31e
commit 20e36dcb1b
5 changed files with 110 additions and 171 deletions

View File

@ -1444,8 +1444,6 @@ static void test_XMLHTTP(void)
static const char bodyA[] = "mode=Test"; static const char bodyA[] = "mode=Test";
static const char urlA[] = "http://test.winehq.org/tests/post.php"; static const char urlA[] = "http://test.winehq.org/tests/post.php";
static const char referertesturl[] = "http://test.winehq.org/tests/referer.php"; static const char referertesturl[] = "http://test.winehq.org/tests/referer.php";
static const WCHAR wszExpectedResponse[] = {'F','A','I','L','E','D',0};
static const WCHAR norefererW[] = {'n','o',' ','r','e','f','e','r','e','r',' ','s','e','t',0};
IXMLHttpRequest *xhr; IXMLHttpRequest *xhr;
IObjectWithSite *obj_site, *obj_site2; IObjectWithSite *obj_site, *obj_site2;
@ -1631,8 +1629,7 @@ static void test_XMLHTTP(void)
* not what the server expects */ * not what the server expects */
if(hr == S_OK) if(hr == S_OK)
{ {
ok(!memcmp(bstrResponse, wszExpectedResponse, sizeof(wszExpectedResponse)), ok(!memcmp(bstrResponse, L"FAILED", 7 * sizeof(WCHAR)), "Unexpected response %s.\n", wine_dbgstr_w(bstrResponse));
"expected %s, got %s\n", wine_dbgstr_w(wszExpectedResponse), wine_dbgstr_w(bstrResponse));
SysFreeString(bstrResponse); SysFreeString(bstrResponse);
} }
@ -1713,7 +1710,7 @@ static void test_XMLHTTP(void)
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLHttpRequest_get_responseText(xhr, &str); hr = IXMLHttpRequest_get_responseText(xhr, &str);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(str, norefererW), "got response text %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, L"no referer set"), "got response text %s\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
/* interaction with object site */ /* interaction with object site */

View File

@ -36,8 +36,6 @@
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/test.h" #include "wine/test.h"
static const WCHAR emptyW[] = {0};
#define EXPECT_HR(hr,hr_exp) \ #define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
@ -537,27 +535,22 @@ static void init_call_sequences(struct call_sequence **seq, int n)
seq[i] = heap_alloc_zero(sizeof(struct call_sequence)); seq[i] = heap_alloc_zero(sizeof(struct call_sequence));
} }
static const WCHAR szSimpleXML[] = { 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'
};
static const WCHAR carriage_ret_test[] = { L"<?xml version=\"1.0\" ?>\n"
'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','"','1','.','0','"','?','>','\r','\n', "<BankAccount>\n"
'<','B','a','n','k','A','c','c','o','u','n','t','>','\r','\n', " <Number>1234</Number>\n"
'\t','<','N','u','m','b','e','r','>','1','2','3','4','<','/','N','u','m','b','e','r','>','\r','\n', " <Name>Captain Ahab</Name>\n"
'\t','<','N','a','m','e','>','C','a','p','t','a','i','n',' ','A','h','a','b','<','/','N','a','m','e','>','\r','\n', "</BankAccount>\n";
'<','/','B','a','n','k','A','c','c','o','u','n','t','>','\r','\n','\0'
};
static const WCHAR szUtf16XML[] = { static const WCHAR carriage_ret_test[] =
'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','"','1','.','0','"',' ',
'e','n','c','o','d','i','n','g','=','"','U','T','F','-','1','6','"',' ', L"<?xml version=\"1.0\"?>\r\n"
's','t','a','n','d','a','l','o','n','e','=','"','n','o','"','?','>','\r','\n' "<BankAccount>\r\n\t<Number>1234</Number>\r\n\t"
}; "<Name>Captain Ahab</Name>\r\n"
"</BankAccount>\r\n";
static const WCHAR szUtf16XML[] = L"<?xml version=\"1.0\" encoding=\"UTF-16\" standalone=\"no\"?>\r\n";
static const CHAR szUtf16BOM[] = {0xff, 0xfe}; static const CHAR szUtf16BOM[] = {0xff, 0xfe};
@ -2150,7 +2143,6 @@ static void test_saxreader(void)
ULONG written; ULONG written;
HANDLE file; HANDLE file;
static const CHAR testXmlA[] = "test.xml"; static const CHAR testXmlA[] = "test.xml";
static const WCHAR testXmlW[] = {'t','e','s','t','.','x','m','l',0};
IXMLDOMDocument *doc; IXMLDOMDocument *doc;
char seqname[50]; char seqname[50];
VARIANT_BOOL v; VARIANT_BOOL v;
@ -2324,7 +2316,7 @@ static void test_saxreader(void)
else else
test_seq = content_handler_test1; test_seq = content_handler_test1;
set_expected_seq(test_seq); set_expected_seq(test_seq);
hr = ISAXXMLReader_parseURL(reader, testXmlW); hr = ISAXXMLReader_parseURL(reader, L"test.xml");
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "content test 1: from file url", FALSE); ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "content test 1: from file url", FALSE);
@ -2335,7 +2327,7 @@ static void test_saxreader(void)
else else
test_seq = content_handler_testerror; test_seq = content_handler_testerror;
set_expected_seq(test_seq); set_expected_seq(test_seq);
hr = ISAXXMLReader_parseURL(reader, testXmlW); hr = ISAXXMLReader_parseURL(reader, L"test.xml");
EXPECT_HR(hr, E_FAIL); EXPECT_HR(hr, E_FAIL);
ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "content test error", FALSE); ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "content test error", FALSE);
@ -2345,14 +2337,14 @@ static void test_saxreader(void)
{ {
test_seq = content_handler_test_callback_rets_alt; test_seq = content_handler_test_callback_rets_alt;
set_expected_seq(test_seq); set_expected_seq(test_seq);
hr = ISAXXMLReader_parseURL(reader, testXmlW); hr = ISAXXMLReader_parseURL(reader, L"test.xml");
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
} }
else else
{ {
test_seq = content_handler_test_callback_rets; test_seq = content_handler_test_callback_rets;
set_expected_seq(test_seq); set_expected_seq(test_seq);
hr = ISAXXMLReader_parseURL(reader, testXmlW); hr = ISAXXMLReader_parseURL(reader, L"test.xml");
EXPECT_HR(hr, S_FALSE); EXPECT_HR(hr, S_FALSE);
} }
ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "content callback ret values", FALSE); ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "content callback ret values", FALSE);
@ -2905,7 +2897,6 @@ static const struct enc_test_entry_t encoding_test_data[] = {
static void test_saxreader_encoding(void) static void test_saxreader_encoding(void)
{ {
const struct enc_test_entry_t *entry = encoding_test_data; const struct enc_test_entry_t *entry = encoding_test_data;
static const WCHAR testXmlW[] = {'t','e','s','t','.','x','m','l',0};
static const CHAR testXmlA[] = "test.xml"; static const CHAR testXmlA[] = "test.xml";
while (entry->guid) while (entry->guid)
@ -2929,7 +2920,7 @@ static void test_saxreader_encoding(void)
WriteFile(file, UTF8BOMTest, sizeof(UTF8BOMTest)-1, &written, NULL); WriteFile(file, UTF8BOMTest, sizeof(UTF8BOMTest)-1, &written, NULL);
CloseHandle(file); CloseHandle(file);
hr = ISAXXMLReader_parseURL(reader, testXmlW); hr = ISAXXMLReader_parseURL(reader, L"test.xml");
todo_wine_if(entry->todo) todo_wine_if(entry->todo)
ok(hr == entry->hr, "Expected 0x%08x, got 0x%08x. CLSID %s\n", entry->hr, hr, entry->clsid); ok(hr == entry->hr, "Expected 0x%08x, got 0x%08x. CLSID %s\n", entry->hr, hr, entry->clsid);
@ -3098,8 +3089,6 @@ static void test_mxwriter_default_properties(const struct mxwriter_props_t *tabl
static void test_mxwriter_properties(void) static void test_mxwriter_properties(void)
{ {
static const WCHAR utf16W[] = {'U','T','F','-','1','6',0};
static const WCHAR testW[] = {'t','e','s','t',0};
ISAXContentHandler *content; ISAXContentHandler *content;
IMXWriter *writer; IMXWriter *writer;
VARIANT_BOOL b; VARIANT_BOOL b;
@ -3144,7 +3133,7 @@ static void test_mxwriter_properties(void)
str = (void*)0xdeadbeef; str = (void*)0xdeadbeef;
hr = IMXWriter_get_encoding(writer, &str); hr = IMXWriter_get_encoding(writer, &str);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
ok(lstrcmpW(str, utf16W) == 0, "expected empty string, got %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, L"UTF-16"), "Unexpected string %s.\n", wine_dbgstr_w(str));
str2 = (void*)0xdeadbeef; str2 = (void*)0xdeadbeef;
hr = IMXWriter_get_encoding(writer, &str2); hr = IMXWriter_get_encoding(writer, &str2);
@ -3155,7 +3144,7 @@ static void test_mxwriter_properties(void)
SysFreeString(str); SysFreeString(str);
/* put empty string */ /* put empty string */
str = SysAllocString(emptyW); str = SysAllocString(L"");
hr = IMXWriter_put_encoding(writer, str); hr = IMXWriter_put_encoding(writer, str);
ok(hr == E_INVALIDARG, "got %08x\n", hr); ok(hr == E_INVALIDARG, "got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
@ -3167,7 +3156,7 @@ static void test_mxwriter_properties(void)
SysFreeString(str); SysFreeString(str);
/* invalid encoding name */ /* invalid encoding name */
str = SysAllocString(testW); str = SysAllocString(L"test");
hr = IMXWriter_put_encoding(writer, str); hr = IMXWriter_put_encoding(writer, str);
ok(hr == E_INVALIDARG, "got %08x\n", hr); ok(hr == E_INVALIDARG, "got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
@ -3346,7 +3335,7 @@ static void test_mxwriter_flush(void)
hr = ISAXContentHandler_startDocument(content); hr = ISAXContentHandler_startDocument(content);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0, _bstr_("a"), -1, NULL); hr = ISAXContentHandler_startElement(content, L"", 0, L"", 0, _bstr_("a"), -1, NULL);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
/* internal buffer is flushed automatically on certain threshold */ /* internal buffer is flushed automatically on certain threshold */
@ -3394,7 +3383,7 @@ static void test_mxwriter_flush(void)
hr = ISAXContentHandler_startDocument(content); hr = ISAXContentHandler_startDocument(content);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0, _bstr_("a"), -1, NULL); hr = ISAXContentHandler_startElement(content, L"", 0, L"", 0, _bstr_("a"), -1, NULL);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
pos.QuadPart = 0; pos.QuadPart = 0;
@ -3425,7 +3414,7 @@ static void test_mxwriter_flush(void)
hr = ISAXContentHandler_startDocument(content); hr = ISAXContentHandler_startDocument(content);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0, _bstr_("a"), -1, NULL); hr = ISAXContentHandler_startElement(content, L"", 0, L"", 0, _bstr_("a"), -1, NULL);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
memset(buff, 'A', len); memset(buff, 'A', len);
@ -3971,7 +3960,6 @@ static const struct writer_characters_t writer_characters[] = {
static void test_mxwriter_characters(void) static void test_mxwriter_characters(void)
{ {
static const WCHAR chardataW[] = {'T','E','S','T','C','H','A','R','D','A','T','A',' ','.',0};
static const WCHAR embedded_nullbytes[] = {'a',0,'b',0,0,0,'c',0}; static const WCHAR embedded_nullbytes[] = {'a',0,'b',0,0,0,'c',0};
const struct writer_characters_t *table = writer_characters; const struct writer_characters_t *table = writer_characters;
IVBSAXContentHandler *vb_content; IVBSAXContentHandler *vb_content;
@ -4001,14 +3989,14 @@ static void test_mxwriter_characters(void)
hr = ISAXContentHandler_characters(content, NULL, 0); hr = ISAXContentHandler_characters(content, NULL, 0);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXContentHandler_characters(content, chardataW, 0); hr = ISAXContentHandler_characters(content, L"TESTCHARDATA .", 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
str = _bstr_("VbChars"); str = _bstr_("VbChars");
hr = IVBSAXContentHandler_characters(vb_content, &str); hr = IVBSAXContentHandler_characters(vb_content, &str);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_characters(content, chardataW, ARRAY_SIZE(chardataW) - 1); hr = ISAXContentHandler_characters(content, L"TESTCHARDATA .", 14);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4042,7 +4030,7 @@ static void test_mxwriter_characters(void)
hr = ISAXContentHandler_startElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("a"), 1, NULL); hr = ISAXContentHandler_startElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("a"), 1, NULL);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_characters(content, chardataW, 0); hr = ISAXContentHandler_characters(content, L"TESTCHARDATA .", 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_endElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("a"), 1); hr = ISAXContentHandler_endElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("a"), 1);
@ -4198,14 +4186,14 @@ static const mxwriter_stream_test mxwriter_stream_tests[] = {
VARIANT_TRUE,"UTF-16", VARIANT_TRUE,"UTF-16",
{ {
{FALSE,(const BYTE*)szUtf16BOM,sizeof(szUtf16BOM),TRUE}, {FALSE,(const BYTE*)szUtf16BOM,sizeof(szUtf16BOM),TRUE},
{FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)}, {FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)-sizeof(WCHAR)},
{TRUE} {TRUE}
} }
}, },
{ {
VARIANT_FALSE,"UTF-16", VARIANT_FALSE,"UTF-16",
{ {
{FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)}, {FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)-sizeof(WCHAR)},
{TRUE} {TRUE}
} }
}, },
@ -4235,7 +4223,7 @@ static const mxwriter_stream_test mxwriter_stream_tests[] = {
VARIANT_TRUE,"UTF-16", VARIANT_TRUE,"UTF-16",
{ {
{FALSE,(const BYTE*)szUtf16BOM,sizeof(szUtf16BOM),TRUE}, {FALSE,(const BYTE*)szUtf16BOM,sizeof(szUtf16BOM),TRUE},
{FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)}, {FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)-sizeof(WCHAR)},
{TRUE} {TRUE}
} }
}, },
@ -4243,7 +4231,7 @@ static const mxwriter_stream_test mxwriter_stream_tests[] = {
VARIANT_TRUE,"UTF-16", VARIANT_TRUE,"UTF-16",
{ {
{FALSE,(const BYTE*)szUtf16BOM,sizeof(szUtf16BOM),TRUE,TRUE}, {FALSE,(const BYTE*)szUtf16BOM,sizeof(szUtf16BOM),TRUE,TRUE},
{FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)}, {FALSE,(const BYTE*)szUtf16XML,sizeof(szUtf16XML)-sizeof(WCHAR)},
{TRUE} {TRUE}
} }
} }
@ -4536,8 +4524,6 @@ static void test_mxwriter_encoding(void)
static void test_obj_dispex(IUnknown *obj) static void test_obj_dispex(IUnknown *obj)
{ {
static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0};
static const WCHAR starW[] = {'*',0};
DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE; DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE;
IDispatchEx *dispex; IDispatchEx *dispex;
IUnknown *unk; IUnknown *unk;
@ -4556,7 +4542,7 @@ static void test_obj_dispex(IUnknown *obj)
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
ok(ticnt == 1, "ticnt=%u\n", ticnt); ok(ticnt == 1, "ticnt=%u\n", ticnt);
name = SysAllocString(starW); name = SysAllocString(L"*");
hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive); hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
SysFreeString(name); SysFreeString(name);
@ -4581,7 +4567,7 @@ static void test_obj_dispex(IUnknown *obj)
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk); ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
name = SysAllocString(testW); name = SysAllocString(L"testprop");
hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &did); hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &did);
ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr); ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr);
SysFreeString(name); SysFreeString(name);
@ -4689,7 +4675,6 @@ static void test_mxwriter_dispex(void)
static void test_mxwriter_comment(void) static void test_mxwriter_comment(void)
{ {
static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0};
IVBSAXLexicalHandler *vblexical; IVBSAXLexicalHandler *vblexical;
ISAXContentHandler *content; ISAXContentHandler *content;
ISAXLexicalHandler *lexical; ISAXLexicalHandler *lexical;
@ -4722,7 +4707,7 @@ static void test_mxwriter_comment(void)
hr = IVBSAXLexicalHandler_comment(vblexical, NULL); hr = IVBSAXLexicalHandler_comment(vblexical, NULL);
EXPECT_HR(hr, E_POINTER); EXPECT_HR(hr, E_POINTER);
hr = ISAXLexicalHandler_comment(lexical, commentW, 0); hr = ISAXLexicalHandler_comment(lexical, L"comment", 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4732,7 +4717,7 @@ static void test_mxwriter_comment(void)
ok(!lstrcmpW(L"<!---->\r\n", V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest))); ok(!lstrcmpW(L"<!---->\r\n", V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest); VariantClear(&dest);
hr = ISAXLexicalHandler_comment(lexical, commentW, ARRAY_SIZE(commentW) - 1); hr = ISAXLexicalHandler_comment(lexical, L"comment", 7);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4813,8 +4798,6 @@ static void test_mxwriter_cdata(void)
static void test_mxwriter_pi(void) static void test_mxwriter_pi(void)
{ {
static const WCHAR targetW[] = {'t','a','r','g','e','t',0};
static const WCHAR dataW[] = {'d','a','t','a',0};
ISAXContentHandler *content; ISAXContentHandler *content;
IMXWriter *writer; IMXWriter *writer;
VARIANT dest; VARIANT dest;
@ -4830,10 +4813,10 @@ static void test_mxwriter_pi(void)
hr = ISAXContentHandler_processingInstruction(content, NULL, 0, NULL, 0); hr = ISAXContentHandler_processingInstruction(content, NULL, 0, NULL, 0);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXContentHandler_processingInstruction(content, targetW, 0, NULL, 0); hr = ISAXContentHandler_processingInstruction(content, L"target", 0, NULL, 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_processingInstruction(content, targetW, 6, NULL, 0); hr = ISAXContentHandler_processingInstruction(content, L"target", 6, NULL, 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4843,7 +4826,7 @@ static void test_mxwriter_pi(void)
ok(!lstrcmpW(L"<?\?>\r\n<?target?>\r\n", V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest))); ok(!lstrcmpW(L"<?\?>\r\n<?target?>\r\n", V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest); VariantClear(&dest);
hr = ISAXContentHandler_processingInstruction(content, targetW, 4, dataW, 4); hr = ISAXContentHandler_processingInstruction(content, L"target", 4, L"data", 4);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4857,7 +4840,7 @@ static void test_mxwriter_pi(void)
hr = IMXWriter_put_output(writer, dest); hr = IMXWriter_put_output(writer, dest);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_processingInstruction(content, targetW, 6, dataW, 0); hr = ISAXContentHandler_processingInstruction(content, L"target", 6, L"data", 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4874,7 +4857,6 @@ static void test_mxwriter_pi(void)
static void test_mxwriter_ignorablespaces(void) static void test_mxwriter_ignorablespaces(void)
{ {
static const WCHAR dataW[] = {'d','a','t','a',0};
ISAXContentHandler *content; ISAXContentHandler *content;
IMXWriter *writer; IMXWriter *writer;
VARIANT dest; VARIANT dest;
@ -4890,13 +4872,13 @@ static void test_mxwriter_ignorablespaces(void)
hr = ISAXContentHandler_ignorableWhitespace(content, NULL, 0); hr = ISAXContentHandler_ignorableWhitespace(content, NULL, 0);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXContentHandler_ignorableWhitespace(content, dataW, 0); hr = ISAXContentHandler_ignorableWhitespace(content, L"data", 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_ignorableWhitespace(content, dataW, 4); hr = ISAXContentHandler_ignorableWhitespace(content, L"data", 4);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXContentHandler_ignorableWhitespace(content, dataW, 1); hr = ISAXContentHandler_ignorableWhitespace(content, L"data", 1);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4912,10 +4894,6 @@ static void test_mxwriter_ignorablespaces(void)
static void test_mxwriter_dtd(void) static void test_mxwriter_dtd(void)
{ {
static const WCHAR contentW[] = {'c','o','n','t','e','n','t'};
static const WCHAR nameW[] = {'n','a','m','e'};
static const WCHAR pubW[] = {'p','u','b'};
static const WCHAR sysW[] = {'s','y','s'};
IVBSAXLexicalHandler *vblexical; IVBSAXLexicalHandler *vblexical;
ISAXContentHandler *content; ISAXContentHandler *content;
ISAXLexicalHandler *lexical; ISAXLexicalHandler *lexical;
@ -4957,16 +4935,16 @@ static void test_mxwriter_dtd(void)
hr = IVBSAXLexicalHandler_startDTD(vblexical, NULL, NULL, NULL); hr = IVBSAXLexicalHandler_startDTD(vblexical, NULL, NULL, NULL);
EXPECT_HR(hr, E_POINTER); EXPECT_HR(hr, E_POINTER);
hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), NULL, 0); hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, L"pub", 3, NULL, 0);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW, ARRAY_SIZE(sysW)); hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, L"sys", 3);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), sysW, ARRAY_SIZE(sysW)); hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, L"pub", 3, L"sys", 3);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), NULL, 0, NULL, 0); hr = ISAXLexicalHandler_startDTD(lexical, L"name", 4, NULL, 0, NULL, 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -4977,11 +4955,10 @@ static void test_mxwriter_dtd(void)
VariantClear(&dest); VariantClear(&dest);
/* system id is required if public is present */ /* system id is required if public is present */
hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), pubW, ARRAY_SIZE(pubW), NULL, 0); hr = ISAXLexicalHandler_startDTD(lexical, L"name", 4, L"pub", 3, NULL, 0);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), hr = ISAXLexicalHandler_startDTD(lexical, L"name", 4, L"pub", 3, L"sys", 3);
pubW, ARRAY_SIZE(pubW), sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -5018,10 +4995,10 @@ static void test_mxwriter_dtd(void)
hr = IVBSAXDeclHandler_elementDecl(vbdecl, NULL, NULL); hr = IVBSAXDeclHandler_elementDecl(vbdecl, NULL, NULL);
EXPECT_HR(hr, E_POINTER); EXPECT_HR(hr, E_POINTER);
hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), NULL, 0); hr = ISAXDeclHandler_elementDecl(decl, L"name", 4, NULL, 0);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW, ARRAY_SIZE(contentW)); hr = ISAXDeclHandler_elementDecl(decl, L"name", 4, L"content", 7);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -5036,7 +5013,7 @@ static void test_mxwriter_dtd(void)
hr = IMXWriter_put_output(writer, dest); hr = IMXWriter_put_output(writer, dest);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW, 0); hr = ISAXDeclHandler_elementDecl(decl, L"name", 4, L"content", 0);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY; V_VT(&dest) = VT_EMPTY;
@ -5609,11 +5586,6 @@ static struct msxmlsupported_data_t saxattr_support_data[] =
static void test_mxattr_localname(void) static void test_mxattr_localname(void)
{ {
static const WCHAR localname1W[] = {'l','o','c','a','l','n','a','m','e','1',0};
static const WCHAR localnameW[] = {'l','o','c','a','l','n','a','m','e',0};
static const WCHAR uri1W[] = {'u','r','i','1',0};
static const WCHAR uriW[] = {'u','r','i',0};
const struct msxmlsupported_data_t *table = saxattr_support_data; const struct msxmlsupported_data_t *table = saxattr_support_data;
while (table->clsid) while (table->clsid)
@ -5648,17 +5620,17 @@ static void test_mxattr_localname(void)
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
index = -1; index = -1;
hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localnameW, lstrlenW(localnameW), &index); hr = ISAXAttributes_getIndexFromName(saxattr, L"uri", 3, L"localname", 9, &index);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
ok(index == 0, "%s: got index %d\n", table->name, index); ok(index == 0, "%s: got index %d\n", table->name, index);
index = -1; index = -1;
hr = ISAXAttributes_getIndexFromName(saxattr, uri1W, lstrlenW(uri1W), localnameW, lstrlenW(localnameW), &index); hr = ISAXAttributes_getIndexFromName(saxattr, L"uri1", 4, L"localname", 9, &index);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
ok(index == -1, "%s: got index %d\n", table->name, index); ok(index == -1, "%s: got index %d\n", table->name, index);
index = -1; index = -1;
hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localname1W, lstrlenW(localname1W), &index); hr = ISAXAttributes_getIndexFromName(saxattr, L"uri", 3, L"localname1", 10, &index);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
ok(index == -1, "%s: got index %d\n", table->name, index); ok(index == -1, "%s: got index %d\n", table->name, index);
@ -5668,7 +5640,7 @@ static void test_mxattr_localname(void)
hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, NULL, 0, NULL); hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, NULL, 0, NULL);
EXPECT_HR(hr, E_POINTER); EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localname1W, lstrlenW(localname1W), NULL); hr = ISAXAttributes_getIndexFromName(saxattr, L"uri", 3, L"localname1", 10, NULL);
EXPECT_HR(hr, E_POINTER); EXPECT_HR(hr, E_POINTER);
} }
else else
@ -5676,14 +5648,14 @@ static void test_mxattr_localname(void)
hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, NULL, 0, NULL); hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, NULL, 0, NULL);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localname1W, lstrlenW(localname1W), NULL); hr = ISAXAttributes_getIndexFromName(saxattr, L"uri", 3, L"localname1", 10, NULL);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
} }
hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), NULL, 0, &index); hr = ISAXAttributes_getIndexFromName(saxattr, L"uri", 3, NULL, 0, &index);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, localname1W, lstrlenW(localname1W), &index); hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, L"localname1", 10, &index);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
table++; table++;
@ -5713,25 +5685,25 @@ static void test_mxwriter_indent(void)
hr = ISAXContentHandler_startDocument(content); hr = ISAXContentHandler_startDocument(content);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0, _bstr_("a"), -1, NULL); hr = ISAXContentHandler_startElement(content, L"", 0, L"", 0, _bstr_("a"), -1, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_characters(content, _bstr_(""), 0); hr = ISAXContentHandler_characters(content, _bstr_(""), 0);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0, _bstr_("b"), -1, NULL); hr = ISAXContentHandler_startElement(content, L"", 0, L"", 0, _bstr_("b"), -1, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0, _bstr_("c"), -1, NULL); hr = ISAXContentHandler_startElement(content, L"", 0, L"", 0, _bstr_("c"), -1, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_endElement(content, emptyW, 0, emptyW, 0, _bstr_("c"), -1); hr = ISAXContentHandler_endElement(content, L"", 0, L"", 0, _bstr_("c"), -1);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_endElement(content, emptyW, 0, emptyW, 0, _bstr_("b"), -1); hr = ISAXContentHandler_endElement(content, L"", 0, L"", 0, _bstr_("b"), -1);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_endElement(content, emptyW, 0, emptyW, 0, _bstr_("a"), -1); hr = ISAXContentHandler_endElement(content, L"", 0, L"", 0, _bstr_("a"), -1);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_endDocument(content); hr = ISAXContentHandler_endDocument(content);

View File

@ -37,14 +37,6 @@
#define EXPECT_HR(hr,hr_exp) \ #define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
static const WCHAR xdr_schema_uri[] = {'x','-','s','c','h','e','m','a',':','t','e','s','t','.','x','m','l',0};
static const WCHAR xdr_schema_xml[] = {
'<','S','c','h','e','m','a',' ','x','m','l','n','s','=','\"','u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','x','m','l','-','d','a','t','a','\"','\n',
'x','m','l','n','s',':','d','t','=','\"','u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','d','a','t','a','t','y','p','e','s','\"','>','\n',
'<','/','S','c','h','e','m','a','>','\n',0
};
static const CHAR xdr_schema1_uri[] = "x-schema:test1.xdr"; static const CHAR xdr_schema1_uri[] = "x-schema:test1.xdr";
static const CHAR xdr_schema1_xml[] = static const CHAR xdr_schema1_xml[] =
"<?xml version='1.0'?>" "<?xml version='1.0'?>"
@ -498,7 +490,8 @@ static void* _create_object(const GUID *clsid, const char *name, const IID *iid,
static void test_schema_refs(void) static void test_schema_refs(void)
{ {
static const WCHAR emptyW[] = {0}; static const WCHAR xdr_schema_xml[] =
L"<Schema xmlns=\"urn:schemas-microsoft-com:xml-data\"\nxmlns:dt=\"urn:schemas-microsoft-com:datatypes\">\n</Schema>\n";
IXMLDOMDocument2 *doc; IXMLDOMDocument2 *doc;
IXMLDOMNode *node; IXMLDOMNode *node;
IXMLDOMSchemaCollection *cache; IXMLDOMSchemaCollection *cache;
@ -546,7 +539,7 @@ static void test_schema_refs(void)
IXMLDOMNode_Release(node); IXMLDOMNode_Release(node);
node = NULL; node = NULL;
str = SysAllocString(emptyW); str = SysAllocString(L"");
ole_check(IXMLDOMSchemaCollection_get(cache, str, &node)); ole_check(IXMLDOMSchemaCollection_get(cache, str, &node));
ok(node != NULL, "%p\n", node); ok(node != NULL, "%p\n", node);
IXMLDOMNode_Release(node); IXMLDOMNode_Release(node);
@ -576,7 +569,7 @@ static void test_schema_refs(void)
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len == 0, "got %d\n", len); ok(len == 0, "got %d\n", len);
str = SysAllocString(xdr_schema_uri); str = SysAllocString(L"x-schema:test.xml");
ole_check(IXMLDOMSchemaCollection_add(cache, str, _variantdoc_(doc))); ole_check(IXMLDOMSchemaCollection_add(cache, str, _variantdoc_(doc)));
/* IXMLDOMSchemaCollection_add doesn't add a ref on doc */ /* IXMLDOMSchemaCollection_add doesn't add a ref on doc */
@ -1430,8 +1423,6 @@ static void test_validate_on_load(void)
static void test_obj_dispex(IUnknown *obj) static void test_obj_dispex(IUnknown *obj)
{ {
static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0};
static const WCHAR starW[] = {'*',0};
DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE; DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE;
IDispatchEx *dispex; IDispatchEx *dispex;
IUnknown *unk; IUnknown *unk;
@ -1449,7 +1440,7 @@ static void test_obj_dispex(IUnknown *obj)
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
ok(ticnt == 1, "ticnt=%u\n", ticnt); ok(ticnt == 1, "ticnt=%u\n", ticnt);
name = SysAllocString(starW); name = SysAllocString(L"*");
hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive); hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
SysFreeString(name); SysFreeString(name);
@ -1474,7 +1465,7 @@ static void test_obj_dispex(IUnknown *obj)
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk); ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
name = SysAllocString(testW); name = SysAllocString(L"testprop");
hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid); hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid);
ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr); ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr);
SysFreeString(name); SysFreeString(name);

View File

@ -95,14 +95,6 @@ static void test_xmldoc(void)
HRESULT hr; HRESULT hr;
BSTR name; BSTR name;
static const WCHAR szBankAccount[] = {'B','A','N','K','A','C','C','O','U','N','T',0};
static const WCHAR szNumber[] = {'N','U','M','B','E','R',0};
static const WCHAR szNumVal[] = {'1','2','3','4',0};
static const WCHAR szName[] = {'N','A','M','E',0};
static const WCHAR szNameVal[] = {'C','a','p','t','a','i','n',' ','A','h','a','b',0};
static const WCHAR szVersion[] = {'1','.','0',0};
static const WCHAR rootW[] = {'r','o','o','t',0};
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&IID_IXMLDocument, (void**)&doc); &IID_IXMLDocument, (void**)&doc);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
@ -117,7 +109,7 @@ static void test_xmldoc(void)
name = NULL; name = NULL;
hr = ITypeInfo_GetDocumentation(ti, DISPID_XMLDOCUMENT_ROOT, &name, NULL, NULL, NULL); hr = ITypeInfo_GetDocumentation(ti, DISPID_XMLDOCUMENT_ROOT, &name, NULL, NULL, NULL);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(name, rootW), "got name %s\n", wine_dbgstr_w(name)); ok(!lstrcmpW(name, L"root"), "got name %s\n", wine_dbgstr_w(name));
SysFreeString(name); SysFreeString(name);
ITypeInfo_Release(ti); ITypeInfo_Release(ti);
@ -152,7 +144,7 @@ static void test_xmldoc(void)
name = NULL; name = NULL;
hr = IXMLDocument_get_version(doc, &name); hr = IXMLDocument_get_version(doc, &name);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szVersion), "Expected 1.0, got %s\n", wine_dbgstr_w(name)); ok(!lstrcmpW(name, L"1.0"), "Expected 1.0, got %s\n", wine_dbgstr_w(name));
SysFreeString(name); SysFreeString(name);
/* doctype */ /* doctype */
@ -161,7 +153,7 @@ static void test_xmldoc(void)
hr = IXMLDocument_get_doctype(doc, &name); hr = IXMLDocument_get_doctype(doc, &name);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szBankAccount), "Expected BANKACCOUNT, got %s\n", wine_dbgstr_w(name)); ok(!lstrcmpW(name, L"BANKACCOUNT"), "Expected BANKACCOUNT, got %s\n", wine_dbgstr_w(name));
SysFreeString(name); SysFreeString(name);
hr = IXMLDocument_get_root(doc, &element); hr = IXMLDocument_get_root(doc, &element);
@ -181,7 +173,7 @@ static void test_xmldoc(void)
hr = IXMLElement_get_tagName(element, &name); hr = IXMLElement_get_tagName(element, &name);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szBankAccount), "Expected BANKACCOUNT\n"); ok(!lstrcmpW(name, L"BANKACCOUNT"), "Expected BANKACCOUNT\n");
SysFreeString(name); SysFreeString(name);
hr = IXMLElement_get_children(element, &collection); hr = IXMLElement_get_children(element, &collection);
@ -206,7 +198,7 @@ static void test_xmldoc(void)
hr = IXMLElement_get_tagName(child, &name); hr = IXMLElement_get_tagName(child, &name);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szNumber), "Expected NUMBER\n"); ok(!lstrcmpW(name, L"NUMBER"), "Expected NUMBER\n");
SysFreeString(name); SysFreeString(name);
hr = IXMLElement_get_children(child, &inner); hr = IXMLElement_get_children(child, &inner);
@ -227,7 +219,7 @@ static void test_xmldoc(void)
hr = IXMLElement_get_text(value, &name); hr = IXMLElement_get_text(value, &name);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szNumVal), "Expected '1234'\n"); ok(!lstrcmpW(name, L"1234"), "Expected '1234'\n");
SysFreeString(name); SysFreeString(name);
IXMLElementCollection_Release(inner); IXMLElementCollection_Release(inner);
@ -253,7 +245,7 @@ static void test_xmldoc(void)
hr = IXMLElement_get_tagName(child, &name); hr = IXMLElement_get_tagName(child, &name);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szName), "Expected NAME\n"); ok(!lstrcmpW(name, L"NAME"), "Expected NAME\n");
SysFreeString(name); SysFreeString(name);
hr = IXMLElement_get_children(child, &inner); hr = IXMLElement_get_children(child, &inner);
@ -275,7 +267,7 @@ static void test_xmldoc(void)
hr = IXMLElement_get_text(value, &name); hr = IXMLElement_get_text(value, &name);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szNameVal), "Expected 'Captain Ahab'\n"); ok(!lstrcmpW(name, L"Captain Ahab"), "Expected 'Captain Ahab'\n");
SysFreeString(name); SysFreeString(name);
IXMLElementCollection_Release(inner); IXMLElementCollection_Release(inner);
@ -398,7 +390,6 @@ static void test_persiststreaminit(void)
CHAR path[MAX_PATH]; CHAR path[MAX_PATH];
CLSID id; CLSID id;
BSTR str; BSTR str;
static const WCHAR testW[] = {'t','e','s','t',0};
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&IID_IXMLDocument, (LPVOID*)&doc); &IID_IXMLDocument, (LPVOID*)&doc);
@ -456,7 +447,7 @@ static void test_persiststreaminit(void)
todo_wine ok(stat.cbSize.QuadPart > 0, "Expected >0\n"); todo_wine ok(stat.cbSize.QuadPart > 0, "Expected >0\n");
IStream_Release(stream); IStream_Release(stream);
str = SysAllocString(testW); str = SysAllocString(L"test");
hr = IXMLDocument_get_root(doc, &element); hr = IXMLDocument_get_root(doc, &element);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXMLElement_put_text(element, str); hr = IXMLElement_put_text(element, str);
@ -658,16 +649,13 @@ static void test_xmlelem_collection(void)
ULONG num_vars; ULONG num_vars;
VARIANT var[3], dummy, vIndex, vName; VARIANT var[3], dummy, vIndex, vName;
BSTR url, str; BSTR url, str;
static const CHAR szBankXML[] = "bank.xml";
static const WCHAR szNumber[] = {'N','U','M','B','E','R',0};
static const WCHAR szName[] = {'N','A','M','E',0};
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&IID_IXMLDocument, (LPVOID*)&doc); &IID_IXMLDocument, (LPVOID*)&doc);
ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
create_xml_file(szBankXML); create_xml_file("bank.xml");
GetFullPathNameA(szBankXML, MAX_PATH, pathA, NULL); GetFullPathNameA("bank.xml", MAX_PATH, pathA, NULL);
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
url = SysAllocString(path); url = SysAllocString(path);
@ -755,7 +743,7 @@ static void test_xmlelem_collection(void)
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szNumber), "Expected NUMBER\n"); ok(!lstrcmpW(str, L"NUMBER"), "Expected NUMBER\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
@ -822,7 +810,7 @@ static void test_xmlelem_collection(void)
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szName), "Expected NAME\n"); ok(!lstrcmpW(str, L"NAME"), "Expected NAME\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
@ -841,7 +829,7 @@ static void test_xmlelem_collection(void)
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szNumber), "Expected NUMBER\n"); ok(!lstrcmpW(str, L"NUMBER"), "Expected NUMBER\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
@ -860,7 +848,7 @@ static void test_xmlelem_collection(void)
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szName), "Expected NAME\n"); ok(!lstrcmpW(str, L"NAME"), "Expected NAME\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
@ -897,13 +885,6 @@ static void test_xmlelem(void)
IDispatch *disp; IDispatch *disp;
ITypeInfo *ti; ITypeInfo *ti;
static const WCHAR propName[] = {'p','r','o','p',0};
static const WCHAR propVal[] = {'v','a','l',0};
static const WCHAR nextVal[] = {'n','e','x','t',0};
static const WCHAR noexist[] = {'n','o','e','x','i','s','t',0};
static const WCHAR crazyCase1[] = {'C','R','a','z','Y','c','A','S','E',0};
static const WCHAR crazyCase2[] = {'C','R','A','Z','Y','C','A','S','E',0};
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&IID_IXMLDocument, (LPVOID*)&doc); &IID_IXMLDocument, (LPVOID*)&doc);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
@ -941,7 +922,7 @@ static void test_xmlelem(void)
ok(hr == 1, "Expected 1, got %08x\n", hr); ok(hr == 1, "Expected 1, got %08x\n", hr);
ok(parent == NULL, "Expected NULL parent\n"); ok(parent == NULL, "Expected NULL parent\n");
str = SysAllocString(noexist); str = SysAllocString(L"noexist");
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
ok(V_VT(&vValue) == VT_EMPTY, "Expected VT_EMPTY, got %d\n", V_VT(&vValue)); ok(V_VT(&vValue) == VT_EMPTY, "Expected VT_EMPTY, got %d\n", V_VT(&vValue));
@ -949,8 +930,8 @@ static void test_xmlelem(void)
VariantClear(&vValue); VariantClear(&vValue);
SysFreeString(str); SysFreeString(str);
str = SysAllocString(crazyCase1); str = SysAllocString(L"CRazYcASE");
val = SysAllocString(propVal); val = SysAllocString(L"val");
V_VT(&vValue) = VT_BSTR; V_VT(&vValue) = VT_BSTR;
V_BSTR(&vValue) = val; V_BSTR(&vValue) = val;
hr = IXMLElement_setAttribute(element, str, vValue); hr = IXMLElement_setAttribute(element, str, vValue);
@ -958,16 +939,16 @@ static void test_xmlelem(void)
SysFreeString(str); SysFreeString(str);
SysFreeString(val); SysFreeString(val);
str = SysAllocString(crazyCase2); str = SysAllocString(L"CRAZYCASE");
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(V_VT(&vValue) == VT_BSTR, "Expected VT_BSTR, got %d\n", V_VT(&vValue)); ok(V_VT(&vValue) == VT_BSTR, "Expected VT_BSTR, got %d\n", V_VT(&vValue));
ok(!lstrcmpW(V_BSTR(&vValue), propVal), "Expected 'val'\n"); ok(!lstrcmpW(V_BSTR(&vValue), L"val"), "Expected 'val'\n");
VariantClear(&vValue); VariantClear(&vValue);
SysFreeString(str); SysFreeString(str);
str = SysAllocString(propName); str = SysAllocString(L"prop");
val = SysAllocString(propVal); val = SysAllocString(L"val");
V_VT(&vValue) = VT_BSTR; V_VT(&vValue) = VT_BSTR;
V_BSTR(&vValue) = val; V_BSTR(&vValue) = val;
hr = IXMLElement_setAttribute(element, str, vValue); hr = IXMLElement_setAttribute(element, str, vValue);
@ -977,7 +958,7 @@ static void test_xmlelem(void)
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(V_VT(&vValue) == VT_BSTR, "Expected VT_BSTR, got %d\n", V_VT(&vValue)); ok(V_VT(&vValue) == VT_BSTR, "Expected VT_BSTR, got %d\n", V_VT(&vValue));
ok(!lstrcmpW(V_BSTR(&vValue), propVal), "Expected 'val'\n"); ok(!lstrcmpW(V_BSTR(&vValue), L"val"), "Expected 'val'\n");
VariantClear(&vValue); VariantClear(&vValue);
hr = IXMLElement_removeAttribute(element, str); hr = IXMLElement_removeAttribute(element, str);
@ -1009,7 +990,7 @@ static void test_xmlelem(void)
SysFreeString(str); SysFreeString(str);
/* put_text with an ELEMENT */ /* put_text with an ELEMENT */
str = SysAllocString(propVal); str = SysAllocString(L"val");
hr = IXMLElement_put_text(element, str); hr = IXMLElement_put_text(element, str);
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr); ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
@ -1024,7 +1005,7 @@ static void test_xmlelem(void)
hr = IXMLElement_addChild(element, child, 0, -1); hr = IXMLElement_addChild(element, child, 0, -1);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
str = SysAllocString(propVal); str = SysAllocString(L"val");
hr = IXMLElement_put_text(child, str); hr = IXMLElement_put_text(child, str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
@ -1061,28 +1042,28 @@ static void test_xmlelem(void)
hr = IXMLElement_get_text(element, &str); hr = IXMLElement_get_text(element, &str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, propVal), "Expected 'val'\n"); ok(!lstrcmpW(str, L"val"), "Expected 'val'\n");
SysFreeString(str); SysFreeString(str);
hr = IXMLElement_get_text(child2, &str); hr = IXMLElement_get_text(child2, &str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, propVal), "Expected 'val'\n"); ok(!lstrcmpW(str, L"val"), "Expected 'val'\n");
SysFreeString(str); SysFreeString(str);
/* try put_text on ELEMENT again, now that it has a text child */ /* try put_text on ELEMENT again, now that it has a text child */
str = SysAllocString(nextVal); str = SysAllocString(L"next");
hr = IXMLElement_put_text(element, str); hr = IXMLElement_put_text(element, str);
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr); ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
str = SysAllocString(nextVal); str = SysAllocString(L"next");
hr = IXMLElement_put_text(child2, str); hr = IXMLElement_put_text(child2, str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
hr = IXMLElement_get_text(element, &str); hr = IXMLElement_get_text(element, &str);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, nextVal), "Expected 'val'\n"); ok(!lstrcmpW(str, L"next"), "Expected 'val'\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child2); IXMLElement_Release(child2);

View File

@ -121,14 +121,15 @@ static HRESULT WINAPI HTMLEvents_Invoke(IDispatch *iface, DISPID dispIdMember, R
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr) EXCEPINFO *pExcepInfo, UINT *puArgErr)
{ {
if(dispIdMember == DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE) { if (dispIdMember == DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE)
static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0}; {
static const WCHAR completeW[] = L"complete";
HRESULT hr; HRESULT hr;
BSTR state; BSTR state;
hr = IHTMLDocument2_get_readyState(html_doc, &state); hr = IHTMLDocument2_get_readyState(html_doc, &state);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
if(!memcmp(state, completeW, sizeof(completeW))) if (!memcmp(state, completeW, sizeof(completeW)))
loaded = TRUE; loaded = TRUE;
SysFreeString(state); SysFreeString(state);
} }
@ -191,9 +192,6 @@ static void test_QueryInterface(void)
static void test_Load(void) static void test_Load(void)
{ {
static const WCHAR xmlview_xmlW[] = {'/','x','m','l','/','x','m','l','v','i','e','w','.','x','m','l',0};
static const WCHAR res[] = {'r','e','s',':','/','/',0};
WCHAR buf[1024]; WCHAR buf[1024];
IPersistMoniker *pers_mon; IPersistMoniker *pers_mon;
IConnectionPointContainer *cpc; IConnectionPointContainer *cpc;
@ -205,9 +203,9 @@ static void test_Load(void)
MSG msg; MSG msg;
BSTR source; BSTR source;
lstrcpyW(buf, res); lstrcpyW(buf, L"res://");
GetModuleFileNameW(NULL, buf+lstrlenW(buf), ARRAY_SIZE(buf)-ARRAY_SIZE(res)); GetModuleFileNameW(NULL, buf+lstrlenW(buf), ARRAY_SIZE(buf)-ARRAY_SIZE(L"res://"));
lstrcatW(buf, xmlview_xmlW); lstrcatW(buf, L"/xml/xmlview.xml");
if(!pCreateURLMoniker) { if(!pCreateURLMoniker) {
win_skip("CreateURLMoniker not available\n"); win_skip("CreateURLMoniker not available\n");