Author: akhaldi
Date: Mon Sep 23 11:39:45 2013
New Revision: 60340
URL:
http://svn.reactos.org/svn/reactos?rev=60340&view=rev
Log:
[MSXML3_WINETEST]
* Sync with Wine 1.7.1.
CORE-7469
ROSTESTS-100 #resolve #comment Fixed by the r60340 sync.
Modified:
trunk/rostests/winetests/msxml3/CMakeLists.txt
trunk/rostests/winetests/msxml3/domdoc.c
trunk/rostests/winetests/msxml3/httpreq.c
trunk/rostests/winetests/msxml3/saxreader.c
Modified: trunk/rostests/winetests/msxml3/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msxml3/CMakeLis…
==============================================================================
--- trunk/rostests/winetests/msxml3/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/msxml3/CMakeLists.txt [iso-8859-1] Mon Sep 23 11:39:45 2013
@@ -1,5 +1,3 @@
-
-add_definitions(-D__ROS_LONG64__)
list(APPEND SOURCE
domdoc.c
@@ -14,7 +12,6 @@
add_executable(msxml3_winetest ${SOURCE} rsrc.rc)
add_idl_headers(xmlparser_idlheader_test xmlparser.idl)
add_dependencies(msxml3_winetest xmlparser_idlheader_test)
-target_link_libraries(msxml3_winetest wine)
set_module_type(msxml3_winetest win32cui)
add_importlibs(msxml3_winetest user32 ole32 oleaut32 msvcrt kernel32 ntdll)
add_cd_file(TARGET msxml3_winetest DESTINATION reactos/bin FOR all)
Modified: trunk/rostests/winetests/msxml3/domdoc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msxml3/domdoc.c…
==============================================================================
--- trunk/rostests/winetests/msxml3/domdoc.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msxml3/domdoc.c [iso-8859-1] Mon Sep 23 11:39:45 2013
@@ -393,6 +393,15 @@
'<','?','x','m','l','
','v','e','r','s','i','o','n','=','\'','1','.','0','\'','
',
'e','n','c','o','d','i','n','g','=','\'','W','i','n','d','o','w','s','-','1','2','5','2','\'','?','>','\n',
'<','o','p','e','n','>','<','/','o','p','e','n','>','\n',0
+};
+
+static const char complete7[] = {
+ "<?xml version=\"1.0\"?>\n\t"
+ "<root>\n"
+ "\t<a/>\n"
+ "\t<b/>\n"
+ "\t<c/>\n"
+ "</root>"
};
#define DECL_WIN_1252 \
@@ -445,6 +454,13 @@
" </elem>\n"
"</root>\n";
+static const char charrefsxml[] =
+"<?xml version='1.0'?>"
+"<a>"
+"<b1> Text A end </b1>"
+"<b2>AB C </b2>"
+"</a>";
+
static const CHAR szNodeTypesXML[] =
"<?xml version='1.0'?>"
"<!-- comment node 0 -->"
@@ -4190,10 +4206,62 @@
IXMLDOMNode_Release(node2);
}
+static void test_preserve_charref(IXMLDOMDocument2 *doc, VARIANT_BOOL preserve)
+{
+ static const WCHAR b1_p[] = {'
','T','e','x','t',' ','A','
','e','n','d',' ',0};
+ static const WCHAR b1_i[] = {'T','e','x','t','
','A',' ','e','n','d',0};
+ static const WCHAR b2_p[] = {'A','B',' ','C','
',0};
+ static const WCHAR b2_i[] = {'A','B',' ','C',0};
+ IXMLDOMNodeList *list;
+ IXMLDOMElement *root;
+ IXMLDOMNode *node;
+ const WCHAR *text;
+ VARIANT_BOOL b;
+ HRESULT hr;
+ BSTR s;
+
+ hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc, preserve);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMDocument2_loadXML(doc, _bstr_(charrefsxml), &b);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMDocument2_get_documentElement(doc, &root);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMElement_get_childNodes(root, &list);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ IXMLDOMElement_Release(root);
+
+ text = preserve == VARIANT_TRUE ? b1_p : b1_i;
+ hr = IXMLDOMNodeList_get_item(list, 0, &node);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IXMLDOMNode_get_text(node, &s);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(!lstrcmpW(s, text), "0x%x, got %s\n", preserve, wine_dbgstr_w(s));
+ SysFreeString(s);
+ IXMLDOMNode_Release(node);
+
+ text = preserve == VARIANT_TRUE ? b2_p : b2_i;
+ hr = IXMLDOMNodeList_get_item(list, 1, &node);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IXMLDOMNode_get_text(node, &s);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(!lstrcmpW(s, text), "0x%x, got %s\n", preserve, wine_dbgstr_w(s));
+ SysFreeString(s);
+ IXMLDOMNode_Release(node);
+
+ IXMLDOMNodeList_Release(list);
+}
+
static void test_whitespace(void)
{
+ IXMLDOMDocument2 *doc1, *doc2, *doc3, *doc4;
+ IXMLDOMNodeList *list;
+ IXMLDOMElement *root;
VARIANT_BOOL b;
- IXMLDOMDocument2 *doc1, *doc2, *doc3, *doc4;
+ HRESULT hr;
+ LONG len;
doc1 = create_document(&IID_IXMLDOMDocument2);
doc2 = create_document(&IID_IXMLDOMDocument2);
@@ -4260,10 +4328,35 @@
check_ws_preserved(doc3, NULL);
check_ws_ignored(doc4, NULL);
- IXMLDOMDocument2_Release(doc1);
IXMLDOMDocument2_Release(doc2);
IXMLDOMDocument2_Release(doc3);
IXMLDOMDocument2_Release(doc4);
+
+ /* text with char references */
+ test_preserve_charref(doc1, VARIANT_TRUE);
+ test_preserve_charref(doc1, VARIANT_FALSE);
+
+ /* formatting whitespaces */
+ hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc1, VARIANT_FALSE);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMDocument2_loadXML(doc1, _bstr_(complete7), &b);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(b == VARIANT_TRUE, "for %x\n", b);
+
+ hr = IXMLDOMDocument2_get_documentElement(doc1, &root);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = IXMLDOMElement_get_childNodes(root, &list);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ len = 0;
+ hr = IXMLDOMNodeList_get_length(list, &len);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(len == 3, "got %d\n", len);
+ IXMLDOMNodeList_Release(list);
+ IXMLDOMElement_Release(root);
+
+ IXMLDOMDocument2_Release(doc1);
+
free_bstrs();
}
@@ -4304,9 +4397,49 @@
{ NULL }
};
+typedef struct {
+ const char *query;
+ const char *list;
+} xpath_test_t;
+
+static const xpath_test_t xpath_test[] = {
+ { "*/a", "E1.E1.E2.D1 E1.E2.E2.D1 E1.E4.E2.D1" },
+ { "*/b", "E2.E1.E2.D1 E2.E2.E2.D1 E2.E4.E2.D1" },
+ { "*/c", "E3.E1.E2.D1 E3.E2.E2.D1" },
+ { "*/d", "E4.E1.E2.D1 E4.E2.E2.D1 E4.E4.E2.D1" },
+ { "//a", "E1.E1.E2.D1 E1.E2.E2.D1 E1.E4.E2.D1" },
+ { "//b", "E2.E1.E2.D1 E2.E2.E2.D1 E2.E4.E2.D1" },
+ { "//c", "E3.E1.E2.D1 E3.E2.E2.D1" },
+ { "//d", "E4.E1.E2.D1 E4.E2.E2.D1 E4.E4.E2.D1" },
+ { "//c[@type]", "E3.E2.E2.D1" },
+ { "//c[@type]/ancestor::node()[1]", "E2.E2.D1" },
+ { "//c[@type]/ancestor-or-self::node()[1]", "E3.E2.E2.D1" },
+ { "//c[@type]/attribute::node()[1]",
"A'type'.E3.E2.E2.D1" },
+ { "//c[@type]/child::node()[1]", "T1.E3.E2.E2.D1" },
+ { "//c[@type]/descendant::node()[1]", "T1.E3.E2.E2.D1" },
+ { "//c[@type]/descendant-or-self::node()[1]", "E3.E2.E2.D1" },
+ { "//c[@type]/following::node()[1]", "E4.E2.E2.D1" },
+ { "//c[@type]/following-sibling::node()[1]", "E4.E2.E2.D1" },
+ { "//c[@type]/parent::node()[1]", "E2.E2.D1" },
+ { "//c[@type]/preceding::node()[1]", "T1.E2.E2.E2.D1" },
+ { "//c[@type]/self::node()[1]", "E3.E2.E2.D1" },
+ { "child::*", "E1.E2.D1 E2.E2.D1 E3.E2.D1 E4.E2.D1" },
+ { "child::node()", "E1.E2.D1 E2.E2.D1 E3.E2.D1 E4.E2.D1" },
+ { "child::text()", "" },
+ { "child::*/..", "E2.D1" },
+ { "child::*//@*/..", "E2.E5.E1.E2.D1 E3.E2.E2.D1" },
+ { "self::node()", "E2.D1" },
+ { "ancestor::node()", "D1" },
+ { "elem[c][last()]/a", "E1.E2.E2.D1"},
+ { "ancestor-or-self::node()[1]", "E2.D1" },
+ { "((//a)[1])[last()]", "E1.E1.E2.D1" },
+ { NULL }
+};
+
static void test_XPath(void)
{
const selection_ns_t *ptr = selection_ns_data;
+ const xpath_test_t *xptest = xpath_test;
VARIANT var;
VARIANT_BOOL b;
IXMLDOMDocument2 *doc;
@@ -4348,6 +4481,26 @@
hr = IXMLDOMNodeList_reset(list);
EXPECT_HR(hr, S_OK);
expect_list_and_release(list, "E2.D1");
+
+ /* peform xpath tests */
+ for ( ; xptest->query ; xptest++ )
+ {
+ char *str;
+
+ hr = IXMLDOMNode_selectNodes(rootNode, _bstr_(xptest->query), &list);
+ ok(hr == S_OK, "query evaluation failed for query=%s\n",
xptest->query);
+
+ if (hr != S_OK)
+ continue;
+
+ str = list_to_string(list);
+
+ ok(strcmp(str, xptest->list)==0, "query=%s, invalid node list: %s,
expected %s\n",
+ xptest->query, str, xptest->list);
+
+ if (list)
+ IXMLDOMNodeList_Release(list);
+ }
if (0)
{
@@ -11475,6 +11628,99 @@
free_bstrs();
}
+struct attrtest_t {
+ const char *name;
+ const char *uri;
+ const char *prefix;
+ const char *href;
+};
+
+static struct attrtest_t attrtests[] = {
+ { "xmlns", "http://www.w3.org/2000/xmlns/", "xmlns",
"xmlns" },
+ { "xmlns", "nondefaulturi", "xmlns", "xmlns"
},
+ { "c", "http://www.w3.org/2000/xmlns/", NULL,
"http://www.w3.org/2000/xmlns/" },
+ { "c", "nsref1", NULL, "nsref1" },
+ { "ns:c", "nsref1", "ns", "nsref1" },
+ { "xmlns:c", "http://www.w3.org/2000/xmlns/", "xmlns",
"" },
+ { "xmlns:c", "nondefaulturi", "xmlns", "" },
+ { 0 }
+};
+
+static void test_create_attribute(void)
+{
+ struct attrtest_t *ptr = attrtests;
+ IXMLDOMElement *el;
+ IXMLDOMDocument *doc;
+ IXMLDOMNode *node, *node2;
+ VARIANT var;
+ HRESULT hr;
+ int i = 0;
+ BSTR str;
+
+ doc = create_document(&IID_IXMLDOMDocument);
+
+ while (ptr->name)
+ {
+ V_VT(&var) = VT_I1;
+ V_I1(&var) = NODE_ATTRIBUTE;
+ hr = IXMLDOMDocument_createNode(doc, var, _bstr_(ptr->name),
_bstr_(ptr->uri), &node);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_prefix(node, &str);
+ if (ptr->prefix)
+ {
+ ok(hr == S_OK, "%d: got 0x%08x\n", i, hr);
+ ok(!lstrcmpW(str, _bstr_(ptr->prefix)), "%d: got prefix %s, expected
%s\n", i, wine_dbgstr_w(str), ptr->prefix);
+ }
+ else
+ {
+ ok(hr == S_FALSE, "%d: got 0x%08x\n", i, hr);
+ ok(str == NULL, "%d: got prefix %s\n", i, wine_dbgstr_w(str));
+ }
+
+ str = NULL;
+ hr = IXMLDOMNode_get_namespaceURI(node, &str);
+ ok(hr == S_OK, "%d: got 0x%08x\n", i, hr);
+ ok(!lstrcmpW(str, _bstr_(ptr->href)), "%d: got uri %s, expected
%s\n", i, wine_dbgstr_w(str), ptr->href);
+ SysFreeString(str);
+
+ IXMLDOMNode_Release(node);
+ free_bstrs();
+
+ i++;
+ ptr++;
+ }
+
+ V_VT(&var) = VT_I1;
+ V_I1(&var) = NODE_ELEMENT;
+ hr = IXMLDOMDocument_createNode(doc, var, _bstr_("e"), NULL, &node2);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMNode_QueryInterface(node2, &IID_IXMLDOMElement, (void**)&el);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ IXMLDOMNode_Release(node2);
+
+ V_VT(&var) = VT_I1;
+ V_I1(&var) = NODE_ATTRIBUTE;
+ hr = IXMLDOMDocument_createNode(doc, var, _bstr_("xmlns:a"),
_bstr_("http://www.w3.org/2000/xmlns/")ns/"), &node);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMElement_setAttributeNode(el, (IXMLDOMAttribute*)node, NULL);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ /* for some reason default namespace uri is not reported */
+ hr = IXMLDOMNode_get_namespaceURI(node, &str);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(!lstrcmpW(str, _bstr_("")), "got uri %s\n",
wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ IXMLDOMNode_Release(node);
+ IXMLDOMElement_Release(el);
+ IXMLDOMDocument_Release(doc);
+ free_bstrs();
+}
+
START_TEST(domdoc)
{
IXMLDOMDocument *doc;
@@ -11531,6 +11777,7 @@
test_setAttributeNode();
test_put_dataType();
test_createNode();
+ test_create_attribute();
test_get_prefix();
test_default_properties();
test_selectSingleNode();
Modified: trunk/rostests/winetests/msxml3/httpreq.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msxml3/httpreq.…
==============================================================================
--- trunk/rostests/winetests/msxml3/httpreq.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msxml3/httpreq.c [iso-8859-1] Mon Sep 23 11:39:45 2013
@@ -1443,12 +1443,6 @@
HRESULT hr;
HGLOBAL g;
- if (!winetest_interactive)
- {
- skip("test_XMLHTTP skipped, ROSTESTS-100\n");
- return;
- }
-
xhr = create_xhr();
VariantInit(&dummy);
@@ -1699,58 +1693,28 @@
IDispatch_Release(event);
/* interaction with object site */
- EXPECT_REF(xhr, 1);
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite,
(void**)&obj_site);
EXPECT_HR(hr, S_OK);
-todo_wine {
- EXPECT_REF(xhr, 1);
- EXPECT_REF(obj_site, 1);
-}
hr = IObjectWithSite_SetSite(obj_site, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
- IObjectWithSite_AddRef(obj_site);
-todo_wine {
- EXPECT_REF(obj_site, 2);
- EXPECT_REF(xhr, 1);
-}
- IObjectWithSite_Release(obj_site);
-
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite,
(void**)&obj_site2);
EXPECT_HR(hr, S_OK);
-todo_wine {
- EXPECT_REF(xhr, 1);
- EXPECT_REF(obj_site, 1);
- EXPECT_REF(obj_site2, 1);
- ok(obj_site != obj_site2, "expected new instance\n");
-}
- IObjectWithSite_Release(obj_site);
+ ok(obj_site == obj_site2 || broken(obj_site != obj_site2), "got new
instance\n");
+ IObjectWithSite_Release(obj_site2);
set_xhr_site(xhr);
/* try to set site another time */
-
- /* to be removed once IObjectWithSite is properly separated */
SET_EXPECT(site_qi_IServiceProvider);
SET_EXPECT(sp_queryservice_SID_SContainerDispatch_htmldoc2);
- hr = IObjectWithSite_SetSite(obj_site2, &testsite);
- EXPECT_HR(hr, S_OK);
-
- todo_wine EXPECT_REF(xhr, 1);
+ hr = IObjectWithSite_SetSite(obj_site, &testsite);
+ EXPECT_HR(hr, S_OK);
+
+ IObjectWithSite_Release(obj_site);
IXMLHttpRequest_Release(xhr);
-
- /* still works after request is released */
-
- /* to be removed once IObjectWithSite is properly separated */
- SET_EXPECT(site_qi_IServiceProvider);
- SET_EXPECT(sp_queryservice_SID_SContainerDispatch_htmldoc2);
-
- hr = IObjectWithSite_SetSite(obj_site2, &testsite);
- EXPECT_HR(hr, S_OK);
- IObjectWithSite_Release(obj_site2);
-
free_bstrs();
}
Modified: trunk/rostests/winetests/msxml3/saxreader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msxml3/saxreade…
==============================================================================
--- trunk/rostests/winetests/msxml3/saxreader.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msxml3/saxreader.c [iso-8859-1] Mon Sep 23 11:39:45 2013
@@ -39,6 +39,7 @@
//#include "ocidl.h"
#include <dispex.h>
+static const WCHAR emptyW[] = {0};
#define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
@@ -891,10 +892,10 @@
/* attribute value normalization test */
static const char attribute_normalize[] =
"<?xml version=\"1.0\" ?>\n"
- "<a attr1=\" \r \n \tattr_value A \t \r \n\r\n
\n\"/>\n";
+ "<a attr1=\" \r \n \tattr_value A & &\t \r
\n\r\n \n\"/>\n";
static struct attribute_entry attribute_norm_attrs[] = {
- { "", "attr1", "attr1", " attr_value A
" },
+ { "", "attr1", "attr1", " attr_value A &
& " },
{ NULL }
};
@@ -1556,8 +1557,8 @@
{
static const WCHAR attrvaluesW[][10] =
{{'a','1','j','u','n','k',0},
{'a','2','j','u','n','k',0},
-
{'<','&','"','>',0}};
- static const int attrvalueslen[] = {2, 2, 4};
+
{'<','&','"','>','\'',0}};
+ static const int attrvalueslen[] = {2, 2, 5};
ok(index >= 0 && index <= 2, "invalid index received %d\n",
index);
@@ -2895,7 +2896,6 @@
static void test_mxwriter_properties(void)
{
static const WCHAR utf16W[] =
{'U','T','F','-','1','6',0};
- static const WCHAR emptyW[] = {0};
static const WCHAR testW[] = {'t','e','s','t',0};
ISAXContentHandler *content;
IMXWriter *writer;
@@ -3046,7 +3046,6 @@
static void test_mxwriter_flush(void)
{
- static const WCHAR emptyW[] = {0};
ISAXContentHandler *content;
IMXWriter *writer;
LARGE_INTEGER pos;
@@ -3336,9 +3335,9 @@
ISAXAttributes *attr;
};
-static const char startelement_xml[] = "<uri:local a:attr1=\"a1\"
attr2=\"a2\" attr3=\"<&">\">";
-static const char startendelement_xml[] = "<uri:local a:attr1=\"a1\"
attr2=\"a2\"
attr3=\"<&">\"/>";
-static const char startendelement_noescape_xml[] = "<uri:local
a:attr1=\"a1\" attr2=\"a2\"
attr3=\"<&\">\"/>";
+static const char startelement_xml[] = "<uri:local a:attr1=\"a1\"
attr2=\"a2\"
attr3=\"<&">\'\">";
+static const char startendelement_xml[] = "<uri:local a:attr1=\"a1\"
attr2=\"a2\"
attr3=\"<&">\'\"/>";
+static const char startendelement_noescape_xml[] = "<uri:local
a:attr1=\"a1\" attr2=\"a2\"
attr3=\"<&\">\'\"/>";
static const struct writer_startendelement_t writer_startendelement[] = {
/* 0 */
@@ -3717,7 +3716,8 @@
ok(!lstrcmpW(_bstr_("<abc>"), V_BSTR(&dest)), "got wrong
content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
- ISAXContentHandler_endDocument(content);
+ hr = ISAXContentHandler_endDocument(content);
+ EXPECT_HR(hr, S_OK);
IMXWriter_flush(writer);
hr = ISAXContentHandler_endElement(content, _bstr_(""), 0,
_bstr_(""), 0, _bstr_("abdcdef"), 3);
@@ -3755,10 +3755,10 @@
};
static const struct writer_characters_t writer_characters[] = {
- { &CLSID_MXXMLWriter, "< > & \"", "<
> & \"" },
- { &CLSID_MXXMLWriter30, "< > & \"", "<
> & \"" },
- { &CLSID_MXXMLWriter40, "< > & \"", "<
> & \"" },
- { &CLSID_MXXMLWriter60, "< > & \"", "<
> & \"" },
+ { &CLSID_MXXMLWriter, "< > & \" \'",
"< > & \" \'" },
+ { &CLSID_MXXMLWriter30, "< > & \" \'",
"< > & \" \'" },
+ { &CLSID_MXXMLWriter40, "< > & \" \'",
"< > & \" \'" },
+ { &CLSID_MXXMLWriter60, "< > & \" \'",
"< > & \" \'" },
{ NULL }
};
@@ -4743,6 +4743,28 @@
ok(!lstrcmpW(_bstr_("<!ENTITY name \"value\">\r\n"),
V_BSTR(&dest)), "got wrong content %s\n",
wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
+ /* external entities */
+ V_VT(&dest) = VT_EMPTY;
+ hr = IMXWriter_put_output(writer, dest);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = ISAXDeclHandler_externalEntityDecl(decl, NULL, 0, NULL, 0, NULL, 0);
+ ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+ hr = ISAXDeclHandler_externalEntityDecl(decl, _bstr_("name"), -1, NULL, 0,
NULL, 0);
+ ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+ hr = ISAXDeclHandler_externalEntityDecl(decl, _bstr_("name"),
strlen("name"), _bstr_("pubid"), strlen("pubid"),
+ _bstr_("sysid"), strlen("sysid"));
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ V_VT(&dest) = VT_EMPTY;
+ hr = IMXWriter_get_output(writer, &dest);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
+ ok(!lstrcmpW(_bstr_("<!ENTITY name PUBLIC \"pubid\"
\"sysid\">\r\n"), V_BSTR(&dest)), "got wrong content
%s\n", wine_dbgstr_w(V_BSTR(&dest)));
+ VariantClear(&dest);
+
ISAXContentHandler_Release(content);
ISAXLexicalHandler_Release(lexical);
ISAXDeclHandler_Release(decl);
@@ -5247,6 +5269,63 @@
ISAXAttributes_Release(saxattr);
IMXAttributes_Release(mxattr);
}
+}
+
+static void test_mxwriter_indent(void)
+{
+ ISAXContentHandler *content;
+ IMXWriter *writer;
+ VARIANT dest;
+ HRESULT hr;
+
+ hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
&IID_IMXWriter, (void**)&writer);
+ ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+
+ hr = IMXWriter_put_indent(writer, VARIANT_TRUE);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler,
(void**)&content);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_startDocument(content);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0,
_bstr_("a"), -1, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_characters(content, _bstr_(""), 0);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0,
_bstr_("b"), -1, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_startElement(content, emptyW, 0, emptyW, 0,
_bstr_("c"), -1, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_endElement(content, emptyW, 0, emptyW, 0,
_bstr_("c"), -1);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_endElement(content, emptyW, 0, emptyW, 0,
_bstr_("b"), -1);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_endElement(content, emptyW, 0, emptyW, 0,
_bstr_("a"), -1);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ hr = ISAXContentHandler_endDocument(content);
+ ok(hr == S_OK, "got %08x\n", hr);
+
+ V_VT(&dest) = VT_EMPTY;
+ hr = IMXWriter_get_output(writer, &dest);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
+ ok(!lstrcmpW(_bstr_("<?xml version=\"1.0\"
encoding=\"UTF-16\"
standalone=\"no\"?>\r\n<a><b>\r\n\t\t<c/>\r\n\t</b>\r\n</a>"),
V_BSTR(&dest)),
+ "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
+ VariantClear(&dest);
+
+ ISAXContentHandler_Release(content);
+ IMXWriter_Release(writer);
+
+ free_bstrs();
}
START_TEST(saxreader)
@@ -5296,6 +5375,7 @@
test_mxwriter_stream();
test_mxwriter_encoding();
test_mxwriter_dispex();
+ test_mxwriter_indent();
}
else
win_skip("MXXMLWriter not supported\n");