Commit 66eca8b3 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msxml3/tests: Better error messages formatting.

parent 1be44ab2
...@@ -101,18 +101,18 @@ static void test_xmldoc(void) ...@@ -101,18 +101,18 @@ static void test_xmldoc(void)
ok(file_size == read, "Expected to read the whole file, read %d\n", read); ok(file_size == read, "Expected to read the whole file, read %d\n", read);
hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream); hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(stream != NULL, "Expected non-NULL stream\n"); ok(stream != NULL, "Expected non-NULL stream\n");
CloseHandle(hfile); CloseHandle(hfile);
GlobalUnlock(hglobal); GlobalUnlock(hglobal);
hr = IXMLDocument_QueryInterface(doc, &IID_IPersistStreamInit, (LPVOID *)&psi); hr = IXMLDocument_QueryInterface(doc, &IID_IPersistStreamInit, (LPVOID *)&psi);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(psi != NULL, "Expected non-NULL psi\n"); ok(psi != NULL, "Expected non-NULL psi\n");
hr = IXMLDocument_get_root(doc, &element); hr = IXMLDocument_get_root(doc, &element);
ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr); ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr);
ok(element == NULL, "Expected NULL element\n"); ok(element == NULL, "Expected NULL element\n");
hr = IPersistStreamInit_Load(psi, stream); hr = IPersistStreamInit_Load(psi, stream);
...@@ -123,24 +123,24 @@ static void test_xmldoc(void) ...@@ -123,24 +123,24 @@ static void test_xmldoc(void)
ok(stream != NULL, "Expected non-NULL stream\n"); ok(stream != NULL, "Expected non-NULL stream\n");
hr = IXMLDocument_get_root(doc, &element); hr = IXMLDocument_get_root(doc, &element);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
hr = IXMLElement_get_type(element, &type); hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_tagName(element, &name); hr = IXMLElement_get_tagName(element, &name);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szBankAccount), "Expected BANKACCOUNT\n"); ok(!lstrcmpW(name, szBankAccount), "Expected BANKACCOUNT\n");
SysFreeString(name); SysFreeString(name);
hr = IXMLElement_get_children(element, &collection); hr = IXMLElement_get_children(element, &collection);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(collection != NULL, "Expected non-NULL collection\n"); ok(collection != NULL, "Expected non-NULL collection\n");
hr = IXMLElementCollection_get_length(collection, &num_child); hr = IXMLElementCollection_get_length(collection, &num_child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 2, "Expected 2, got %ld\n", num_child); ok(num_child == 2, "Expected 2, got %ld\n", num_child);
V_VT(&vIndex) = VT_I4; V_VT(&vIndex) = VT_I4;
...@@ -148,36 +148,36 @@ static void test_xmldoc(void) ...@@ -148,36 +148,36 @@ static void test_xmldoc(void)
V_VT(&vName) = VT_ERROR; V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND; V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child); hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_tagName(child, &name); hr = IXMLElement_get_tagName(child, &name);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szNumber), "Expected NUMBER\n"); ok(!lstrcmpW(name, szNumber), "Expected NUMBER\n");
SysFreeString(name); SysFreeString(name);
hr = IXMLElement_get_children(child, &inner); hr = IXMLElement_get_children(child, &inner);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(inner != NULL, "Expected non-NULL inner\n"); ok(inner != NULL, "Expected non-NULL inner\n");
hr = IXMLElementCollection_get_length(inner, &num_child); hr = IXMLElementCollection_get_length(inner, &num_child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 1, "Expected 1, got %ld\n", num_child); ok(num_child == 1, "Expected 1, got %ld\n", num_child);
hr = IXMLElementCollection_item(inner, vIndex, vName, (IDispatch **)&value); hr = IXMLElementCollection_item(inner, vIndex, vName, (IDispatch **)&value);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(value != NULL, "Expected non-NULL value\n"); ok(value != NULL, "Expected non-NULL value\n");
hr = IXMLElement_get_type(value, &type); hr = IXMLElement_get_type(value, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %ld\n", type); ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %ld\n", type);
hr = IXMLElement_get_text(value, &name); hr = IXMLElement_get_text(value, &name);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szNumVal), "Expected '1234'\n"); ok(!lstrcmpW(name, szNumVal), "Expected '1234'\n");
SysFreeString(name); SysFreeString(name);
...@@ -185,7 +185,7 @@ static void test_xmldoc(void) ...@@ -185,7 +185,7 @@ static void test_xmldoc(void)
inner = (IXMLElementCollection *)0xdeadbeef; inner = (IXMLElementCollection *)0xdeadbeef;
hr = IXMLElement_get_children(value, &inner); hr = IXMLElement_get_children(value, &inner);
ok(hr == 1, "Expected 1, got %d\n", hr); ok(hr == 1, "Expected 1, got %08x\n", hr);
ok(inner == NULL, "Expected NULL inner, got %p\n", inner); ok(inner == NULL, "Expected NULL inner, got %p\n", inner);
IXMLElement_Release(value); IXMLElement_Release(value);
...@@ -195,37 +195,37 @@ static void test_xmldoc(void) ...@@ -195,37 +195,37 @@ static void test_xmldoc(void)
V_I4(&vIndex) = 1; V_I4(&vIndex) = 1;
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child); hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_tagName(child, &name); hr = IXMLElement_get_tagName(child, &name);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szName), "Expected NAME\n"); ok(!lstrcmpW(name, szName), "Expected NAME\n");
SysFreeString(name); SysFreeString(name);
hr = IXMLElement_get_children(child, &inner); hr = IXMLElement_get_children(child, &inner);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(inner != NULL, "Expected non-NULL inner\n"); ok(inner != NULL, "Expected non-NULL inner\n");
hr = IXMLElementCollection_get_length(inner, &num_child); hr = IXMLElementCollection_get_length(inner, &num_child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 1, "Expected 1, got %ld\n", num_child); ok(num_child == 1, "Expected 1, got %ld\n", num_child);
V_I4(&vIndex) = 0; V_I4(&vIndex) = 0;
hr = IXMLElementCollection_item(inner, vIndex, vName, (IDispatch **)&value); hr = IXMLElementCollection_item(inner, vIndex, vName, (IDispatch **)&value);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(value != NULL, "Expected non-NULL value\n"); ok(value != NULL, "Expected non-NULL value\n");
hr = IXMLElement_get_type(value, &type); hr = IXMLElement_get_type(value, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %ld\n", type); ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %ld\n", type);
hr = IXMLElement_get_text(value, &name); hr = IXMLElement_get_text(value, &name);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(name, szNameVal), "Expected 'Captain Ahab'\n"); ok(!lstrcmpW(name, szNameVal), "Expected 'Captain Ahab'\n");
SysFreeString(name); SysFreeString(name);
...@@ -233,7 +233,7 @@ static void test_xmldoc(void) ...@@ -233,7 +233,7 @@ static void test_xmldoc(void)
inner = (IXMLElementCollection *)0xdeadbeef; inner = (IXMLElementCollection *)0xdeadbeef;
hr = IXMLElement_get_children(value, &inner); hr = IXMLElement_get_children(value, &inner);
ok(hr == 1, "Expected 1, got %d\n", hr); ok(hr == 1, "Expected 1, got %08x\n", hr);
ok(inner == NULL, "Expected NULL inner, got %p\n", inner); ok(inner == NULL, "Expected NULL inner, got %p\n", inner);
IXMLElement_Release(value); IXMLElement_Release(value);
...@@ -269,7 +269,7 @@ static void test_createElement(void) ...@@ -269,7 +269,7 @@ static void test_createElement(void)
V_VT(&vName) = VT_NULL; V_VT(&vName) = VT_NULL;
element = (IXMLElement *)0xdeadbeef; element = (IXMLElement *)0xdeadbeef;
hr = IXMLDocument_createElement(doc, vType, vName, &element); hr = IXMLDocument_createElement(doc, vType, vName, &element);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr); ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(element == NULL, "Expected NULL element\n"); ok(element == NULL, "Expected NULL element\n");
/* invalid vType value */ /* invalid vType value */
...@@ -284,7 +284,7 @@ static void test_createElement(void) ...@@ -284,7 +284,7 @@ static void test_createElement(void)
if (element != NULL) if (element != NULL)
{ {
hr = IXMLElement_get_type(element, &type); hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* SP7 returns an XMLELEMTYPE_ELEMENT */ /* SP7 returns an XMLELEMTYPE_ELEMENT */
ok(type == XMLELEMTYPE_OTHER || type == XMLELEMTYPE_ELEMENT, ok(type == XMLELEMTYPE_OTHER || type == XMLELEMTYPE_ELEMENT,
"Expected XMLELEMTYPE_OTHER || XMLELEMTYPE_ELEMENT, got %ld\n", type); "Expected XMLELEMTYPE_OTHER || XMLELEMTYPE_ELEMENT, got %ld\n", type);
...@@ -294,7 +294,7 @@ static void test_createElement(void) ...@@ -294,7 +294,7 @@ static void test_createElement(void)
} }
else else
{ {
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %d\n", hr); ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr);
ok(element == NULL, "Expected NULL element\n"); ok(element == NULL, "Expected NULL element\n");
} }
...@@ -303,11 +303,11 @@ static void test_createElement(void) ...@@ -303,11 +303,11 @@ static void test_createElement(void)
V_I4(&vType) = XMLELEMTYPE_ELEMENT; V_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_I4; V_VT(&vName) = VT_I4;
hr = IXMLDocument_createElement(doc, vType, vName, &element); hr = IXMLDocument_createElement(doc, vType, vName, &element);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
hr = IXMLElement_get_type(element, &type); hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
IXMLElement_Release(element); IXMLElement_Release(element);
...@@ -328,13 +328,13 @@ static void test_createElement(void) ...@@ -328,13 +328,13 @@ static void test_createElement(void)
V_I4(&vType) = XMLELEMTYPE_ELEMENT; V_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_NULL; V_VT(&vName) = VT_NULL;
hr = IXMLDocument_createElement(doc, vType, vName, &element); hr = IXMLDocument_createElement(doc, vType, vName, &element);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
/* createElement does not set the new element as root */ /* createElement does not set the new element as root */
root = (IXMLElement *)0xdeadbeef; root = (IXMLElement *)0xdeadbeef;
hr = IXMLDocument_get_root(doc, &root); hr = IXMLDocument_get_root(doc, &root);
ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr); ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr);
ok(root == NULL, "Expected NULL root\n"); ok(root == NULL, "Expected NULL root\n");
IXMLElement_Release(element); IXMLElement_Release(element);
......
...@@ -63,22 +63,22 @@ static void test_xmlelem(void) ...@@ -63,22 +63,22 @@ static void test_xmlelem(void)
V_I4(&vType) = XMLELEMTYPE_ELEMENT; V_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_NULL; V_VT(&vName) = VT_NULL;
hr = IXMLDocument_createElement(doc, vType, vName, &element); hr = IXMLDocument_createElement(doc, vType, vName, &element);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
hr = IXMLElement_get_tagName(element, &str); hr = IXMLElement_get_tagName(element, &str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(lstrlenW(str) == 0, "Expected empty tag name\n"); ok(lstrlenW(str) == 0, "Expected empty tag name\n");
SysFreeString(str); SysFreeString(str);
parent = (IXMLElement *)0xdeadbeef; parent = (IXMLElement *)0xdeadbeef;
hr = IXMLElement_get_parent(element, &parent); hr = IXMLElement_get_parent(element, &parent);
ok(hr == 1, "Expected 1, got %d\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(noexist);
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == S_FALSE, "Expected S_FALSE, got %d\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));
ok(V_BSTR(&vValue) == NULL, "Expected null value\n"); ok(V_BSTR(&vValue) == NULL, "Expected null value\n");
VariantClear(&vValue); VariantClear(&vValue);
...@@ -89,13 +89,13 @@ static void test_xmlelem(void) ...@@ -89,13 +89,13 @@ static void test_xmlelem(void)
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);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
SysFreeString(val); SysFreeString(val);
str = SysAllocString(crazyCase2); str = SysAllocString(crazyCase2);
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == S_OK, "Expected S_OK, got %d\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), propVal), "Expected 'val'\n");
VariantClear(&vValue); VariantClear(&vValue);
...@@ -106,24 +106,24 @@ static void test_xmlelem(void) ...@@ -106,24 +106,24 @@ static void test_xmlelem(void)
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);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
SysFreeString(val); SysFreeString(val);
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == S_OK, "Expected S_OK, got %d\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), propVal), "Expected 'val'\n");
VariantClear(&vValue); VariantClear(&vValue);
hr = IXMLElement_removeAttribute(element, str); hr = IXMLElement_removeAttribute(element, str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* remove now nonexistent attribute */ /* remove now nonexistent attribute */
hr = IXMLElement_removeAttribute(element, str); hr = IXMLElement_removeAttribute(element, str);
ok(hr == S_FALSE, "Expected S_FALSE, got %d\n", hr); ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == 1, "Expected 1, got %d\n", hr); ok(hr == 1, "Expected 1, 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));
ok(V_BSTR(&vValue) == NULL, "Expected null value\n"); ok(V_BSTR(&vValue) == NULL, "Expected null value\n");
SysFreeString(str); SysFreeString(str);
...@@ -131,22 +131,22 @@ static void test_xmlelem(void) ...@@ -131,22 +131,22 @@ static void test_xmlelem(void)
children = (IXMLElementCollection *)0xdeadbeef; children = (IXMLElementCollection *)0xdeadbeef;
hr = IXMLElement_get_children(element, &children); hr = IXMLElement_get_children(element, &children);
ok(hr == 1, "Expected 1, got %d\n", hr); ok(hr == 1, "Expected 1, got %08x\n", hr);
ok(children == NULL, "Expected NULL collection\n"); ok(children == NULL, "Expected NULL collection\n");
hr = IXMLElement_get_type(element, &type); hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_text(element, &str); hr = IXMLElement_get_text(element, &str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(lstrlenW(str) == 0, "Expected empty text\n"); ok(lstrlenW(str) == 0, "Expected empty text\n");
SysFreeString(str); SysFreeString(str);
/* put_text with an ELEMENT */ /* put_text with an ELEMENT */
str = SysAllocString(propVal); str = SysAllocString(propVal);
hr = IXMLElement_put_text(element, str); hr = IXMLElement_put_text(element, str);
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %d\n", hr); ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
V_VT(&vType) = VT_I4; V_VT(&vType) = VT_I4;
...@@ -157,29 +157,29 @@ static void test_xmlelem(void) ...@@ -157,29 +157,29 @@ static void test_xmlelem(void)
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
hr = IXMLElement_addChild(element, child, 0, -1); hr = IXMLElement_addChild(element, child, 0, -1);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
str = SysAllocString(propVal); str = SysAllocString(propVal);
hr = IXMLElement_put_text(child, str); hr = IXMLElement_put_text(child, str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
parent = (IXMLElement *)0xdeadbeef; parent = (IXMLElement *)0xdeadbeef;
hr = IXMLElement_get_parent(child, &parent); hr = IXMLElement_get_parent(child, &parent);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(parent != element, "Expected parent != element\n"); ok(parent != element, "Expected parent != element\n");
hr = IXMLElement_get_type(parent, &type); hr = IXMLElement_get_type(parent, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
children = (IXMLElementCollection *)0xdeadbeef; children = (IXMLElementCollection *)0xdeadbeef;
hr = IXMLElement_get_children(element, &children); hr = IXMLElement_get_children(element, &children);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(children != NULL, "Expected non-NULL collection\n"); ok(children != NULL, "Expected non-NULL collection\n");
hr = IXMLElementCollection_get_length(children, &num_child); hr = IXMLElementCollection_get_length(children, &num_child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 1, "Expected 1, got %ld\n", num_child); ok(num_child == 1, "Expected 1, got %ld\n", num_child);
V_VT(&vIndex) = VT_I4; V_VT(&vIndex) = VT_I4;
...@@ -187,36 +187,36 @@ static void test_xmlelem(void) ...@@ -187,36 +187,36 @@ static void test_xmlelem(void)
V_VT(&vName) = VT_ERROR; V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND; V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
hr = IXMLElementCollection_item(children, vIndex, vName, (IDispatch **)&child2); hr = IXMLElementCollection_item(children, vIndex, vName, (IDispatch **)&child2);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(child2 != NULL, "Expected non-NULL child\n"); ok(child2 != NULL, "Expected non-NULL child\n");
hr = IXMLElement_get_type(child2, &type); hr = IXMLElement_get_type(child2, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %ld\n", type); ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %ld\n", type);
hr = IXMLElement_get_text(element, &str); hr = IXMLElement_get_text(element, &str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, propVal), "Expected 'val'\n"); ok(!lstrcmpW(str, propVal), "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 %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, propVal), "Expected 'val'\n"); ok(!lstrcmpW(str, propVal), "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(nextVal);
hr = IXMLElement_put_text(element, str); hr = IXMLElement_put_text(element, str);
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %d\n", hr); ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr);
SysFreeString(str); SysFreeString(str);
str = SysAllocString(nextVal); str = SysAllocString(nextVal);
hr = IXMLElement_put_text(child2, str); hr = IXMLElement_put_text(child2, str);
ok(hr == S_OK, "Expected S_OK, got %d\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 %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, nextVal), "Expected 'val'\n"); ok(!lstrcmpW(str, nextVal), "Expected 'val'\n");
SysFreeString(str); SysFreeString(str);
...@@ -291,18 +291,18 @@ static void test_xmlelem_collection(void) ...@@ -291,18 +291,18 @@ static void test_xmlelem_collection(void)
goto cleanup; goto cleanup;
hr = IXMLDocument_get_root(doc, &element); hr = IXMLDocument_get_root(doc, &element);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
hr = IXMLElement_get_children(element, &collection); hr = IXMLElement_get_children(element, &collection);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(collection != NULL, "Expected non-NULL collection\n"); ok(collection != NULL, "Expected non-NULL collection\n");
hr = IXMLElementCollection_get_length(collection, NULL); hr = IXMLElementCollection_get_length(collection, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr); ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
hr = IXMLElementCollection_get_length(collection, &length); hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 2, "Expected 2, got %ld\n", length); ok(length == 2, "Expected 2, got %ld\n", length);
/* IXMLElementCollection:put_length does nothing */ /* IXMLElementCollection:put_length does nothing */
...@@ -326,64 +326,64 @@ static void test_xmlelem_collection(void) ...@@ -326,64 +326,64 @@ static void test_xmlelem_collection(void)
/* make sure the length hasn't changed */ /* make sure the length hasn't changed */
hr = IXMLElementCollection_get_length(collection, &length); hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 2, "Expected 2, got %ld\n", length); ok(length == 2, "Expected 2, got %ld\n", length);
/* IXMLElementCollection implements IEnumVARIANT */ /* IXMLElementCollection implements IEnumVARIANT */
hr = IXMLElementCollection_QueryInterface(collection, &IID_IEnumVARIANT, (LPVOID *)&enumVar); hr = IXMLElementCollection_QueryInterface(collection, &IID_IEnumVARIANT, (LPVOID *)&enumVar);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(enumVar != NULL, "Expected non-NULL enumVar\n"); ok(enumVar != NULL, "Expected non-NULL enumVar\n");
IEnumVARIANT_Release(enumVar); IEnumVARIANT_Release(enumVar);
hr = IXMLElementCollection_get__newEnum(collection, &unk); hr = IXMLElementCollection_get__newEnum(collection, &unk);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(unk != NULL, "Expected non-NULL unk\n"); ok(unk != NULL, "Expected non-NULL unk\n");
hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (LPVOID *)&enumVar); hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (LPVOID *)&enumVar);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(enumVar != NULL, "Expected non-NULL enumVar\n"); ok(enumVar != NULL, "Expected non-NULL enumVar\n");
IUnknown_Release(unk); IUnknown_Release(unk);
/* <Number>1234</Number> */ /* <Number>1234</Number> */
hr = IEnumVARIANT_Next(enumVar, 1, &var, &num_vars); hr = IEnumVARIANT_Next(enumVar, 1, &var, &num_vars);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(V_VT(&var) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var)); ok(V_VT(&var) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var));
ok(num_vars == 1, "Expected 1, got %d\n", 1); ok(num_vars == 1, "Expected 1, got %d\n", 1);
hr = IUnknown_QueryInterface(V_DISPATCH(&var), &IID_IXMLElement, (LPVOID *)&child); hr = IUnknown_QueryInterface(V_DISPATCH(&var), &IID_IXMLElement, (LPVOID *)&child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
VariantClear(&var); VariantClear(&var);
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szNumber), "Expected NUMBER\n"); ok(!lstrcmpW(str, szNumber), "Expected NUMBER\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
/* <Name>Captain Ahab</Name> */ /* <Name>Captain Ahab</Name> */
hr = IEnumVARIANT_Next(enumVar, 1, &var, &num_vars); hr = IEnumVARIANT_Next(enumVar, 1, &var, &num_vars);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(V_VT(&var) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var)); ok(V_VT(&var) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var));
ok(num_vars == 1, "Expected 1, got %d\n", 1); ok(num_vars == 1, "Expected 1, got %d\n", 1);
hr = IUnknown_QueryInterface(V_DISPATCH(&var), &IID_IXMLElement, (LPVOID *)&child); hr = IUnknown_QueryInterface(V_DISPATCH(&var), &IID_IXMLElement, (LPVOID *)&child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
VariantClear(&var); VariantClear(&var);
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szName), "Expected NAME\n"); ok(!lstrcmpW(str, szName), "Expected NAME\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
...@@ -394,15 +394,15 @@ static void test_xmlelem_collection(void) ...@@ -394,15 +394,15 @@ static void test_xmlelem_collection(void)
V_VT(&vName) = VT_ERROR; V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND; V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child); hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szNumber), "Expected NUMBER\n"); ok(!lstrcmpW(str, szNumber), "Expected NUMBER\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
...@@ -413,15 +413,15 @@ static void test_xmlelem_collection(void) ...@@ -413,15 +413,15 @@ static void test_xmlelem_collection(void)
V_VT(&vName) = VT_ERROR; V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND; V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child); hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %ld\n", type);
hr = IXMLElement_get_tagName(child, &str); hr = IXMLElement_get_tagName(child, &str);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(!lstrcmpW(str, szName), "Expected NAME\n"); ok(!lstrcmpW(str, szName), "Expected NAME\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
...@@ -434,7 +434,7 @@ static void test_xmlelem_collection(void) ...@@ -434,7 +434,7 @@ static void test_xmlelem_collection(void)
V_I4(&vIndex) = -1; V_I4(&vIndex) = -1;
child = (IXMLElement *)0xdeadbeef; child = (IXMLElement *)0xdeadbeef;
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child); hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr); ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(child == NULL, "Expected NULL child\n"); ok(child == NULL, "Expected NULL child\n");
IEnumVARIANT_Release(enumVar); IEnumVARIANT_Release(enumVar);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment