Commit aebd8cd5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3/tests: Build without -DWINE_NO_LONG_TYPES.

parent a419ff8b
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = msxml3.dll TESTDLL = msxml3.dll
IMPORTS = oleaut32 ole32 user32 shlwapi IMPORTS = oleaut32 ole32 user32 shlwapi
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -38,16 +38,13 @@ ...@@ -38,16 +38,13 @@
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/test.h" #include "wine/test.h"
#define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
#define EXPECT_REF(node,ref) _expect_ref((IUnknown*)node, ref, __LINE__) #define EXPECT_REF(node,ref) _expect_ref((IUnknown*)node, ref, __LINE__)
static void _expect_ref(IUnknown* obj, ULONG ref, int line) static void _expect_ref(IUnknown* obj, ULONG ref, int line)
{ {
ULONG rc; ULONG rc;
IUnknown_AddRef(obj); IUnknown_AddRef(obj);
rc = IUnknown_Release(obj); rc = IUnknown_Release(obj);
ok_(__FILE__, line)(rc == ref, "expected refcount %d, got %d\n", ref, rc); ok_(__FILE__, line)(rc == ref, "expected refcount %ld, got %ld.\n", ref, rc);
} }
#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
...@@ -60,7 +57,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO ...@@ -60,7 +57,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
expected_hr = supported ? S_OK : E_NOINTERFACE; expected_hr = supported ? S_OK : E_NOINTERFACE;
hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
IUnknown_Release(unk); IUnknown_Release(unk);
} }
...@@ -1286,8 +1283,8 @@ static HRESULT WINAPI dispevent_Invoke(IDispatch *iface, DISPID member, REFIID r ...@@ -1286,8 +1283,8 @@ static HRESULT WINAPI dispevent_Invoke(IDispatch *iface, DISPID member, REFIID r
LONG state; LONG state;
HRESULT hr; HRESULT hr;
ok(member == 0, "expected 0 member, got %d\n", member); ok(!member, "expected 0 member, got %ld.\n", member);
ok(lcid == LOCALE_SYSTEM_DEFAULT, "expected LOCALE_SYSTEM_DEFAULT, got lcid %x\n", lcid); ok(lcid == LOCALE_SYSTEM_DEFAULT, "expected LOCALE_SYSTEM_DEFAULT, got lcid %lx.\n", lcid);
ok(flags == DISPATCH_METHOD, "expected DISPATCH_METHOD, got %d\n", flags); ok(flags == DISPATCH_METHOD, "expected DISPATCH_METHOD, got %d\n", flags);
ok(params->cArgs == 0, "got %d\n", params->cArgs); ok(params->cArgs == 0, "got %d\n", params->cArgs);
...@@ -1303,13 +1300,13 @@ static HRESULT WINAPI dispevent_Invoke(IDispatch *iface, DISPID member, REFIID r ...@@ -1303,13 +1300,13 @@ static HRESULT WINAPI dispevent_Invoke(IDispatch *iface, DISPID member, REFIID r
state = READYSTATE_UNINITIALIZED; state = READYSTATE_UNINITIALIZED;
hr = IXMLHttpRequest_get_readyState(httpreq, &state); hr = IXMLHttpRequest_get_readyState(httpreq, &state);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (state == READYSTATE_COMPLETE) if (state == READYSTATE_COMPLETE)
{ {
BSTR text = NULL; BSTR text = NULL;
hr = IXMLHttpRequest_get_responseText(httpreq, &text); hr = IXMLHttpRequest_get_responseText(httpreq, &text);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
SysFreeString(text); SysFreeString(text);
} }
...@@ -1364,10 +1361,10 @@ static void set_safety_opt(IUnknown *unk, DWORD mask, DWORD opts) ...@@ -1364,10 +1361,10 @@ static void set_safety_opt(IUnknown *unk, DWORD mask, DWORD opts)
HRESULT hr; HRESULT hr;
hr = IUnknown_QueryInterface(unk, &IID_IObjectSafety, (void**)&obj_safety); hr = IUnknown_QueryInterface(unk, &IID_IObjectSafety, (void**)&obj_safety);
ok(hr == S_OK, "Could not get IObjectSafety iface: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IObjectSafety_SetInterfaceSafetyOptions(obj_safety, &IID_IDispatch, mask, mask&opts); hr = IObjectSafety_SetInterfaceSafetyOptions(obj_safety, &IID_IDispatch, mask, mask&opts);
ok(hr == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IObjectSafety_Release(obj_safety); IObjectSafety_Release(obj_safety);
} }
...@@ -1378,7 +1375,7 @@ static void set_xhr_site(IXMLHttpRequest *xhr) ...@@ -1378,7 +1375,7 @@ static void set_xhr_site(IXMLHttpRequest *xhr)
HRESULT hr; HRESULT hr;
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site); hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site);
ok(hr == S_OK, "Could not get IObjectWithSite iface: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
g_enablecallchecks = TRUE; g_enablecallchecks = TRUE;
...@@ -1398,7 +1395,7 @@ static void set_xhr_site(IXMLHttpRequest *xhr) ...@@ -1398,7 +1395,7 @@ static void set_xhr_site(IXMLHttpRequest *xhr)
SET_EXPECT(site_qi_IOleClientSite); SET_EXPECT(site_qi_IOleClientSite);
hr = IObjectWithSite_SetSite(obj_site, &testsite); hr = IObjectWithSite_SetSite(obj_site, &testsite);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_CALLED(site_qi_IServiceProvider); CHECK_CALLED(site_qi_IServiceProvider);
todo_wine todo_wine
...@@ -1436,7 +1433,7 @@ static void _test_open(unsigned line, IXMLHttpRequest *xhr, const char *method, ...@@ -1436,7 +1433,7 @@ static void _test_open(unsigned line, IXMLHttpRequest *xhr, const char *method,
V_BOOL(&vfalse) = VARIANT_FALSE; V_BOOL(&vfalse) = VARIANT_FALSE;
hr = IXMLHttpRequest_open(xhr, _bstr_(method), _bstr_(url), vfalse, empty, empty); hr = IXMLHttpRequest_open(xhr, _bstr_(method), _bstr_(url), vfalse, empty, empty);
ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %08x, expected %08x\n", method, url, hr, exhres); ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %#lx, expected %#lx.\n", method, url, hr, exhres);
} }
#define test_server_open(a,b,c,d) _test_server_open(__LINE__,a,b,c,d) #define test_server_open(a,b,c,d) _test_server_open(__LINE__,a,b,c,d)
...@@ -1450,7 +1447,7 @@ static void _test_server_open(unsigned line, IServerXMLHTTPRequest *xhr, const c ...@@ -1450,7 +1447,7 @@ static void _test_server_open(unsigned line, IServerXMLHTTPRequest *xhr, const c
V_BOOL(&vfalse) = VARIANT_FALSE; V_BOOL(&vfalse) = VARIANT_FALSE;
hr = IServerXMLHTTPRequest_open(xhr, _bstr_(method), _bstr_(url), vfalse, empty, empty); hr = IServerXMLHTTPRequest_open(xhr, _bstr_(method), _bstr_(url), vfalse, empty, empty);
ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %08x, expected %08x\n", method, url, hr, exhres); ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %#lx, expected %#lx.\n", method, url, hr, exhres);
} }
static void test_XMLHTTP(void) static void test_XMLHTTP(void)
...@@ -1481,38 +1478,38 @@ static void test_XMLHTTP(void) ...@@ -1481,38 +1478,38 @@ static void test_XMLHTTP(void)
V_ERROR(&dummy) = DISP_E_MEMBERNOTFOUND; V_ERROR(&dummy) = DISP_E_MEMBERNOTFOUND;
hr = IXMLHttpRequest_put_onreadystatechange(xhr, NULL); hr = IXMLHttpRequest_put_onreadystatechange(xhr, NULL);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_abort(xhr); hr = IXMLHttpRequest_abort(xhr);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&varbody) = VT_I2; V_VT(&varbody) = VT_I2;
V_I2(&varbody) = 1; V_I2(&varbody) = 1;
hr = IXMLHttpRequest_get_responseBody(xhr, &varbody); hr = IXMLHttpRequest_get_responseBody(xhr, &varbody);
EXPECT_HR(hr, E_PENDING); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&varbody) == VT_EMPTY, "got type %d\n", V_VT(&varbody)); ok(V_VT(&varbody) == VT_EMPTY, "got type %d\n", V_VT(&varbody));
V_VT(&varbody) = VT_I2; V_VT(&varbody) = VT_I2;
V_I2(&varbody) = 1; V_I2(&varbody) = 1;
hr = IXMLHttpRequest_get_responseStream(xhr, &varbody); hr = IXMLHttpRequest_get_responseStream(xhr, &varbody);
EXPECT_HR(hr, E_PENDING); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&varbody) == VT_EMPTY, "got type %d\n", V_VT(&varbody)); ok(V_VT(&varbody) == VT_EMPTY, "got type %d\n", V_VT(&varbody));
/* send before open */ /* send before open */
hr = IXMLHttpRequest_send(xhr, dummy); hr = IXMLHttpRequest_send(xhr, dummy);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr); ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
/* initial status code */ /* initial status code */
hr = IXMLHttpRequest_get_status(xhr, NULL); hr = IXMLHttpRequest_get_status(xhr, NULL);
ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr); ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "Unexpected hr %#lx.\n", hr);
status = 0xdeadbeef; status = 0xdeadbeef;
hr = IXMLHttpRequest_get_status(xhr, &status); hr = IXMLHttpRequest_get_status(xhr, &status);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr); ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "got %d\n", status); ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "Unexpected state %ld.\n", status);
hr = IXMLHttpRequest_get_statusText(xhr, &str); hr = IXMLHttpRequest_get_statusText(xhr, &str);
ok(hr == E_FAIL, "got 0x%08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
/* invalid parameters */ /* invalid parameters */
test_open(xhr, NULL, NULL, E_INVALIDARG); test_open(xhr, NULL, NULL, E_INVALIDARG);
...@@ -1520,31 +1517,31 @@ static void test_XMLHTTP(void) ...@@ -1520,31 +1517,31 @@ static void test_XMLHTTP(void)
test_open(xhr, NULL, urlA, E_INVALIDARG); test_open(xhr, NULL, urlA, E_INVALIDARG);
hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, NULL); hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, NULL);
EXPECT_HR(hr, E_INVALIDARG); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), NULL); hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), NULL);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr); ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, _bstr_("value1")); hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, _bstr_("value1"));
EXPECT_HR(hr, E_INVALIDARG); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), _bstr_("value1")); hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), _bstr_("value1"));
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr); ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_get_readyState(xhr, NULL); hr = IXMLHttpRequest_get_readyState(xhr, NULL);
ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr); ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "Unexpected hr %#lx.\n", hr);
state = -1; state = -1;
hr = IXMLHttpRequest_get_readyState(xhr, &state); hr = IXMLHttpRequest_get_readyState(xhr, &state);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(state == READYSTATE_UNINITIALIZED, "got %d, expected READYSTATE_UNINITIALIZED\n", state); ok(state == READYSTATE_UNINITIALIZED, "Unexpected state %ld.\n", state);
httpreq = xhr; httpreq = xhr;
event = create_dispevent(); event = create_dispevent();
EXPECT_REF(event, 1); EXPECT_REF(event, 1);
hr = IXMLHttpRequest_put_onreadystatechange(xhr, event); hr = IXMLHttpRequest_put_onreadystatechange(xhr, event);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
EXPECT_REF(event, 2); EXPECT_REF(event, 2);
g_unexpectedcall = g_expectedcall = 0; g_unexpectedcall = g_expectedcall = 0;
...@@ -1557,33 +1554,33 @@ static void test_XMLHTTP(void) ...@@ -1557,33 +1554,33 @@ static void test_XMLHTTP(void)
/* status code after ::open() */ /* status code after ::open() */
status = 0xdeadbeef; status = 0xdeadbeef;
hr = IXMLHttpRequest_get_status(xhr, &status); hr = IXMLHttpRequest_get_status(xhr, &status);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr); ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "got %d\n", status); ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "Unexpected state %ld.\n", status);
state = -1; state = -1;
hr = IXMLHttpRequest_get_readyState(xhr, &state); hr = IXMLHttpRequest_get_readyState(xhr, &state);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(state == READYSTATE_LOADING, "got %d, expected READYSTATE_LOADING\n", state); ok(state == READYSTATE_LOADING, "Unexpected state %ld.\n", state);
hr = IXMLHttpRequest_abort(xhr); hr = IXMLHttpRequest_abort(xhr);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
state = -1; state = -1;
hr = IXMLHttpRequest_get_readyState(xhr, &state); hr = IXMLHttpRequest_get_readyState(xhr, &state);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(state == READYSTATE_UNINITIALIZED || broken(state == READYSTATE_LOADING) /* win2k */, ok(state == READYSTATE_UNINITIALIZED || broken(state == READYSTATE_LOADING) /* win2k */,
"got %d, expected READYSTATE_UNINITIALIZED\n", state); "Unexpected state %ld.\n", state);
test_open(xhr, "POST", urlA, S_OK); test_open(xhr, "POST", urlA, S_OK);
hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), _bstr_("value1")); hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), _bstr_("value1"));
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, _bstr_("value1")); hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, _bstr_("value1"));
EXPECT_HR(hr, E_INVALIDARG); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_(""), _bstr_("value1")); hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_(""), _bstr_("value1"));
EXPECT_HR(hr, E_INVALIDARG); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
V_VT(&varbody) = VT_BSTR; V_VT(&varbody) = VT_BSTR;
V_BSTR(&varbody) = _bstr_(bodyA); V_BSTR(&varbody) = _bstr_(bodyA);
...@@ -1595,42 +1592,42 @@ static void test_XMLHTTP(void) ...@@ -1595,42 +1592,42 @@ static void test_XMLHTTP(void)
IXMLHttpRequest_Release(xhr); IXMLHttpRequest_Release(xhr);
return; return;
} }
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* response headers */ /* response headers */
hr = IXMLHttpRequest_getAllResponseHeaders(xhr, NULL); hr = IXMLHttpRequest_getAllResponseHeaders(xhr, NULL);
ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr); ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str); hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* status line is stripped already */ /* status line is stripped already */
ok(memcmp(str, L"HTTP", 4*sizeof(WCHAR)), "got response headers %s\n", wine_dbgstr_w(str)); ok(memcmp(str, L"HTTP", 4*sizeof(WCHAR)), "got response headers %s\n", wine_dbgstr_w(str));
ok(*str, "got empty headers\n"); ok(*str, "got empty headers\n");
hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str1); hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str1);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(str1 != str, "got %p\n", str1); ok(str1 != str, "got %p\n", str1);
SysFreeString(str1); SysFreeString(str1);
SysFreeString(str); SysFreeString(str);
hr = IXMLHttpRequest_getResponseHeader(xhr, NULL, NULL); hr = IXMLHttpRequest_getResponseHeader(xhr, NULL, NULL);
EXPECT_HR(hr, E_INVALIDARG); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_getResponseHeader(xhr, _bstr_("Date"), NULL); hr = IXMLHttpRequest_getResponseHeader(xhr, _bstr_("Date"), NULL);
ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr); ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_getResponseHeader(xhr, _bstr_("Date"), &str); hr = IXMLHttpRequest_getResponseHeader(xhr, _bstr_("Date"), &str);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*str != ' ', "got leading space in header %s\n", wine_dbgstr_w(str)); ok(*str != ' ', "got leading space in header %s\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
/* status code after ::send() */ /* status code after ::send() */
status = 0xdeadbeef; status = 0;
hr = IXMLHttpRequest_get_status(xhr, &status); hr = IXMLHttpRequest_get_status(xhr, &status);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(status == 200, "got %d\n", status); ok(status == 200, "Unexpected status %ld.\n", status);
hr = IXMLHttpRequest_get_statusText(xhr, NULL); hr = IXMLHttpRequest_get_statusText(xhr, NULL);
ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr); ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_get_statusText(xhr, &str); hr = IXMLHttpRequest_get_statusText(xhr, &str);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"OK"), "got status %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, L"OK"), "got status %s\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
...@@ -1639,10 +1636,10 @@ static void test_XMLHTTP(void) ...@@ -1639,10 +1636,10 @@ static void test_XMLHTTP(void)
V_BSTR(&varbody) = _bstr_(bodyA); V_BSTR(&varbody) = _bstr_(bodyA);
hr = IXMLHttpRequest_send(xhr, varbody); hr = IXMLHttpRequest_send(xhr, varbody);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr); ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_get_responseText(xhr, &bstrResponse); hr = IXMLHttpRequest_get_responseText(xhr, &bstrResponse);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* the server currently returns "FAILED" because the Content-Type header is /* the server currently returns "FAILED" because the Content-Type header is
* not what the server expects */ * not what the server expects */
if(hr == S_OK) if(hr == S_OK)
...@@ -1656,7 +1653,7 @@ static void test_XMLHTTP(void) ...@@ -1656,7 +1653,7 @@ static void test_XMLHTTP(void)
test_open(xhr, "POST", urlA, S_OK); test_open(xhr, "POST", urlA, S_OK);
hr = IXMLHttpRequest_send(xhr, varbody); hr = IXMLHttpRequest_send(xhr, varbody);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* GET request */ /* GET request */
test_open(xhr, "GET", xmltestA, S_OK); test_open(xhr, "GET", xmltestA, S_OK);
...@@ -1670,33 +1667,33 @@ static void test_XMLHTTP(void) ...@@ -1670,33 +1667,33 @@ static void test_XMLHTTP(void)
IXMLHttpRequest_Release(xhr); IXMLHttpRequest_Release(xhr);
return; return;
} }
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_get_responseText(xhr, NULL); hr = IXMLHttpRequest_get_responseText(xhr, NULL);
ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr); ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_get_responseText(xhr, &bstrResponse); hr = IXMLHttpRequest_get_responseText(xhr, &bstrResponse);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!memcmp(bstrResponse, _bstr_(xmltestbodyA), sizeof(xmltestbodyA)*sizeof(WCHAR)), ok(!memcmp(bstrResponse, _bstr_(xmltestbodyA), sizeof(xmltestbodyA)*sizeof(WCHAR)),
"expected %s, got %s\n", xmltestbodyA, wine_dbgstr_w(bstrResponse)); "expected %s, got %s\n", xmltestbodyA, wine_dbgstr_w(bstrResponse));
SysFreeString(bstrResponse); SysFreeString(bstrResponse);
hr = IXMLHttpRequest_get_responseBody(xhr, NULL); hr = IXMLHttpRequest_get_responseBody(xhr, NULL);
EXPECT_HR(hr, E_INVALIDARG); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
V_VT(&varbody) = VT_EMPTY; V_VT(&varbody) = VT_EMPTY;
hr = IXMLHttpRequest_get_responseBody(xhr, &varbody); hr = IXMLHttpRequest_get_responseBody(xhr, &varbody);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&varbody) == (VT_ARRAY|VT_UI1), "got type %d, expected %d\n", V_VT(&varbody), VT_ARRAY|VT_UI1); ok(V_VT(&varbody) == (VT_ARRAY|VT_UI1), "got type %d, expected %d\n", V_VT(&varbody), VT_ARRAY|VT_UI1);
ok(SafeArrayGetDim(V_ARRAY(&varbody)) == 1, "got %d, expected one dimension\n", SafeArrayGetDim(V_ARRAY(&varbody))); ok(SafeArrayGetDim(V_ARRAY(&varbody)) == 1, "got %d, expected one dimension\n", SafeArrayGetDim(V_ARRAY(&varbody)));
bound = -1; bound = -1;
hr = SafeArrayGetLBound(V_ARRAY(&varbody), 1, &bound); hr = SafeArrayGetLBound(V_ARRAY(&varbody), 1, &bound);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(bound == 0, "got %d, expected zero bound\n", bound); ok(!bound, "Unexpected bound %ld.\n", bound);
hr = SafeArrayAccessData(V_ARRAY(&varbody), &ptr); hr = SafeArrayAccessData(V_ARRAY(&varbody), &ptr);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(memcmp(ptr, xmltestbodyA, sizeof(xmltestbodyA)-1) == 0, "got wrong body data\n"); ok(memcmp(ptr, xmltestbodyA, sizeof(xmltestbodyA)-1) == 0, "got wrong body data\n");
SafeArrayUnaccessData(V_ARRAY(&varbody)); SafeArrayUnaccessData(V_ARRAY(&varbody));
...@@ -1704,17 +1701,17 @@ static void test_XMLHTTP(void) ...@@ -1704,17 +1701,17 @@ static void test_XMLHTTP(void)
/* get_responseStream */ /* get_responseStream */
hr = IXMLHttpRequest_get_responseStream(xhr, NULL); hr = IXMLHttpRequest_get_responseStream(xhr, NULL);
EXPECT_HR(hr, E_INVALIDARG); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
V_VT(&varbody) = VT_EMPTY; V_VT(&varbody) = VT_EMPTY;
hr = IXMLHttpRequest_get_responseStream(xhr, &varbody); hr = IXMLHttpRequest_get_responseStream(xhr, &varbody);
ok(V_VT(&varbody) == VT_UNKNOWN, "got type %d\n", V_VT(&varbody)); ok(V_VT(&varbody) == VT_UNKNOWN, "got type %d\n", V_VT(&varbody));
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
EXPECT_REF(V_UNKNOWN(&varbody), 1); EXPECT_REF(V_UNKNOWN(&varbody), 1);
g = NULL; g = NULL;
hr = GetHGlobalFromStream((IStream*)V_UNKNOWN(&varbody), &g); hr = GetHGlobalFromStream((IStream*)V_UNKNOWN(&varbody), &g);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(g != NULL, "got %p\n", g); ok(g != NULL, "got %p\n", g);
VariantClear(&varbody); VariantClear(&varbody);
...@@ -1725,21 +1722,21 @@ static void test_XMLHTTP(void) ...@@ -1725,21 +1722,21 @@ static void test_XMLHTTP(void)
V_VT(&varbody) = VT_EMPTY; V_VT(&varbody) = VT_EMPTY;
hr = IXMLHttpRequest_send(xhr, varbody); hr = IXMLHttpRequest_send(xhr, varbody);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"no referer set"), "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 */
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site); hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IObjectWithSite_SetSite(obj_site, NULL); hr = IObjectWithSite_SetSite(obj_site, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site2); hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site2);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(obj_site == obj_site2 || broken(obj_site != obj_site2), "got new instance\n"); ok(obj_site == obj_site2 || broken(obj_site != obj_site2), "got new instance\n");
IObjectWithSite_Release(obj_site2); IObjectWithSite_Release(obj_site2);
...@@ -1750,38 +1747,38 @@ static void test_XMLHTTP(void) ...@@ -1750,38 +1747,38 @@ static void test_XMLHTTP(void)
V_VT(&varbody) = VT_EMPTY; V_VT(&varbody) = VT_EMPTY;
hr = IXMLHttpRequest_send(xhr, varbody); hr = IXMLHttpRequest_send(xhr, varbody);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, str1), "got response text %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str1)); ok(!lstrcmpW(str, str1), "got response text %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str1));
SysFreeString(str); SysFreeString(str);
SysFreeString(str1); SysFreeString(str1);
/* try to set site another time */ /* try to set site another time */
hr = IObjectWithSite_SetSite(obj_site, &testsite); hr = IObjectWithSite_SetSite(obj_site, &testsite);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IObjectWithSite_Release(obj_site); IObjectWithSite_Release(obj_site);
/* HEAD request */ /* HEAD request */
hr = IXMLHttpRequest_put_onreadystatechange(xhr, NULL); hr = IXMLHttpRequest_put_onreadystatechange(xhr, NULL);
ok(hr == S_OK, "Failed to reset state change handler, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
test_open(xhr, "HEAD", xmltestA, S_OK); test_open(xhr, "HEAD", xmltestA, S_OK);
V_VT(&varbody) = VT_EMPTY; V_VT(&varbody) = VT_EMPTY;
hr = IXMLHttpRequest_send(xhr, varbody); hr = IXMLHttpRequest_send(xhr, varbody);
ok(hr == S_OK, "Failed to send HEAD request, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
str = NULL; str = NULL;
hr = IXMLHttpRequest_get_responseText(xhr, &str); hr = IXMLHttpRequest_get_responseText(xhr, &str);
ok(hr == S_OK, "Failed to get response text, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!*str, "Unexpected text %s.\n", wine_dbgstr_w(str)); ok(!*str, "Unexpected text %s.\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str); hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str);
ok(hr == S_OK, "Failed to get response headers, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(str && *str, "Expected response headers.\n"); ok(str && *str, "Expected response headers.\n");
SysFreeString(str); SysFreeString(str);
...@@ -1795,7 +1792,7 @@ static void test_XMLHTTP(void) ...@@ -1795,7 +1792,7 @@ static void test_XMLHTTP(void)
V_VT(&varbody) = VT_EMPTY; V_VT(&varbody) = VT_EMPTY;
hr = IXMLHttpRequest_send(xhr, varbody); hr = IXMLHttpRequest_send(xhr, varbody);
todo_wine todo_wine
ok(hr == INET_E_RESOURCE_NOT_FOUND, "send to invalid host returned %#x.\n", hr); ok(hr == INET_E_RESOURCE_NOT_FOUND, "Unexpected hr %#lx.\n", hr);
IXMLHttpRequest_Release(xhr); IXMLHttpRequest_Release(xhr);
free_bstrs(); free_bstrs();
...@@ -1822,10 +1819,10 @@ static void test_server_xhr(void) ...@@ -1822,10 +1819,10 @@ static void test_server_xhr(void)
IServerXMLHTTPRequest_Release(xhr); IServerXMLHTTPRequest_Release(xhr);
return; return;
} }
ok(hr == S_OK, "send failed: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IServerXMLHTTPRequest_get_responseText(xhr, &response); hr = IServerXMLHTTPRequest_get_responseText(xhr, &response);
ok(hr == S_OK, "get_responseText failed: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!strcmp_wa(response, xmltestbodyA), "got %s\n", wine_dbgstr_w(response)); ok(!strcmp_wa(response, xmltestbodyA), "got %s\n", wine_dbgstr_w(response));
SysFreeString(response); SysFreeString(response);
...@@ -1839,7 +1836,7 @@ static void test_server_xhr(void) ...@@ -1839,7 +1836,7 @@ static void test_server_xhr(void)
V_VT(&body) = VT_EMPTY; V_VT(&body) = VT_EMPTY;
hr = IServerXMLHTTPRequest_send(xhr, body); hr = IServerXMLHTTPRequest_send(xhr, body);
todo_wine todo_wine
ok(hr == WININET_E_NAME_NOT_RESOLVED, "send to invalid host returned %#x.\n", hr); ok(hr == WININET_E_NAME_NOT_RESOLVED, "Unexpected hr %#lx.\n", hr);
IServerXMLHTTPRequest_Release(xhr); IServerXMLHTTPRequest_Release(xhr);
free_bstrs(); free_bstrs();
...@@ -1876,11 +1873,11 @@ static void test_supporterrorinfo(void) ...@@ -1876,11 +1873,11 @@ static void test_supporterrorinfo(void)
EXPECT_REF(xhr, 1); EXPECT_REF(xhr, 1);
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_ISupportErrorInfo, (void **)&errorinfo); hr = IXMLHttpRequest_QueryInterface(xhr, &IID_ISupportErrorInfo, (void **)&errorinfo);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
EXPECT_REF(xhr, 2); EXPECT_REF(xhr, 2);
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_ISupportErrorInfo, (void **)&errorinfo2); hr = IXMLHttpRequest_QueryInterface(xhr, &IID_ISupportErrorInfo, (void **)&errorinfo2);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(errorinfo == errorinfo2, "Unexpected error info instance.\n"); ok(errorinfo == errorinfo2, "Unexpected error info instance.\n");
EXPECT_REF(xhr, 3); EXPECT_REF(xhr, 3);
...@@ -1894,11 +1891,11 @@ static void test_supporterrorinfo(void) ...@@ -1894,11 +1891,11 @@ static void test_supporterrorinfo(void)
EXPECT_REF(server_xhr, 1); EXPECT_REF(server_xhr, 1);
hr = IServerXMLHTTPRequest_QueryInterface(server_xhr, &IID_ISupportErrorInfo, (void **)&errorinfo); hr = IServerXMLHTTPRequest_QueryInterface(server_xhr, &IID_ISupportErrorInfo, (void **)&errorinfo);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
EXPECT_REF(server_xhr, 2); EXPECT_REF(server_xhr, 2);
hr = IServerXMLHTTPRequest_QueryInterface(server_xhr, &IID_ISupportErrorInfo, (void **)&errorinfo2); hr = IServerXMLHTTPRequest_QueryInterface(server_xhr, &IID_ISupportErrorInfo, (void **)&errorinfo2);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(errorinfo == errorinfo2, "Unexpected error info instance.\n"); ok(errorinfo == errorinfo2, "Unexpected error info instance.\n");
EXPECT_REF(server_xhr, 3); EXPECT_REF(server_xhr, 3);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -34,9 +34,6 @@ ...@@ -34,9 +34,6 @@
#include "wine/test.h" #include "wine/test.h"
#define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
{ {
...@@ -47,7 +44,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO ...@@ -47,7 +44,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
expected_hr = supported ? S_OK : E_NOINTERFACE; expected_hr = supported ? S_OK : E_NOINTERFACE;
hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
IUnknown_Release(unk); IUnknown_Release(unk);
} }
...@@ -415,26 +412,10 @@ static const CHAR szOpenSeqXML2[] = "<test><x/><x/><y/><z/><z/><w/></test>"; ...@@ -415,26 +412,10 @@ static const CHAR szOpenSeqXML2[] = "<test><x/><x/><y/><z/><z/><w/></test>";
static const CHAR szOpenSeqXML3[] = "<test><w/><x/><x/><y/><z/><z/></test>"; static const CHAR szOpenSeqXML3[] = "<test><w/><x/><x/><y/><z/><z/></test>";
static const CHAR szOpenSeqXML4[] = "<test><x/><x/><y/><z/><z/><v/></test>"; static const CHAR szOpenSeqXML4[] = "<test><x/><x/><y/><z/><z/><v/></test>";
#define check_ref_expr(expr, n) { \ static ULONG get_refcount(void *iface)
LONG ref = expr; \ {
ok(ref == n, "expected %i refs, got %i\n", n, ref); \ IUnknown_AddRef((IUnknown *)iface);
} return IUnknown_Release((IUnknown *)iface);
#define check_refs(iface, obj, n) { \
LONG ref = iface ## _AddRef(obj); \
ok(ref == n+1, "expected %i refs, got %i\n", n+1, ref); \
ref = iface ## _Release(obj); \
ok(ref == n, "expected %i refs, got %i\n", n, ref); \
}
#define ole_check(expr) { \
HRESULT r = expr; \
ok(r == S_OK, #expr " returned %x\n", r); \
}
#define ole_expect(expr, expect) { \
HRESULT r = expr; \
ok(r == (expect), #expr " returned %x, expected %x\n", r, expect); \
} }
#define _expect64(expr, str, base, TYPE, CONV) { \ #define _expect64(expr, str, base, TYPE, CONV) { \
...@@ -488,7 +469,7 @@ static void* _create_object(const GUID *clsid, const char *name, const IID *iid, ...@@ -488,7 +469,7 @@ static void* _create_object(const GUID *clsid, const char *name, const IID *iid,
hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, &obj); hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, &obj);
if (hr != S_OK) if (hr != S_OK)
win_skip_(__FILE__,line)("failed to create %s instance: 0x%08x\n", name, hr); win_skip_(__FILE__,line)("failed to create %s instance: hr %#lx.\n", name, hr);
return obj; return obj;
} }
...@@ -510,10 +491,10 @@ static void test_schema_refs(void) ...@@ -510,10 +491,10 @@ static void test_schema_refs(void)
IXMLDOMDocument2 *doc; IXMLDOMDocument2 *doc;
IXMLDOMNode *node; IXMLDOMNode *node;
IXMLDOMSchemaCollection *cache; IXMLDOMSchemaCollection *cache;
LONG len, refcount;
VARIANT v; VARIANT v;
VARIANT_BOOL b; VARIANT_BOOL b;
BSTR str; BSTR str;
LONG len;
HRESULT hr; HRESULT hr;
doc = create_document(&IID_IXMLDOMDocument2); doc = create_document(&IID_IXMLDOMDocument2);
...@@ -529,150 +510,190 @@ static void test_schema_refs(void) ...@@ -529,150 +510,190 @@ static void test_schema_refs(void)
VariantInit(&v); VariantInit(&v);
str = SysAllocString(xdr_schema_xml); str = SysAllocString(xdr_schema_xml);
ole_check(IXMLDOMDocument2_loadXML(doc, str, &b)); hr = IXMLDOMDocument2_loadXML(doc, str, &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "b %04x\n", b); ok(b == VARIANT_TRUE, "b %04x\n", b);
SysFreeString(str); SysFreeString(str);
node = (void*)0xdeadbeef; node = (void*)0xdeadbeef;
ole_check(IXMLDOMSchemaCollection_get(cache, NULL, &node)); hr = IXMLDOMSchemaCollection_get(cache, NULL, &node);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(node == NULL, "%p\n", node); ok(node == NULL, "%p\n", node);
/* NULL uri pointer, still adds a document */ /* NULL uri pointer, still adds a document */
ole_check(IXMLDOMSchemaCollection_add(cache, NULL, _variantdoc_(doc))); hr = IXMLDOMSchemaCollection_add(cache, NULL, _variantdoc_(doc));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &len)); hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(len == 1, "got %d\n", len); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "Unexpected length %ld.\n", len);
/* read back - empty valid BSTR */ /* read back - empty valid BSTR */
str = NULL; str = NULL;
ole_check(IXMLDOMSchemaCollection_get_namespaceURI(cache, 0, &str)); hr = IXMLDOMSchemaCollection_get_namespaceURI(cache, 0, &str);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(str && *str == 0, "got %p\n", str); ok(str && *str == 0, "got %p\n", str);
SysFreeString(str); SysFreeString(str);
node = NULL; node = NULL;
ole_check(IXMLDOMSchemaCollection_get(cache, NULL, &node)); hr = IXMLDOMSchemaCollection_get(cache, NULL, &node);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(node != NULL, "%p\n", node); ok(node != NULL, "%p\n", node);
IXMLDOMNode_Release(node); IXMLDOMNode_Release(node);
node = NULL; node = NULL;
str = SysAllocString(L""); str = SysAllocString(L"");
ole_check(IXMLDOMSchemaCollection_get(cache, str, &node)); hr = IXMLDOMSchemaCollection_get(cache, str, &node);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(node != NULL, "%p\n", node); ok(node != NULL, "%p\n", node);
IXMLDOMNode_Release(node); IXMLDOMNode_Release(node);
SysFreeString(str); SysFreeString(str);
/* remove with NULL uri */ /* remove with NULL uri */
ole_check(IXMLDOMSchemaCollection_remove(cache, NULL)); hr = IXMLDOMSchemaCollection_remove(cache, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &len)); hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(len == 0, "got %d\n", len); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "Unexpected length %ld.\n", len);
/* same, but with VT_UNKNOWN type */ /* same, but with VT_UNKNOWN type */
V_VT(&v) = VT_UNKNOWN; V_VT(&v) = VT_UNKNOWN;
V_UNKNOWN(&v) = (IUnknown*)doc; V_UNKNOWN(&v) = (IUnknown*)doc;
hr = IXMLDOMSchemaCollection_add(cache, NULL, v); hr = IXMLDOMSchemaCollection_add(cache, NULL, v);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
hr = IXMLDOMSchemaCollection_get_length(cache, &len); hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "got %d\n", len); ok(len == 1, "Unexpected length %ld.\n", len);
hr = IXMLDOMSchemaCollection_remove(cache, NULL); hr = IXMLDOMSchemaCollection_remove(cache, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
hr = IXMLDOMSchemaCollection_get_length(cache, &len); hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "got %d\n", len); ok(len == 0, "Unexpected length %ld.\n", len);
str = SysAllocString(L"x-schema:test.xml"); str = SysAllocString(L"x-schema:test.xml");
ole_check(IXMLDOMSchemaCollection_add(cache, str, _variantdoc_(doc))); hr = IXMLDOMSchemaCollection_add(cache, str, _variantdoc_(doc));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* IXMLDOMSchemaCollection_add doesn't add a ref on doc */ /* IXMLDOMSchemaCollection_add doesn't add a ref on doc */
check_refs(IXMLDOMDocument2, doc, 1); refcount = get_refcount(doc);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
SysFreeString(str); SysFreeString(str);
V_VT(&v) = VT_INT; V_VT(&v) = VT_INT;
ole_expect(IXMLDOMDocument2_get_schemas(doc, &v), S_FALSE); hr = IXMLDOMDocument2_get_schemas(doc, &v);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&v) == VT_NULL, "vt %x\n", V_VT(&v)); ok(V_VT(&v) == VT_NULL, "vt %x\n", V_VT(&v));
check_ref_expr(IXMLDOMSchemaCollection_AddRef(cache), 2); refcount = IXMLDOMSchemaCollection_AddRef(cache);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = (IDispatch*)cache; V_DISPATCH(&v) = (IDispatch*)cache;
/* check that putref_schemas takes a ref */ /* check that putref_schemas takes a ref */
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
check_refs(IXMLDOMSchemaCollection, cache, 3); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
refcount = get_refcount(cache);
ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
VariantClear(&v); /* refs now 2 */ VariantClear(&v); /* refs now 2 */
V_VT(&v) = VT_INT; V_VT(&v) = VT_INT;
/* check that get_schemas adds a ref */ /* check that get_schemas adds a ref */
ole_check(IXMLDOMDocument2_get_schemas(doc, &v)); hr = IXMLDOMDocument2_get_schemas(doc, &v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&v) == VT_DISPATCH, "vt %x\n", V_VT(&v)); ok(V_VT(&v) == VT_DISPATCH, "vt %x\n", V_VT(&v));
check_refs(IXMLDOMSchemaCollection, cache, 3); refcount = get_refcount(cache);
ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
/* get_schemas doesn't release a ref if passed VT_DISPATCH - ie it doesn't call VariantClear() */ /* get_schemas doesn't release a ref if passed VT_DISPATCH - ie it doesn't call VariantClear() */
ole_check(IXMLDOMDocument2_get_schemas(doc, &v)); hr = IXMLDOMDocument2_get_schemas(doc, &v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&v) == VT_DISPATCH, "vt %x\n", V_VT(&v)); ok(V_VT(&v) == VT_DISPATCH, "vt %x\n", V_VT(&v));
check_refs(IXMLDOMSchemaCollection, cache, 4); refcount = get_refcount(cache);
ok(refcount == 4, "Unexpected refcount %ld.\n", refcount);
/* release the two refs returned by get_schemas */ /* release the two refs returned by get_schemas */
check_ref_expr(IXMLDOMSchemaCollection_Release(cache), 3); refcount = IXMLDOMSchemaCollection_Release(cache);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache), 2); ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
refcount = IXMLDOMSchemaCollection_Release(cache);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
/* check that taking another ref on the document doesn't change the schema's ref count */ /* check that taking another ref on the document doesn't change the schema's ref count */
check_ref_expr(IXMLDOMDocument2_AddRef(doc), 2); refcount = IXMLDOMDocument2_AddRef(doc);
check_refs(IXMLDOMSchemaCollection, cache, 2); ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
check_ref_expr(IXMLDOMDocument2_Release(doc), 1); refcount = get_refcount(cache);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
refcount = IXMLDOMDocument2_Release(doc);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
/* call putref_schema with some odd variants */ /* call putref_schema with some odd variants */
V_VT(&v) = VT_INT; V_VT(&v) = VT_INT;
ole_expect(IXMLDOMDocument2_putref_schemas(doc, v), E_FAIL); hr = IXMLDOMDocument2_putref_schemas(doc, v);
check_refs(IXMLDOMSchemaCollection, cache, 2); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
refcount = get_refcount(cache);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
/* calling with VT_EMPTY releases the schema */ /* calling with VT_EMPTY releases the schema */
V_VT(&v) = VT_EMPTY; V_VT(&v) = VT_EMPTY;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
check_refs(IXMLDOMSchemaCollection, cache, 1); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
refcount = get_refcount(cache);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
/* try setting with VT_UNKNOWN */ /* try setting with VT_UNKNOWN */
check_ref_expr(IXMLDOMSchemaCollection_AddRef(cache), 2); refcount = IXMLDOMSchemaCollection_AddRef(cache);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
V_VT(&v) = VT_UNKNOWN; V_VT(&v) = VT_UNKNOWN;
V_UNKNOWN(&v) = (IUnknown*)cache; V_UNKNOWN(&v) = (IUnknown*)cache;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
check_refs(IXMLDOMSchemaCollection, cache, 3); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
refcount = get_refcount(cache);
ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
VariantClear(&v); /* refs now 2 */ VariantClear(&v); /* refs now 2 */
/* calling with VT_NULL releases the schema */ /* calling with VT_NULL releases the schema */
V_VT(&v) = VT_NULL; V_VT(&v) = VT_NULL;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
check_refs(IXMLDOMSchemaCollection, cache, 1); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
refcount = get_refcount(cache);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
/* refs now 1 */ /* refs now 1 */
/* set again */ /* set again */
check_ref_expr(IXMLDOMSchemaCollection_AddRef(cache), 2); refcount = IXMLDOMSchemaCollection_AddRef(cache);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
V_VT(&v) = VT_UNKNOWN; V_VT(&v) = VT_UNKNOWN;
V_UNKNOWN(&v) = (IUnknown*)cache; V_UNKNOWN(&v) = (IUnknown*)cache;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
check_refs(IXMLDOMSchemaCollection, cache, 3); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
refcount = get_refcount(cache);
ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
VariantClear(&v); /* refs now 2 */ VariantClear(&v); /* refs now 2 */
/* release the final ref on the doc which should release its ref on the schema */ /* release the final ref on the doc which should release its ref on the schema */
check_ref_expr(IXMLDOMDocument2_Release(doc), 0); refcount = IXMLDOMDocument2_Release(doc);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
check_refs(IXMLDOMSchemaCollection, cache, 1); refcount = get_refcount(cache);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache), 0); ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
refcount = IXMLDOMSchemaCollection_Release(cache);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
} }
static void test_collection_refs(void) static void test_collection_refs(void)
{ {
IXMLDOMDocument2 *schema1, *schema2, *schema3; IXMLDOMDocument2 *schema1, *schema2, *schema3;
IXMLDOMSchemaCollection *cache1, *cache2, *cache3; IXMLDOMSchemaCollection *cache1, *cache2, *cache3;
LONG refcount, length;
VARIANT_BOOL b; VARIANT_BOOL b;
LONG length; HRESULT hr;
schema1 = create_document(&IID_IXMLDOMDocument2); schema1 = create_document(&IID_IXMLDOMDocument2);
ok(schema1 != NULL, "Failed to create a document.\n"); ok(schema1 != NULL, "Failed to create a document.\n");
...@@ -695,93 +716,166 @@ static void test_collection_refs(void) ...@@ -695,93 +716,166 @@ static void test_collection_refs(void)
cache2 = create_cache(&IID_IXMLDOMSchemaCollection); cache2 = create_cache(&IID_IXMLDOMSchemaCollection);
cache3 = create_cache(&IID_IXMLDOMSchemaCollection); cache3 = create_cache(&IID_IXMLDOMSchemaCollection);
ole_check(IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1))); hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2))); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ole_check(IXMLDOMSchemaCollection_add(cache3, _bstr_(xdr_schema3_uri), _variantdoc_(schema3))); hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
check_ref_expr(IXMLDOMDocument2_Release(schema1), 0); hr = IXMLDOMSchemaCollection_add(cache3, _bstr_(xdr_schema3_uri), _variantdoc_(schema3));
check_ref_expr(IXMLDOMDocument2_Release(schema2), 0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
check_ref_expr(IXMLDOMDocument2_Release(schema3), 0);
refcount = IXMLDOMDocument2_Release(schema1);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
refcount = IXMLDOMDocument2_Release(schema2);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
refcount = IXMLDOMDocument2_Release(schema3);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
schema1 = NULL; schema1 = NULL;
schema2 = NULL; schema2 = NULL;
schema3 = NULL; schema3 = NULL;
/* releasing the original doc does not affect the schema cache */ /* releasing the original doc does not affect the schema cache */
ole_check(IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1)); hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1);
ole_check(IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2)); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ole_check(IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3)); hr = IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* we get a read-only domdoc interface, created just for us */ /* we get a read-only domdoc interface, created just for us */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1); if (schema1)
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1); {
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1); refcount = get_refcount(schema1);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
ole_expect(IXMLDOMSchemaCollection_addCollection(cache1, NULL), E_POINTER); if (schema2)
ole_check(IXMLDOMSchemaCollection_addCollection(cache2, cache1)); {
ole_check(IXMLDOMSchemaCollection_addCollection(cache3, cache2)); refcount = get_refcount(schema2);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
length = -1; if (schema3)
ole_check(IXMLDOMSchemaCollection_get_length(cache1, &length)); {
ok(length == 1, "expected length 1, got %i\n", length); refcount = get_refcount(schema3);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
hr = IXMLDOMSchemaCollection_addCollection(cache1, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_addCollection(cache2, cache1);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_addCollection(cache3, cache2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache2, &length)); hr = IXMLDOMSchemaCollection_get_length(cache1, &length);
ok(length == 2, "expected length 2, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 1, "Unexpected length %ld.\n", length);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache3, &length)); hr = IXMLDOMSchemaCollection_get_length(cache2, &length);
ok(length == 3, "expected length 3, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Unexpected length %ld.\n", length);
length = -1;
hr = IXMLDOMSchemaCollection_get_length(cache3, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 3, "Unexpected length %ld.\n", length);
/* merging collections does not affect the ref count */ /* merging collections does not affect the ref count */
check_refs(IXMLDOMSchemaCollection, cache1, 1); refcount = get_refcount(cache1);
check_refs(IXMLDOMSchemaCollection, cache2, 1); ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
check_refs(IXMLDOMSchemaCollection, cache3, 1); refcount = get_refcount(cache2);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
refcount = get_refcount(cache3);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
/* nor does it affect the domdoc instances */ /* nor does it affect the domdoc instances */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1); if (schema1)
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1); {
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1); refcount = IXMLDOMDocument2_Release(schema1);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
}
if (schema2)
{
refcount = IXMLDOMDocument2_Release(schema2);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
}
if (schema3)
{
refcount = IXMLDOMDocument2_Release(schema3);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
}
if (schema1) check_ref_expr(IXMLDOMDocument2_Release(schema1), 0);
if (schema2) check_ref_expr(IXMLDOMDocument2_Release(schema2), 0);
if (schema3) check_ref_expr(IXMLDOMDocument2_Release(schema3), 0);
schema1 = NULL; schema1 = NULL;
schema2 = NULL; schema2 = NULL;
schema3 = NULL; schema3 = NULL;
/* releasing the domdoc instances doesn't change the cache */ /* releasing the domdoc instances doesn't change the cache */
ole_check(IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1)); hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1);
ole_check(IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2)); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ole_check(IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3)); hr = IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* we can just get them again */ /* we can just get them again */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1); if (schema1)
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1); {
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1); refcount = get_refcount(schema1);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
if (schema2)
{
refcount = get_refcount(schema2);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
if (schema3)
{
refcount = get_refcount(schema3);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
/* releasing the caches does not affect the domdoc instances */ /* releasing the caches does not affect the domdoc instances */
check_ref_expr(IXMLDOMSchemaCollection_Release(cache1), 0); refcount = IXMLDOMSchemaCollection_Release(cache1);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache2), 0); ok(!refcount, "Unexpected refcount %ld.\n", refcount);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache3), 0); refcount = IXMLDOMSchemaCollection_Release(cache2);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
refcount = IXMLDOMSchemaCollection_Release(cache3);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
/* they're just for us */ /* they're just for us */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1); if (schema1)
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1); {
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1); refcount = IXMLDOMDocument2_Release(schema1);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
if (schema1) check_ref_expr(IXMLDOMDocument2_Release(schema1), 0); }
if (schema2) check_ref_expr(IXMLDOMDocument2_Release(schema2), 0); if (schema2)
if (schema3) check_ref_expr(IXMLDOMDocument2_Release(schema3), 0); {
refcount = IXMLDOMDocument2_Release(schema2);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
}
if (schema3)
{
refcount = IXMLDOMDocument2_Release(schema3);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
}
free_bstrs(); free_bstrs();
} }
...@@ -791,6 +885,7 @@ static void test_length(void) ...@@ -791,6 +885,7 @@ static void test_length(void)
IXMLDOMDocument2 *schema1, *schema2, *schema3; IXMLDOMDocument2 *schema1, *schema2, *schema3;
IXMLDOMSchemaCollection *cache; IXMLDOMSchemaCollection *cache;
VARIANT_BOOL b; VARIANT_BOOL b;
HRESULT hr;
VARIANT v; VARIANT v;
LONG length; LONG length;
...@@ -813,62 +908,81 @@ static void test_length(void) ...@@ -813,62 +908,81 @@ static void test_length(void)
VariantInit(&v); VariantInit(&v);
ole_check(IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_expect(IXMLDOMSchemaCollection_get_length(cache, NULL), E_POINTER); hr = IXMLDOMSchemaCollection_get_length(cache, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
/* MSDN lies; removing a nonexistent entry produces no error */ /* MSDN lies; removing a nonexistent entry produces no error */
ole_check(IXMLDOMSchemaCollection_remove(cache, NULL)); hr = IXMLDOMSchemaCollection_remove(cache, NULL);
ole_check(IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema1_uri))); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema1_uri));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length)); hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(length == 0, "expected length 0, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 0, "Unexpected length %ld.\n", length);
ole_check(IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema1_uri), _variantdoc_(schema1))); hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length)); hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(length == 1, "expected length 1, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 1, "Unexpected length %ld.\n", length);
ole_check(IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema2_uri), _variantdoc_(schema2))); hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length)); hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(length == 2, "expected length 2, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Unexpected length %ld.\n", length);
ole_check(IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema3_uri), _variantdoc_(schema3))); hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema3_uri), _variantdoc_(schema3));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length)); hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(length == 3, "expected length 3, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 3, "Unexpected length %ld.\n", length);
/* adding with VT_NULL is the same as removing */ /* adding with VT_NULL is the same as removing */
V_VT(&v) = VT_NULL; V_VT(&v) = VT_NULL;
ole_check(IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema1_uri), v)); hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema1_uri), v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length)); hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(length == 2, "expected length 2, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Unexpected length %ld.\n", length);
ole_check(IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema2_uri))); hr = IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema2_uri));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length)); hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(length == 1, "expected length 1, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 1, "Unexpected length %ld.\n", length);
ole_check(IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema3_uri))); hr = IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema3_uri));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length)); hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(length == 0, "expected length 0, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 0, "Unexpected length %ld.\n", length);
IXMLDOMDocument2_Release(schema1); IXMLDOMDocument2_Release(schema1);
IXMLDOMDocument2_Release(schema2); IXMLDOMDocument2_Release(schema2);
...@@ -907,22 +1021,29 @@ static void test_collection_content(void) ...@@ -907,22 +1021,29 @@ static void test_collection_content(void)
return; return;
} }
ole_check(IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1))); hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema2_uri), _variantdoc_(schema2))); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema3_uri), _variantdoc_(schema3))); hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema3_uri), _variantdoc_(schema3));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache1, &length)); hr = IXMLDOMSchemaCollection_get_length(cache1, &length);
ok(length == 3, "expected length 3, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 3, "Unexpected length %ld.\n", length);
IXMLDOMDocument2_Release(schema1); IXMLDOMDocument2_Release(schema1);
IXMLDOMDocument2_Release(schema2); IXMLDOMDocument2_Release(schema2);
...@@ -935,27 +1056,38 @@ static void test_collection_content(void) ...@@ -935,27 +1056,38 @@ static void test_collection_content(void)
schema3 = create_document_version(40, &IID_IXMLDOMDocument2); schema3 = create_document_version(40, &IID_IXMLDOMDocument2);
schema4 = create_document_version(40, &IID_IXMLDOMDocument2); schema4 = create_document_version(40, &IID_IXMLDOMDocument2);
schema5 = create_document_version(40, &IID_IXMLDOMDocument2); schema5 = create_document_version(40, &IID_IXMLDOMDocument2);
ole_check(IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema3, _bstr_(xsd_schema1_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema3, _bstr_(xsd_schema1_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema4, _bstr_(xsd_schema2_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema4, _bstr_(xsd_schema2_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
ole_check(IXMLDOMDocument2_loadXML(schema5, _bstr_(xsd_schema3_xml), &b)); hr = IXMLDOMDocument2_loadXML(schema5, _bstr_(xsd_schema3_xml), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
/* combining XDR and XSD schemas in the same cache is fine */ /* combining XDR and XSD schemas in the same cache is fine */
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema1_uri), _variantdoc_(schema1))); hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2))); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema1_uri), _variantdoc_(schema3))); hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema2_uri), _variantdoc_(schema4))); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema3_uri), _variantdoc_(schema5))); hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema1_uri), _variantdoc_(schema3));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema2_uri), _variantdoc_(schema4));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema3_uri), _variantdoc_(schema5));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache2, &length)); hr = IXMLDOMSchemaCollection_get_length(cache2, &length);
ok(length == 5, "expected length 5, got %i\n", length); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 5, "Unexpected length %ld.\n", length);
IXMLDOMDocument2_Release(schema1); IXMLDOMDocument2_Release(schema1);
IXMLDOMDocument2_Release(schema2); IXMLDOMDocument2_Release(schema2);
...@@ -967,27 +1099,33 @@ static void test_collection_content(void) ...@@ -967,27 +1099,33 @@ static void test_collection_content(void)
bstr = (void*)0xdeadbeef; bstr = (void*)0xdeadbeef;
/* error if index is out of range */ /* error if index is out of range */
hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, 3, &bstr); hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, 3, &bstr);
EXPECT_HR(hr, E_FAIL); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
ok(bstr == (void*)0xdeadbeef, "got %p\n", bstr); ok(bstr == (void*)0xdeadbeef, "got %p\n", bstr);
/* error if return pointer is NULL */ /* error if return pointer is NULL */
ole_expect(IXMLDOMSchemaCollection_get_namespaceURI(cache1, 0, NULL), E_POINTER); hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, 0, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
/* pointer is checked first */ /* pointer is checked first */
ole_expect(IXMLDOMSchemaCollection_get_namespaceURI(cache1, 3, NULL), E_POINTER); hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, 3, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
schema1 = NULL; schema1 = NULL;
/* no error if ns uri does not exist */ /* no error if ns uri does not exist */
ole_check(IXMLDOMSchemaCollection_get(cache1, _bstr_(xsd_schema1_uri), (IXMLDOMNode**)&schema1)); hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xsd_schema1_uri), (IXMLDOMNode**)&schema1);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!schema1, "expected NULL\n"); ok(!schema1, "expected NULL\n");
/* a NULL bstr corresponds to no-uri ns */ /* a NULL bstr corresponds to no-uri ns */
ole_check(IXMLDOMSchemaCollection_get(cache1, NULL, (IXMLDOMNode**)&schema1)); hr = IXMLDOMSchemaCollection_get(cache1, NULL, (IXMLDOMNode**)&schema1);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!schema1, "expected NULL\n"); ok(!schema1, "expected NULL\n");
/* error if return pointer is NULL */ /* error if return pointer is NULL */
ole_expect(IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), NULL), E_POINTER); hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
{ {
bstr = NULL; bstr = NULL;
ole_check(IXMLDOMSchemaCollection_get_namespaceURI(cache1, i, &bstr)); hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, i, &bstr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(bstr != NULL && *bstr, "expected non-empty string\n"); ok(bstr != NULL && *bstr, "expected non-empty string\n");
content[i] = bstr; content[i] = bstr;
...@@ -1006,7 +1144,8 @@ static void test_collection_content(void) ...@@ -1006,7 +1144,8 @@ static void test_collection_content(void)
for (i = 0; i < 5; ++i) for (i = 0; i < 5; ++i)
{ {
bstr = NULL; bstr = NULL;
ole_check(IXMLDOMSchemaCollection_get_namespaceURI(cache2, i, &bstr)); hr = IXMLDOMSchemaCollection_get_namespaceURI(cache2, i, &bstr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(bstr != NULL && *bstr, "expected non-empty string\n"); ok(bstr != NULL && *bstr, "expected non-empty string\n");
for (j = 0; j < i; ++j) for (j = 0; j < i; ++j)
...@@ -1060,20 +1199,23 @@ L"<?xml version='1.0'?>" ...@@ -1060,20 +1199,23 @@ L"<?xml version='1.0'?>"
swprintf(buffer, ARRAY_SIZE(buffer), regex_doc, input); swprintf(buffer, ARRAY_SIZE(buffer), regex_doc, input);
bstr = SysAllocString(buffer); bstr = SysAllocString(buffer);
ole_check(IXMLDOMDocument2_loadXML(doc, bstr, &b)); hr = IXMLDOMDocument2_loadXML(doc, bstr, &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
SysFreeString(bstr); SysFreeString(bstr);
swprintf(buffer, ARRAY_SIZE(buffer), regex_schema, regex); swprintf(buffer, ARRAY_SIZE(buffer), regex_schema, regex);
bstr = SysAllocString(buffer); bstr = SysAllocString(buffer);
ole_check(IXMLDOMDocument2_loadXML(schema, bstr, &b)); hr = IXMLDOMDocument2_loadXML(schema, bstr, &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML\n"); ok(b == VARIANT_TRUE, "failed to load XML\n");
SysFreeString(bstr); SysFreeString(bstr);
/* add the schema to the cache */ /* add the schema to the cache */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
ole_check(IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v))); hr = IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
namespace = alloc_str_from_narrow("urn:test"); namespace = alloc_str_from_narrow("urn:test");
hr = IXMLDOMSchemaCollection_add(cache, namespace, v); hr = IXMLDOMSchemaCollection_add(cache, namespace, v);
...@@ -1085,9 +1227,11 @@ L"<?xml version='1.0'?>" ...@@ -1085,9 +1227,11 @@ L"<?xml version='1.0'?>"
/* associate the cache to the doc */ /* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
ole_check(IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v))); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* validate the doc /* validate the doc
...@@ -1154,13 +1298,13 @@ static void test_regex(void) ...@@ -1154,13 +1298,13 @@ static void test_regex(void)
{ {
HRESULT hr = validate_regex_document(doc60, schema60, cache60, tests[i].regex, tests[i].input); HRESULT hr = validate_regex_document(doc60, schema60, cache60, tests[i].regex, tests[i].input);
todo_wine_if(tests[i].todo) todo_wine_if(tests[i].todo)
ok(hr == S_OK, "got 0x%08x for version 60 regex %s input %s\n", ok(hr == S_OK, "got %#lx for version 60 regex %s input %s\n",
hr, wine_dbgstr_w(tests[i].regex), wine_dbgstr_w(tests[i].input)); hr, wine_dbgstr_w(tests[i].regex), wine_dbgstr_w(tests[i].input));
if (doc40 && schema40 && cache40) if (doc40 && schema40 && cache40)
{ {
hr = validate_regex_document(doc40, schema40, cache40, tests[i].regex, tests[i].input); hr = validate_regex_document(doc40, schema40, cache40, tests[i].regex, tests[i].input);
todo_wine_if(tests[i].todo) todo_wine_if(tests[i].todo)
ok(hr == S_OK, "got 0x%08x for version 40 regex %s input %s\n", ok(hr == S_OK, "got %#lx version 40 regex %s input %s\n",
hr, wine_dbgstr_w(tests[i].regex), wine_dbgstr_w(tests[i].input)); hr, wine_dbgstr_w(tests[i].regex), wine_dbgstr_w(tests[i].input));
} }
} }
...@@ -1188,6 +1332,7 @@ static void test_XDR_schemas(void) ...@@ -1188,6 +1332,7 @@ static void test_XDR_schemas(void)
IXMLDOMSchemaCollection* cache; IXMLDOMSchemaCollection* cache;
IXMLDOMParseError* err; IXMLDOMParseError* err;
VARIANT_BOOL b; VARIANT_BOOL b;
HRESULT hr;
VARIANT v; VARIANT v;
BSTR bstr; BSTR bstr;
...@@ -1206,26 +1351,32 @@ static void test_XDR_schemas(void) ...@@ -1206,26 +1351,32 @@ static void test_XDR_schemas(void)
VariantInit(&v); VariantInit(&v);
ole_check(IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML1), &b)); hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML1), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
ole_check(IXMLDOMDocument2_loadXML(schema, _bstr_(szOpenSeqXDR), &b)); hr = IXMLDOMDocument2_loadXML(schema, _bstr_(szOpenSeqXDR), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
/* load the schema */ /* load the schema */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
ole_check(IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v))); hr = IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
ole_check(IXMLDOMSchemaCollection_add(cache, _bstr_(""), v)); hr = IXMLDOMSchemaCollection_add(cache, _bstr_(""), v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* associate the cache to the doc */ /* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
ole_check(IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v))); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* validate the doc /* validate the doc
...@@ -1233,9 +1384,11 @@ static void test_XDR_schemas(void) ...@@ -1233,9 +1384,11 @@ static void test_XDR_schemas(void)
* this is fine */ * this is fine */
err = NULL; err = NULL;
bstr = NULL; bstr = NULL;
ole_check(IXMLDOMDocument2_validate(doc, &err)); hr = IXMLDOMDocument2_validate(doc, &err);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(err != NULL, "domdoc_validate() should always set err\n"); ok(err != NULL, "domdoc_validate() should always set err\n");
ole_expect(IXMLDOMParseError_get_reason(err, &bstr), S_FALSE); hr = IXMLDOMParseError_get_reason(err, &bstr);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(IXMLDOMParseError_get_reason(err, &bstr) == S_FALSE, "got error: %s\n", wine_dbgstr_w(bstr)); ok(IXMLDOMParseError_get_reason(err, &bstr) == S_FALSE, "got error: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr); SysFreeString(bstr);
IXMLDOMParseError_Release(err); IXMLDOMParseError_Release(err);
...@@ -1243,15 +1396,18 @@ static void test_XDR_schemas(void) ...@@ -1243,15 +1396,18 @@ static void test_XDR_schemas(void)
/* load the next doc */ /* load the next doc */
IXMLDOMDocument2_Release(doc); IXMLDOMDocument2_Release(doc);
doc = create_document(&IID_IXMLDOMDocument2); doc = create_document(&IID_IXMLDOMDocument2);
ole_check(IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML2), &b)); hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML2), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
/* associate the cache to the doc */ /* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
ole_check(IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v))); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* validate the doc /* validate the doc
...@@ -1259,9 +1415,11 @@ static void test_XDR_schemas(void) ...@@ -1259,9 +1415,11 @@ static void test_XDR_schemas(void)
* this is fine */ * this is fine */
err = NULL; err = NULL;
bstr = NULL; bstr = NULL;
ole_check(IXMLDOMDocument2_validate(doc, &err)); hr = IXMLDOMDocument2_validate(doc, &err);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(err != NULL, "domdoc_validate() should always set err\n"); ok(err != NULL, "domdoc_validate() should always set err\n");
ole_expect(IXMLDOMParseError_get_reason(err, &bstr), S_FALSE); hr = IXMLDOMParseError_get_reason(err, &bstr);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(IXMLDOMParseError_get_reason(err, &bstr) == S_FALSE, "got error: %s\n", wine_dbgstr_w(bstr)); ok(IXMLDOMParseError_get_reason(err, &bstr) == S_FALSE, "got error: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr); SysFreeString(bstr);
IXMLDOMParseError_Release(err); IXMLDOMParseError_Release(err);
...@@ -1269,22 +1427,26 @@ static void test_XDR_schemas(void) ...@@ -1269,22 +1427,26 @@ static void test_XDR_schemas(void)
/* load the next doc */ /* load the next doc */
IXMLDOMDocument2_Release(doc); IXMLDOMDocument2_Release(doc);
doc = create_document(&IID_IXMLDOMDocument2); doc = create_document(&IID_IXMLDOMDocument2);
ole_check(IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML3), &b)); hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML3), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
/* associate the cache to the doc */ /* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
ole_check(IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v))); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* validate the doc /* validate the doc
* fails, extra elements are only allowed at the end */ * fails, extra elements are only allowed at the end */
err = NULL; err = NULL;
bstr = NULL; bstr = NULL;
ole_expect(IXMLDOMDocument2_validate(doc, &err), S_FALSE); hr = IXMLDOMDocument2_validate(doc, &err);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(err != NULL, "domdoc_validate() should always set err\n"); ok(err != NULL, "domdoc_validate() should always set err\n");
todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr)); todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr); SysFreeString(bstr);
...@@ -1293,22 +1455,26 @@ static void test_XDR_schemas(void) ...@@ -1293,22 +1455,26 @@ static void test_XDR_schemas(void)
/* load the next doc */ /* load the next doc */
IXMLDOMDocument2_Release(doc); IXMLDOMDocument2_Release(doc);
doc = create_document(&IID_IXMLDOMDocument2); doc = create_document(&IID_IXMLDOMDocument2);
ole_check(IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML4), &b)); hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML4), &b);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
/* associate the cache to the doc */ /* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
ole_check(IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v))); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* validate the doc /* validate the doc
* fails, undeclared elements are not allowed */ * fails, undeclared elements are not allowed */
err = NULL; err = NULL;
bstr = NULL; bstr = NULL;
ole_expect(IXMLDOMDocument2_validate(doc, &err), S_FALSE); hr = IXMLDOMDocument2_validate(doc, &err);
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(err != NULL, "domdoc_validate() should always set err\n"); ok(err != NULL, "domdoc_validate() should always set err\n");
todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr)); todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr); SysFreeString(bstr);
...@@ -1389,53 +1555,53 @@ static void test_XDR_datatypes(void) ...@@ -1389,53 +1555,53 @@ static void test_XDR_datatypes(void)
} }
hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szDatatypeXML), &b); hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szDatatypeXML), &b);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
hr = IXMLDOMDocument2_loadXML(doc2, _bstr_(szDatatypeXML), &b); hr = IXMLDOMDocument2_loadXML(doc2, _bstr_(szDatatypeXML), &b);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
hr = IXMLDOMDocument2_loadXML(schema, _bstr_(szDatatypeXDR), &b); hr = IXMLDOMDocument2_loadXML(schema, _bstr_(szDatatypeXDR), &b);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "failed to load XML string\n"); ok(b == VARIANT_TRUE, "failed to load XML string\n");
err = NULL; err = NULL;
hr = IXMLDOMDocument2_validate(doc, &err); hr = IXMLDOMDocument2_validate(doc, &err);
EXPECT_HR(hr, S_FALSE); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(err != NULL, "domdoc_validate() should always set err\n"); ok(err != NULL, "domdoc_validate() should always set err\n");
hr = IXMLDOMParseError_get_errorCode(err, &l); hr = IXMLDOMParseError_get_errorCode(err, &l);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(l == E_XML_NODTD, "got %08x\n", l); ok(l == E_XML_NODTD, "Unexpected error code %#lx.\n", l);
IXMLDOMParseError_Release(err); IXMLDOMParseError_Release(err);
err = NULL; err = NULL;
hr = IXMLDOMDocument2_validate(doc2, &err); hr = IXMLDOMDocument2_validate(doc2, &err);
EXPECT_HR(hr, S_FALSE); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(err != NULL, "domdoc_validate() should always set err\n"); ok(err != NULL, "domdoc_validate() should always set err\n");
hr = IXMLDOMParseError_get_errorCode(err, &l); hr = IXMLDOMParseError_get_errorCode(err, &l);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(l == E_XML_NODTD, "got %08x\n", l); ok(l == E_XML_NODTD, "Unexpected error code %#lx.\n", l);
IXMLDOMParseError_Release(err); IXMLDOMParseError_Release(err);
/* now load the schema */ /* now load the schema */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
hr = IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v)); hr = IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v));
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
hr = IXMLDOMSchemaCollection_add(cache, _bstr_("urn:x-schema:datatype-test-xdr"), v); hr = IXMLDOMSchemaCollection_add(cache, _bstr_("urn:x-schema:datatype-test-xdr"), v);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* associate the cache to the doc */ /* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL; V_DISPATCH(&v) = NULL;
hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v)); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
hr = IXMLDOMDocument2_putref_schemas(doc2, v); hr = IXMLDOMDocument2_putref_schemas(doc2, v);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v); VariantClear(&v);
/* validate the doc */ /* validate the doc */
...@@ -1443,13 +1609,13 @@ static void test_XDR_datatypes(void) ...@@ -1443,13 +1609,13 @@ static void test_XDR_datatypes(void)
l = 0; l = 0;
bstr = NULL; bstr = NULL;
hr = IXMLDOMDocument2_validate(doc2, &err); hr = IXMLDOMDocument2_validate(doc2, &err);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(err != NULL, "domdoc_validate() should always set err\n"); ok(err != NULL, "domdoc_validate() should always set err\n");
hr = IXMLDOMParseError_get_errorCode(err, &l); hr = IXMLDOMParseError_get_errorCode(err, &l);
EXPECT_HR(hr, S_FALSE); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMParseError_get_reason(err, &bstr); hr = IXMLDOMParseError_get_reason(err, &bstr);
EXPECT_HR(hr, S_FALSE); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(l == 0, "got %08x : %s\n", l, wine_dbgstr_w(bstr)); ok(l == 0, "Unexpected value %lx : %s\n", l, wine_dbgstr_w(bstr));
SysFreeString(bstr); SysFreeString(bstr);
IXMLDOMParseError_Release(err); IXMLDOMParseError_Release(err);
...@@ -1461,20 +1627,20 @@ static void test_XDR_datatypes(void) ...@@ -1461,20 +1627,20 @@ static void test_XDR_datatypes(void)
/* check data types without the schema */ /* check data types without the schema */
hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_(ptr->query), &node); hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_(ptr->query), &node);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(node != NULL, "expected node\n"); ok(node != NULL, "expected node\n");
V_VT(&type) = VT_EMPTY; V_VT(&type) = VT_EMPTY;
V_BSTR(&type) = (void*)-1; V_BSTR(&type) = (void*)-1;
hr = IXMLDOMNode_get_dataType(node, &type); hr = IXMLDOMNode_get_dataType(node, &type);
EXPECT_HR(hr, S_FALSE); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&type) == VT_NULL, "got type %i\n", V_VT(&type)); ok(V_VT(&type) == VT_NULL, "got type %i\n", V_VT(&type));
/* when returning VT_NULL, the pointer is set to NULL */ /* when returning VT_NULL, the pointer is set to NULL */
ok(V_BSTR(&type) == NULL, "got %p\n", V_BSTR(&type)); ok(V_BSTR(&type) == NULL, "got %p\n", V_BSTR(&type));
VariantClear(&type); VariantClear(&type);
hr = IXMLDOMNode_get_nodeTypedValue(node, &type); hr = IXMLDOMNode_get_nodeTypedValue(node, &type);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&type) == VT_BSTR, "got variant type %i\n", V_VT(&v)); ok(V_VT(&type) == VT_BSTR, "got variant type %i\n", V_VT(&v));
VariantClear(&type); VariantClear(&type);
IXMLDOMNode_Release(node); IXMLDOMNode_Release(node);
...@@ -1482,27 +1648,27 @@ static void test_XDR_datatypes(void) ...@@ -1482,27 +1648,27 @@ static void test_XDR_datatypes(void)
/* check the data with schema */ /* check the data with schema */
node = NULL; node = NULL;
hr = IXMLDOMDocument2_selectSingleNode(doc2, _bstr_(ptr->query), &node); hr = IXMLDOMDocument2_selectSingleNode(doc2, _bstr_(ptr->query), &node);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(node != NULL, "expected node\n"); ok(node != NULL, "expected node\n");
V_VT(&type) = VT_EMPTY; V_VT(&type) = VT_EMPTY;
hr = IXMLDOMNode_get_dataType(node, &type); hr = IXMLDOMNode_get_dataType(node, &type);
if (ptr->typename) if (ptr->typename)
{ {
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&type) == VT_BSTR, "got type %i\n", V_VT(&type)); ok(V_VT(&type) == VT_BSTR, "got type %i\n", V_VT(&type));
ok(!lstrcmpW(V_BSTR(&type), _bstr_(ptr->typename)), "got %s\n", wine_dbgstr_w(V_BSTR(&type))); ok(!lstrcmpW(V_BSTR(&type), _bstr_(ptr->typename)), "got %s\n", wine_dbgstr_w(V_BSTR(&type)));
} }
else else
{ {
EXPECT_HR(hr, S_FALSE); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&type) == VT_NULL, "%s: got type %i\n", ptr->query, V_VT(&type)); ok(V_VT(&type) == VT_NULL, "%s: got type %i\n", ptr->query, V_VT(&type));
} }
VariantClear(&type); VariantClear(&type);
VariantClear(&v); VariantClear(&v);
hr = IXMLDOMNode_get_nodeTypedValue(node, &v); hr = IXMLDOMNode_get_nodeTypedValue(node, &v);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine_if(ptr->todo) todo_wine_if(ptr->todo)
ok(V_VT(&v) == ptr->type_schema, "%s: got variant type %i\n", ptr->query, V_VT(&v)); ok(V_VT(&v) == ptr->type_schema, "%s: got variant type %i\n", ptr->query, V_VT(&v));
...@@ -1520,12 +1686,12 @@ static void test_XDR_datatypes(void) ...@@ -1520,12 +1686,12 @@ static void test_XDR_datatypes(void)
break; break;
case VT_I4: case VT_I4:
if (!strcmp(ptr->typename, "int")) if (!strcmp(ptr->typename, "int"))
ok(V_I4(&v) == 42, "got %i\n", V_I4(&v)); ok(V_I4(&v) == 42, "got %ld\n", V_I4(&v));
else if (!strcmp(ptr->typename, "char")) else if (!strcmp(ptr->typename, "char"))
todo_wine todo_wine
ok(V_I4(&v) == 'u', "got %x\n", V_I4(&v)); ok(V_I4(&v) == 'u', "got %lx\n", V_I4(&v));
else else
ok(V_I4(&v) == -420000000, "got %i\n", V_I4(&v)); ok(V_I4(&v) == -420000000, "got %ld\n", V_I4(&v));
break; break;
case VT_I8: case VT_I8:
expect_int64(V_I8(&v), -4200000000, 10); expect_int64(V_I8(&v), -4200000000, 10);
...@@ -1547,7 +1713,7 @@ static void test_XDR_datatypes(void) ...@@ -1547,7 +1713,7 @@ static void test_XDR_datatypes(void)
ok(V_UI2(&v) == 0xFFFF, "got %04x\n", V_UI2(&v)); ok(V_UI2(&v) == 0xFFFF, "got %04x\n", V_UI2(&v));
break; break;
case VT_UI4: case VT_UI4:
ok(V_UI4(&v) == 0xFFFFFFFF, "got %08x\n", V_UI4(&v)); ok(V_UI4(&v) == 0xFFFFFFFF, "got %#lx\n", V_UI4(&v));
break; break;
case VT_UI8: case VT_UI8:
expect_uint64(V_UI8(&v), 0xFFFFFFFFFFFFFFFF, 16); expect_uint64(V_UI8(&v), 0xFFFFFFFFFFFFFFFF, 16);
...@@ -1581,11 +1747,11 @@ static void test_validate_on_load(void) ...@@ -1581,11 +1747,11 @@ static void test_validate_on_load(void)
if (!cache) return; if (!cache) return;
hr = IXMLDOMSchemaCollection2_get_validateOnLoad(cache, NULL); hr = IXMLDOMSchemaCollection2_get_validateOnLoad(cache, NULL);
EXPECT_HR(hr, E_POINTER); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
b = VARIANT_FALSE; b = VARIANT_FALSE;
hr = IXMLDOMSchemaCollection2_get_validateOnLoad(cache, &b); hr = IXMLDOMSchemaCollection2_get_validateOnLoad(cache, &b);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(b == VARIANT_TRUE, "got %d\n", b); ok(b == VARIANT_TRUE, "got %d\n", b);
IXMLDOMSchemaCollection2_Release(cache); IXMLDOMSchemaCollection2_Release(cache);
...@@ -1602,42 +1768,42 @@ static void test_obj_dispex(IUnknown *obj) ...@@ -1602,42 +1768,42 @@ static void test_obj_dispex(IUnknown *obj)
BSTR name; BSTR name;
hr = IUnknown_QueryInterface(obj, &IID_IDispatchEx, (void**)&dispex); hr = IUnknown_QueryInterface(obj, &IID_IDispatchEx, (void**)&dispex);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (FAILED(hr)) return; if (FAILED(hr)) return;
ticnt = 0; ticnt = 0;
hr = IDispatchEx_GetTypeInfoCount(dispex, &ticnt); hr = IDispatchEx_GetTypeInfoCount(dispex, &ticnt);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(ticnt == 1, "ticnt=%u\n", ticnt); ok(ticnt == 1, "ticnt=%u\n", ticnt);
name = SysAllocString(L"*"); name = SysAllocString(L"*");
hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive); hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
SysFreeString(name); SysFreeString(name);
hr = IDispatchEx_DeleteMemberByDispID(dispex, dispid); hr = IDispatchEx_DeleteMemberByDispID(dispex, dispid);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
props = 0; props = 0;
hr = IDispatchEx_GetMemberProperties(dispex, dispid, grfdexPropCanAll, &props); hr = IDispatchEx_GetMemberProperties(dispex, dispid, grfdexPropCanAll, &props);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
ok(props == 0, "expected 0 got %d\n", props); ok(props == 0, "expected 0 got %ld\n", props);
hr = IDispatchEx_GetMemberName(dispex, dispid, &name); hr = IDispatchEx_GetMemberName(dispex, dispid, &name);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
if (SUCCEEDED(hr)) SysFreeString(name); if (SUCCEEDED(hr)) SysFreeString(name);
hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_SCHEMACOLLECTION_ADD, &dispid); hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_SCHEMACOLLECTION_ADD, &dispid);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
unk = (IUnknown*)0xdeadbeef; unk = (IUnknown*)0xdeadbeef;
hr = IDispatchEx_GetNameSpaceParent(dispex, &unk); hr = IDispatchEx_GetNameSpaceParent(dispex, &unk);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk); ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
name = SysAllocString(L"testprop"); 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, "Unexpected hr %#lx.\n", hr);
SysFreeString(name); SysFreeString(name);
IDispatchEx_Release(dispex); IDispatchEx_Release(dispex);
...@@ -1656,12 +1822,12 @@ static void test_dispex(void) ...@@ -1656,12 +1822,12 @@ static void test_dispex(void)
if (!cache) return; if (!cache) return;
hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IUnknown, (void**)&unk); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IUnknown, (void**)&unk);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
test_obj_dispex(unk); test_obj_dispex(unk);
IUnknown_Release(unk); IUnknown_Release(unk);
hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatchEx, (void**)&dispex); hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatchEx, (void**)&dispex);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&arg) = VT_I4; V_VT(&arg) = VT_I4;
V_I4(&arg) = 0; V_I4(&arg) = 0;
...@@ -1673,7 +1839,7 @@ static void test_dispex(void) ...@@ -1673,7 +1839,7 @@ static void test_dispex(void)
V_VT(&ret) = VT_EMPTY; V_VT(&ret) = VT_EMPTY;
V_DISPATCH(&ret) = (void*)0x1; V_DISPATCH(&ret) = (void*)0x1;
hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL); hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL);
ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x\n", hr); ok(hr == DISP_E_MEMBERNOTFOUND, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret));
ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret));
...@@ -1698,10 +1864,10 @@ static void test_get(void) ...@@ -1698,10 +1864,10 @@ static void test_get(void)
if (!cache) return; if (!cache) return;
hr = IXMLDOMSchemaCollection2_get(cache, NULL, NULL); hr = IXMLDOMSchemaCollection2_get(cache, NULL, NULL);
ok(hr == E_NOTIMPL || hr == E_POINTER /* win8 */, "got %08x\n", hr); ok(hr == E_NOTIMPL || hr == E_POINTER /* win8 */, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection2_get(cache, _bstr_("uri"), &node); hr = IXMLDOMSchemaCollection2_get(cache, _bstr_("uri"), &node);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
IXMLDOMSchemaCollection2_Release(cache); IXMLDOMSchemaCollection2_Release(cache);
...@@ -1709,10 +1875,10 @@ static void test_get(void) ...@@ -1709,10 +1875,10 @@ static void test_get(void)
if (!cache) return; if (!cache) return;
hr = IXMLDOMSchemaCollection2_get(cache, NULL, NULL); hr = IXMLDOMSchemaCollection2_get(cache, NULL, NULL);
EXPECT_HR(hr, E_POINTER); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection2_get(cache, _bstr_("uri"), &node); hr = IXMLDOMSchemaCollection2_get(cache, _bstr_("uri"), &node);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IXMLDOMSchemaCollection2_Release(cache); IXMLDOMSchemaCollection2_Release(cache);
free_bstrs(); free_bstrs();
...@@ -1734,32 +1900,32 @@ static void test_remove(void) ...@@ -1734,32 +1900,32 @@ static void test_remove(void)
ok(doc != NULL, "got %p\n", doc); ok(doc != NULL, "got %p\n", doc);
hr = IXMLDOMDocument_loadXML(doc, _bstr_(xsd_schema1_xml), &b); hr = IXMLDOMDocument_loadXML(doc, _bstr_(xsd_schema1_xml), &b);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = (IDispatch*)doc; V_DISPATCH(&v) = (IDispatch*)doc;
hr = IXMLDOMSchemaCollection2_add(cache, _bstr_(xsd_schema1_uri), v); hr = IXMLDOMSchemaCollection2_add(cache, _bstr_(xsd_schema1_uri), v);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len); hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "got %d\n", len); ok(len == 1, "Unexpected length %ld.\n", len);
/* ::remove() is a stub for version 6 */ /* ::remove() is a stub for version 6 */
hr = IXMLDOMSchemaCollection2_remove(cache, NULL); hr = IXMLDOMSchemaCollection2_remove(cache, NULL);
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_("invaliduri")); hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_("invaliduri"));
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_(xsd_schema1_uri)); hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_(xsd_schema1_uri));
EXPECT_HR(hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len); hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "got %d\n", len); ok(len == 1, "Unexpected length %ld.\n", len);
IXMLDOMDocument_Release(doc); IXMLDOMDocument_Release(doc);
IXMLDOMSchemaCollection2_Release(cache); IXMLDOMSchemaCollection2_Release(cache);
...@@ -1773,36 +1939,36 @@ static void test_remove(void) ...@@ -1773,36 +1939,36 @@ static void test_remove(void)
ok(doc != NULL, "got %p\n", doc); ok(doc != NULL, "got %p\n", doc);
hr = IXMLDOMDocument_loadXML(doc, _bstr_(xsd_schema1_xml), &b); hr = IXMLDOMDocument_loadXML(doc, _bstr_(xsd_schema1_xml), &b);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = (IDispatch*)doc; V_DISPATCH(&v) = (IDispatch*)doc;
hr = IXMLDOMSchemaCollection2_add(cache, _bstr_(xsd_schema1_uri), v); hr = IXMLDOMSchemaCollection2_add(cache, _bstr_(xsd_schema1_uri), v);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len); hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "got %d\n", len); ok(len == 1, "Unexpected length %ld.\n", len);
hr = IXMLDOMSchemaCollection2_remove(cache, NULL); hr = IXMLDOMSchemaCollection2_remove(cache, NULL);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_("invaliduri")); hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_("invaliduri"));
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len); hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "got %d\n", len); ok(len == 1, "Unexpected length %ld.\n", len);
hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_(xsd_schema1_uri)); hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_(xsd_schema1_uri));
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1; len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len); hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "got %d\n", len); ok(len == 0, "Unexpected length %ld.\n", len);
IXMLDOMDocument_Release(doc); IXMLDOMDocument_Release(doc);
IXMLDOMSchemaCollection2_Release(cache); IXMLDOMSchemaCollection2_Release(cache);
...@@ -1821,8 +1987,8 @@ static void test_ifaces(void) ...@@ -1821,8 +1987,8 @@ static void test_ifaces(void)
/* CLSID_XMLSchemaCache60 is returned as an interface (the same as IXMLDOMSchemaCollection2). */ /* CLSID_XMLSchemaCache60 is returned as an interface (the same as IXMLDOMSchemaCollection2). */
hr = IXMLDOMSchemaCollection2_QueryInterface(cache, &CLSID_XMLSchemaCache60, (void**)&unk); hr = IXMLDOMSchemaCollection2_QueryInterface(cache, &CLSID_XMLSchemaCache60, (void**)&unk);
ok (hr == S_OK, "Could not get CLSID_XMLSchemaCache60 iface: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok (unk == (IUnknown*)cache, "unk != cache\n"); ok(unk == (IUnknown*)cache, "unk != cache\n");
IUnknown_Release(unk); IUnknown_Release(unk);
check_interface(cache, &IID_IXMLDOMSchemaCollection, TRUE); check_interface(cache, &IID_IXMLDOMSchemaCollection, TRUE);
......
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
#include "wine/test.h" #include "wine/test.h"
#define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
/* Deprecated Error Code */ /* Deprecated Error Code */
#define XML_E_INVALIDATROOTLEVEL 0xc00ce556 #define XML_E_INVALIDATROOTLEVEL 0xc00ce556
...@@ -70,10 +67,10 @@ static void create_stream_on_file(IStream **stream, LPCSTR path) ...@@ -70,10 +67,10 @@ static void create_stream_on_file(IStream **stream, LPCSTR path)
ptr = GlobalLock(hglobal); ptr = GlobalLock(hglobal);
ReadFile(hfile, ptr, file_size, &read, NULL); ReadFile(hfile, ptr, file_size, &read, NULL);
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 %ld.\n", read);
hr = CreateStreamOnHGlobal(hglobal, TRUE, stream); hr = CreateStreamOnHGlobal(hglobal, TRUE, stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*stream != NULL, "Expected non-NULL stream\n"); ok(*stream != NULL, "Expected non-NULL stream\n");
CloseHandle(hfile); CloseHandle(hfile);
...@@ -97,18 +94,18 @@ static void test_xmldoc(void) ...@@ -97,18 +94,18 @@ static void test_xmldoc(void)
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); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* IDispatch */ /* IDispatch */
hr = IXMLDocument_QueryInterface(doc, &IID_IDispatch, (void**)&disp); hr = IXMLDocument_QueryInterface(doc, &IID_IDispatch, (void**)&disp);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* just to make sure we're on right type data */ /* just to make sure we're on right type data */
hr = IDispatch_GetTypeInfo(disp, 0, 0, &ti); hr = IDispatch_GetTypeInfo(disp, 0, 0, &ti);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"root"), "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);
...@@ -116,22 +113,22 @@ static void test_xmldoc(void) ...@@ -116,22 +113,22 @@ static void test_xmldoc(void)
IDispatch_Release(disp); IDispatch_Release(disp);
hr = IXMLDocument_QueryInterface(doc, &IID_IXMLDOMDocument, (void**)&disp); hr = IXMLDocument_QueryInterface(doc, &IID_IXMLDOMDocument, (void**)&disp);
EXPECT_HR(hr, E_NOINTERFACE); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
create_xml_file("bank.xml"); create_xml_file("bank.xml");
GetFullPathNameA("bank.xml", MAX_PATH, path, NULL); GetFullPathNameA("bank.xml", MAX_PATH, path, NULL);
create_stream_on_file(&stream, path); create_stream_on_file(&stream, path);
hr = IXMLDocument_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&psi); hr = IXMLDocument_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&psi);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\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);
ok(hr == S_OK || hr == XML_E_INVALIDATROOTLEVEL, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK || hr == XML_E_INVALIDATROOTLEVEL, "Unexpected hr %#lx.\n", hr);
if(hr == XML_E_INVALIDATROOTLEVEL) if(hr == XML_E_INVALIDATROOTLEVEL)
goto cleanup; goto cleanup;
...@@ -139,86 +136,86 @@ static void test_xmldoc(void) ...@@ -139,86 +136,86 @@ static void test_xmldoc(void)
/* version field */ /* version field */
hr = IXMLDocument_get_version(doc, NULL); hr = IXMLDocument_get_version(doc, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"1.0"), "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 */
hr = IXMLDocument_get_doctype(doc, NULL); hr = IXMLDocument_get_doctype(doc, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"BANKACCOUNT"), "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);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
/* ::root() returns new instance each time */ /* ::root() returns new instance each time */
hr = IXMLDocument_get_root(doc, &child); hr = IXMLDocument_get_root(doc, &child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(child != NULL, "Expected non-NULL element\n"); ok(child != NULL, "Expected non-NULL element\n");
ok(child != element, "Expected new element instance\n"); ok(child != element, "Expected new element instance\n");
IXMLElement_Release(child); IXMLElement_Release(child);
hr = IXMLElement_get_type(element, &type); hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"BANKACCOUNT"), "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);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 2, "Expected 2, got %d\n", num_child); ok(num_child == 2, "Unexpected length %ld.\n", num_child);
V_VT(&vIndex) = VT_I4; V_VT(&vIndex) = VT_I4;
V_I4(&vIndex) = 0; V_I4(&vIndex) = 0;
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"NUMBER"), "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);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 1, "Expected 1, got %d\n", num_child); ok(num_child == 1, "Unexpected length %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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %d\n", type); ok(type == XMLELEMTYPE_TEXT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"1234"), "Expected '1234'\n"); ok(!lstrcmpW(name, L"1234"), "Expected '1234'\n");
SysFreeString(name); SysFreeString(name);
...@@ -226,7 +223,7 @@ static void test_xmldoc(void) ...@@ -226,7 +223,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 %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\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);
...@@ -236,37 +233,37 @@ static void test_xmldoc(void) ...@@ -236,37 +233,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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"NAME"), "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);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 1, "Expected 1, got %d\n", num_child); ok(num_child == 1, "Unexpected length %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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %d\n", type); ok(type == XMLELEMTYPE_TEXT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(name, L"Captain Ahab"), "Expected 'Captain Ahab'\n"); ok(!lstrcmpW(name, L"Captain Ahab"), "Expected 'Captain Ahab'\n");
SysFreeString(name); SysFreeString(name);
...@@ -274,7 +271,7 @@ static void test_xmldoc(void) ...@@ -274,7 +271,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 %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\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);
...@@ -299,14 +296,14 @@ static void test_createElement(void) ...@@ -299,14 +296,14 @@ static void test_createElement(void)
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* invalid vType type */ /* invalid vType type */
V_VT(&vType) = VT_NULL; V_VT(&vType) = VT_NULL;
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 %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(element == NULL, "Expected NULL element\n"); ok(element == NULL, "Expected NULL element\n");
/* invalid vType value */ /* invalid vType value */
...@@ -321,17 +318,16 @@ static void test_createElement(void) ...@@ -321,17 +318,16 @@ 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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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, "Unexpected type %ld.\n", type);
"Expected XMLELEMTYPE_OTHER || XMLELEMTYPE_ELEMENT, got %d\n", type);
IXMLElement_Release(element); IXMLElement_Release(element);
} }
} }
else else
{ {
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
ok(element == NULL, "Expected NULL element\n"); ok(element == NULL, "Expected NULL element\n");
} }
...@@ -340,12 +336,12 @@ static void test_createElement(void) ...@@ -340,12 +336,12 @@ 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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
IXMLElement_Release(element); IXMLElement_Release(element);
...@@ -354,24 +350,24 @@ static void test_createElement(void) ...@@ -354,24 +350,24 @@ 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, NULL); hr = IXMLDocument_createElement(doc, vType, vName, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
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 %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
ok(root == NULL, "Expected NULL root\n"); ok(root == NULL, "Expected NULL root\n");
V_VT(&vType) = VT_I4; V_VT(&vType) = VT_I4;
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
ok(root == NULL, "Expected NULL root\n"); ok(root == NULL, "Expected NULL root\n");
IXMLElement_Release(element); IXMLElement_Release(element);
...@@ -393,27 +389,27 @@ static void test_persiststreaminit(void) ...@@ -393,27 +389,27 @@ static void test_persiststreaminit(void)
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDocument_QueryInterface(doc, &IID_IPersistStreamInit, (LPVOID *)&psi); hr = IXMLDocument_QueryInterface(doc, &IID_IPersistStreamInit, (LPVOID *)&psi);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(psi != NULL, "Expected non-NULL psi\n"); ok(psi != NULL, "Expected non-NULL psi\n");
/* null arguments */ /* null arguments */
hr = IPersistStreamInit_GetSizeMax(psi, NULL); hr = IPersistStreamInit_GetSizeMax(psi, NULL);
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
hr = IPersistStreamInit_Load(psi, NULL); hr = IPersistStreamInit_Load(psi, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IPersistStreamInit_Save(psi, NULL, FALSE); hr = IPersistStreamInit_Save(psi, NULL, FALSE);
todo_wine ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IPersistStreamInit_GetClassID(psi, NULL); hr = IPersistStreamInit_GetClassID(psi, NULL);
ok(hr == E_POINTER, "Expected E_POINTER, got %08x\n", hr); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IPersistStreamInit_IsDirty(psi); hr = IPersistStreamInit_IsDirty(psi);
todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
create_xml_file("bank.xml"); create_xml_file("bank.xml");
GetFullPathNameA("bank.xml", MAX_PATH, path, NULL); GetFullPathNameA("bank.xml", MAX_PATH, path, NULL);
...@@ -422,73 +418,73 @@ static void test_persiststreaminit(void) ...@@ -422,73 +418,73 @@ static void test_persiststreaminit(void)
/* GetSizeMax not implemented */ /* GetSizeMax not implemented */
size.QuadPart = 0; size.QuadPart = 0;
hr = IPersistStreamInit_GetSizeMax(psi, &size); hr = IPersistStreamInit_GetSizeMax(psi, &size);
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
ok(size.QuadPart == 0, "Expected 0\n"); ok(size.QuadPart == 0, "Expected 0\n");
hr = IPersistStreamInit_Load(psi, stream); hr = IPersistStreamInit_Load(psi, stream);
IStream_Release(stream); IStream_Release(stream);
ok(hr == S_OK || hr == XML_E_INVALIDATROOTLEVEL, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK || hr == XML_E_INVALIDATROOTLEVEL, "Unexpected hr %#lx.\n", hr);
if(hr == XML_E_INVALIDATROOTLEVEL) if(hr == XML_E_INVALIDATROOTLEVEL)
goto cleanup; goto cleanup;
hr = IPersistStreamInit_IsDirty(psi); hr = IPersistStreamInit_IsDirty(psi);
todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
/* try to save document */ /* try to save document */
stream = NULL; stream = NULL;
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IPersistStreamInit_Save(psi, stream, FALSE); hr = IPersistStreamInit_Save(psi, stream, FALSE);
todo_wine ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stat.cbSize.QuadPart = 0; stat.cbSize.QuadPart = 0;
hr = IStream_Stat(stream, &stat, 0); hr = IStream_Stat(stream, &stat, 0);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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(L"test"); 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, "Unexpected hr %#lx.\n", hr);
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, "Unexpected hr %#lx.\n", hr);
IXMLElement_Release(element); IXMLElement_Release(element);
SysFreeString(str); SysFreeString(str);
hr = IPersistStreamInit_IsDirty(psi); hr = IPersistStreamInit_IsDirty(psi);
todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
create_stream_on_file(&stream, path); create_stream_on_file(&stream, path);
hr = IPersistStreamInit_Load(psi, stream); hr = IPersistStreamInit_Load(psi, stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
hr = IPersistStreamInit_IsDirty(psi); hr = IPersistStreamInit_IsDirty(psi);
todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
/* reset internal stream */ /* reset internal stream */
hr = IPersistStreamInit_InitNew(psi); hr = IPersistStreamInit_InitNew(psi);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IPersistStreamInit_IsDirty(psi); hr = IPersistStreamInit_IsDirty(psi);
todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
stream = NULL; stream = NULL;
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IPersistStreamInit_Save(psi, stream, FALSE); hr = IPersistStreamInit_Save(psi, stream, FALSE);
todo_wine ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stat.cbSize.QuadPart = 0; stat.cbSize.QuadPart = 0;
hr = IStream_Stat(stream, &stat, 0); hr = IStream_Stat(stream, &stat, 0);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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);
memset(&id, 0, sizeof(id)); memset(&id, 0, sizeof(id));
hr = IPersistStreamInit_GetClassID(psi, &id); hr = IPersistStreamInit_GetClassID(psi, &id);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(IsEqualCLSID(&id, &CLSID_XMLDocument), "Expected CLSID_XMLDocument\n"); ok(IsEqualCLSID(&id, &CLSID_XMLDocument), "Expected CLSID_XMLDocument\n");
cleanup: cleanup:
...@@ -520,91 +516,91 @@ static void test_xmlelem_children(void) ...@@ -520,91 +516,91 @@ static void test_xmlelem_children(void)
IXMLElement *element = NULL, *child = NULL, *child2 = NULL; IXMLElement *element = NULL, *child = NULL, *child2 = NULL;
IXMLElementCollection *collection = NULL; IXMLElementCollection *collection = NULL;
VARIANT vType, vName, vIndex; VARIANT vType, vName, vIndex;
LONG length; LONG length, refcount;
HRESULT hr; HRESULT hr;
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&vType) = VT_I4; V_VT(&vType) = VT_I4;
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
V_VT(&vType) = VT_I4; V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_TEXT; V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL; V_VT(&vName) = VT_NULL;
hr = IXMLDocument_createElement(doc, vType, vName, &child); hr = IXMLDocument_createElement(doc, vType, vName, &child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
V_VT(&vType) = VT_I4; V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_TEXT; V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL; V_VT(&vName) = VT_NULL;
hr = IXMLDocument_createElement(doc, vType, vName, &child2); hr = IXMLDocument_createElement(doc, vType, vName, &child2);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(child2 != NULL, "Expected non-NULL child\n"); ok(child2 != 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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLElement_get_children(element, &collection); hr = IXMLElement_get_children(element, &collection);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(collection != NULL, "Expected non-NULL collection\n"); ok(collection != NULL, "Expected non-NULL collection\n");
length = 0; length = 0;
hr = IXMLElementCollection_get_length(collection, &length); hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 1, "Expected 1, got %08x\n", length); ok(length == 1, "Unexpected length %ld.\n", length);
/* remove/add child and check what happens with collection */ /* remove/add child and check what happens with collection */
hr = IXMLElement_removeChild(element, child); hr = IXMLElement_removeChild(element, child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
length = -1; length = -1;
hr = IXMLElementCollection_get_length(collection, &length); hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 0, "Expected 0, got %08x\n", length); ok(!length, "Unexpected length %ld.\n", length);
IXMLElementCollection_Release(collection); IXMLElementCollection_Release(collection);
hr = IXMLElement_AddRef(child); refcount = IXMLElement_AddRef(child);
ok(hr == 2, "Expected 2, got %08x\n", hr); ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
IXMLElement_Release(child); IXMLElement_Release(child);
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, "Unexpected hr %#lx.\n", hr);
hr = IXMLElement_AddRef(child); refcount = IXMLElement_AddRef(child);
ok(hr == 2, "Expected 2, got %08x\n", hr); ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
IXMLElement_Release(child); IXMLElement_Release(child);
hr = IXMLElement_addChild(element, child2, 0, -1); hr = IXMLElement_addChild(element, child2, 0, -1);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLElement_get_children(element, &collection); hr = IXMLElement_get_children(element, &collection);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(collection != NULL, "Expected non-NULL collection\n"); ok(collection != NULL, "Expected non-NULL collection\n");
hr = IXMLElement_AddRef(child); refcount = IXMLElement_AddRef(child);
ok(hr == 2, "Expected 2, got %08x\n", hr); ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
IXMLElement_Release(child); IXMLElement_Release(child);
length = 0; length = 0;
hr = IXMLElementCollection_get_length(collection, &length); hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Expected 2, got %08x\n", length); ok(length == 2, "Unexpected length %ld.\n", length);
IXMLElement_Release(child2); IXMLElement_Release(child2);
length = 0; length = 0;
hr = IXMLElementCollection_get_length(collection, &length); hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Expected 2, got %08x\n", length); ok(length == 2, "Unexpected length %ld.\n", length);
V_VT(&vIndex) = VT_I4; V_VT(&vIndex) = VT_I4;
V_I4(&vIndex) = 1; V_I4(&vIndex) = 1;
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child2); hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child2);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(child2 != NULL, "Expected not NULL child\n"); ok(child2 != NULL, "Expected not NULL child\n");
IXMLElementCollection_Release(collection); IXMLElementCollection_Release(collection);
IXMLElement_Release(child2); IXMLElement_Release(child2);
...@@ -614,20 +610,20 @@ static void test_xmlelem_children(void) ...@@ -614,20 +610,20 @@ static void test_xmlelem_children(void)
V_I4(&vType) = XMLELEMTYPE_TEXT; V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL; V_VT(&vName) = VT_NULL;
hr = IXMLDocument_createElement(doc, vType, vName, &child2); hr = IXMLDocument_createElement(doc, vType, vName, &child2);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(child2 != NULL, "Expected non-NULL child\n"); ok(child2 != NULL, "Expected non-NULL child\n");
hr = IXMLElement_addChild(child, child2, 0, -1); hr = IXMLElement_addChild(child, child2, 0, -1);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLElement_removeChild(element, child2); hr = IXMLElement_removeChild(element, child2);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLElement_removeChild(child, child2); hr = IXMLElement_removeChild(child, child2);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLElement_removeChild(child, NULL); hr = IXMLElement_removeChild(child, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
IXMLElement_Release(element); IXMLElement_Release(element);
IXMLElement_Release(child); IXMLElement_Release(child);
...@@ -652,7 +648,7 @@ static void test_xmlelem_collection(void) ...@@ -652,7 +648,7 @@ static void test_xmlelem_collection(void)
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, "Unexpected hr %#lx.\n", hr);
create_xml_file("bank.xml"); create_xml_file("bank.xml");
GetFullPathNameA("bank.xml", MAX_PATH, pathA, NULL); GetFullPathNameA("bank.xml", MAX_PATH, pathA, NULL);
...@@ -660,131 +656,131 @@ static void test_xmlelem_collection(void) ...@@ -660,131 +656,131 @@ static void test_xmlelem_collection(void)
url = SysAllocString(path); url = SysAllocString(path);
hr = IXMLDocument_put_URL(doc, url); hr = IXMLDocument_put_URL(doc, url);
ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
SysFreeString(url); SysFreeString(url);
if(hr != S_OK) if(hr != S_OK)
goto cleanup; goto cleanup;
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, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLElementCollection_get_length(collection, &length); hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Expected 2, got %d\n", length); ok(length == 2, "Unexpected count %ld.\n", length);
/* IXMLElementCollection:put_length does nothing */ /* IXMLElementCollection:put_length does nothing */
hr = IXMLElementCollection_put_length(collection, -1); hr = IXMLElementCollection_put_length(collection, -1);
ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = IXMLElementCollection_put_length(collection, 0); hr = IXMLElementCollection_put_length(collection, 0);
ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = IXMLElementCollection_put_length(collection, 1); hr = IXMLElementCollection_put_length(collection, 1);
ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = IXMLElementCollection_put_length(collection, 2); hr = IXMLElementCollection_put_length(collection, 2);
ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = IXMLElementCollection_put_length(collection, 3); hr = IXMLElementCollection_put_length(collection, 3);
ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = IXMLElementCollection_put_length(collection, 50); hr = IXMLElementCollection_put_length(collection, 50);
ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
/* 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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Expected 2, got %d\n", length); ok(length == 2, "Unexpected count %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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk != NULL, "Expected non-NULL unk\n"); ok(unk != NULL, "Expected non-NULL unk\n");
enumVar = (void *)0xdeadbeef; enumVar = (void *)0xdeadbeef;
hr = IUnknown_QueryInterface(unk, &IID_IXMLElementCollection, (LPVOID *)&enumVar); hr = IUnknown_QueryInterface(unk, &IID_IXMLElementCollection, (LPVOID *)&enumVar);
ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
ok(enumVar == NULL || broken(enumVar == (void *)0xdeadbeef) /* XP */, "Expected NULL, got %p\n", enumVar); ok(enumVar == NULL || broken(enumVar == (void *)0xdeadbeef) /* XP */, "Expected NULL, got %p\n", enumVar);
hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (LPVOID *)&enumVar); hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (LPVOID *)&enumVar);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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[0], &num_vars); hr = IEnumVARIANT_Next(enumVar, 1, &var[0], &num_vars);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0])); ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0]));
ok(num_vars == 1, "Expected 1, got %d\n", num_vars); ok(num_vars == 1, "Unexpected count %ld.\n", num_vars);
hr = IDispatch_QueryInterface(V_DISPATCH(&var[0]), &IID_IXMLElement, (LPVOID *)&child); hr = IDispatch_QueryInterface(V_DISPATCH(&var[0]), &IID_IXMLElement, (LPVOID *)&child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
VariantClear(&var[0]); VariantClear(&var[0]);
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"NUMBER"), "Expected NUMBER\n"); ok(!lstrcmpW(str, L"NUMBER"), "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[0], &num_vars); hr = IEnumVARIANT_Next(enumVar, 1, &var[0], &num_vars);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0])); ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0]));
ok(num_vars == 1, "Expected 1, got %d\n", num_vars); ok(num_vars == 1, "Unexpected count %ld.\n", num_vars);
VariantClear(&var[0]); VariantClear(&var[0]);
/* try advance further, no children left */ /* try advance further, no children left */
V_VT(&dummy) = VT_I4; V_VT(&dummy) = VT_I4;
hr = IEnumVARIANT_Next(enumVar, 1, &dummy, &num_vars); hr = IEnumVARIANT_Next(enumVar, 1, &dummy, &num_vars);
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&dummy) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&dummy)); ok(V_VT(&dummy) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&dummy));
ok(num_vars == 0, "Expected 0, got %d\n", num_vars); ok(!num_vars, "Unexpected count %ld.\n", num_vars);
V_VT(&dummy) = VT_I4; V_VT(&dummy) = VT_I4;
hr = IEnumVARIANT_Next(enumVar, 1, &dummy, NULL); hr = IEnumVARIANT_Next(enumVar, 1, &dummy, NULL);
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&dummy) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&dummy)); ok(V_VT(&dummy) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&dummy));
hr = IEnumVARIANT_Reset(enumVar); hr = IEnumVARIANT_Reset(enumVar);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* retrieve multiple elements */ /* retrieve multiple elements */
hr = IEnumVARIANT_Next(enumVar, 2, var, &num_vars); hr = IEnumVARIANT_Next(enumVar, 2, var, &num_vars);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0])); ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0]));
ok(V_VT(&var[1]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[1])); ok(V_VT(&var[1]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[1]));
ok(num_vars == 2, "Expected 2, got %d\n", num_vars); ok(num_vars == 2, "Unexpected count %ld.\n", num_vars);
V_VT(&dummy) = VT_I4; V_VT(&dummy) = VT_I4;
hr = IEnumVARIANT_Next(enumVar, 1, &dummy, &num_vars); hr = IEnumVARIANT_Next(enumVar, 1, &dummy, &num_vars);
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&dummy) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&dummy)); ok(V_VT(&dummy) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&dummy));
ok(num_vars == 0, "Expected 0, got %d\n", num_vars); ok(!num_vars, "Unexpected count %ld.\n", num_vars);
hr = IEnumVARIANT_Reset(enumVar); hr = IEnumVARIANT_Reset(enumVar);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&var[1]); VariantClear(&var[1]);
VariantClear(&var[0]); VariantClear(&var[0]);
...@@ -793,26 +789,26 @@ static void test_xmlelem_collection(void) ...@@ -793,26 +789,26 @@ static void test_xmlelem_collection(void)
/* request more elements than available */ /* request more elements than available */
hr = IEnumVARIANT_Next(enumVar, 4, var, &num_vars); hr = IEnumVARIANT_Next(enumVar, 4, var, &num_vars);
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0])); ok(V_VT(&var[0]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[0]));
ok(V_VT(&var[1]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[1])); ok(V_VT(&var[1]) == VT_DISPATCH, "Expected VT_DISPATCH, got %d\n", V_VT(&var[1]));
ok(V_VT(&var[2]) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&var[2])); ok(V_VT(&var[2]) == VT_EMPTY, "Expected 0, got %d\n", V_VT(&var[2]));
ok(V_VT(&var[3]) == 0xcccc, "Expected invalid, got %x\n", V_VT(&var[3])); ok(V_VT(&var[3]) == 0xcccc, "Expected invalid, got %x\n", V_VT(&var[3]));
ok(num_vars == 2, "Expected 2, got %d\n", num_vars); ok(num_vars == 2, "Unexpected count %ld.\n", num_vars);
hr = IDispatch_QueryInterface(V_DISPATCH(&var[1]), &IID_IXMLElement, (LPVOID *)&child); hr = IDispatch_QueryInterface(V_DISPATCH(&var[1]), &IID_IXMLElement, (LPVOID *)&child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(child != NULL, "Expected non-NULL child\n"); ok(child != NULL, "Expected non-NULL child\n");
VariantClear(&var[1]); VariantClear(&var[1]);
VariantClear(&var[0]); VariantClear(&var[0]);
hr = IXMLElement_get_type(child, &type); hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"NAME"), "Expected NAME\n"); ok(!lstrcmpW(str, L"NAME"), "Expected NAME\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
...@@ -823,15 +819,15 @@ static void test_xmlelem_collection(void) ...@@ -823,15 +819,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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"NUMBER"), "Expected NUMBER\n"); ok(!lstrcmpW(str, L"NUMBER"), "Expected NUMBER\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
...@@ -842,28 +838,28 @@ static void test_xmlelem_collection(void) ...@@ -842,28 +838,28 @@ 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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"NAME"), "Expected NAME\n"); ok(!lstrcmpW(str, L"NAME"), "Expected NAME\n");
SysFreeString(str); SysFreeString(str);
IXMLElement_Release(child); IXMLElement_Release(child);
V_I4(&vIndex) = 100; V_I4(&vIndex) = 100;
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child); hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child);
ok(hr == E_FAIL, "Expected E_FAIL, got %08x\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
ok(child == NULL, "Expected NULL child\n"); ok(child == NULL, "Expected NULL child\n");
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 %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(child == NULL, "Expected NULL child\n"); ok(child == NULL, "Expected NULL child\n");
IEnumVARIANT_Release(enumVar); IEnumVARIANT_Release(enumVar);
...@@ -890,44 +886,44 @@ static void test_xmlelem(void) ...@@ -890,44 +886,44 @@ static void test_xmlelem(void)
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); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&vType) = VT_I4; V_VT(&vType) = VT_I4;
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);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(element != NULL, "Expected non-NULL element\n"); ok(element != NULL, "Expected non-NULL element\n");
/* test for IDispatch */ /* test for IDispatch */
disp = NULL; disp = NULL;
hr = IXMLElement_QueryInterface(element, &IID_IDispatch, (void**)&disp); hr = IXMLElement_QueryInterface(element, &IID_IDispatch, (void**)&disp);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IDispatch_GetTypeInfo(disp, 0, 0, &ti); hr = IDispatch_GetTypeInfo(disp, 0, 0, &ti);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
name = NULL; name = NULL;
hr = ITypeInfo_GetDocumentation(ti, DISPID_XMLELEMENT_TAGNAME, &name, NULL, NULL, NULL); hr = ITypeInfo_GetDocumentation(ti, DISPID_XMLELEMENT_TAGNAME, &name, NULL, NULL, NULL);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
SysFreeString(name); SysFreeString(name);
ITypeInfo_Release(ti); ITypeInfo_Release(ti);
IDispatch_Release(disp); IDispatch_Release(disp);
hr = IXMLElement_get_tagName(element, &str); hr = IXMLElement_get_tagName(element, &str);
EXPECT_HR(hr, S_OK); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!str, "Expected empty tag name, got %s\n", wine_dbgstr_w(str)); ok(!str, "Expected empty tag name, got %s\n", wine_dbgstr_w(str));
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 %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(parent == NULL, "Expected NULL parent\n"); ok(parent == NULL, "Expected NULL parent\n");
str = SysAllocString(L"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, "Unexpected hr %#lx.\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);
...@@ -938,13 +934,13 @@ static void test_xmlelem(void) ...@@ -938,13 +934,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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
SysFreeString(str); SysFreeString(str);
SysFreeString(val); SysFreeString(val);
str = SysAllocString(L"CRAZYCASE"); 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, "Unexpected hr %#lx.\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), L"val"), "Expected 'val'\n"); ok(!lstrcmpW(V_BSTR(&vValue), L"val"), "Expected 'val'\n");
VariantClear(&vValue); VariantClear(&vValue);
...@@ -955,24 +951,24 @@ static void test_xmlelem(void) ...@@ -955,24 +951,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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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), L"val"), "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);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXMLElement_getAttribute(element, str, &vValue); hr = IXMLElement_getAttribute(element, str, &vValue);
ok(hr == 1, "Expected 1, got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\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);
...@@ -980,92 +976,92 @@ static void test_xmlelem(void) ...@@ -980,92 +976,92 @@ 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 %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(str && !*str, "Expected empty text\n"); ok(str && !*str, "Expected empty text\n");
SysFreeString(str); SysFreeString(str);
/* put_text with an ELEMENT */ /* put_text with an ELEMENT */
str = SysAllocString(L"val"); 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, "Unexpected hr %#lx.\n", hr);
SysFreeString(str); SysFreeString(str);
V_VT(&vType) = VT_I4; V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_TEXT; V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL; V_VT(&vName) = VT_NULL;
hr = IXMLDocument_createElement(doc, vType, vName, &child); hr = IXMLDocument_createElement(doc, vType, vName, &child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
str = SysAllocString(L"val"); 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, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type); ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 1, "Expected 1, got %d\n", num_child); ok(num_child == 1, "Unexpected length %ld.\n", num_child);
V_VT(&vIndex) = VT_I4; V_VT(&vIndex) = VT_I4;
V_I4(&vIndex) = 0; V_I4(&vIndex) = 0;
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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\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 %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %d\n", type); ok(type == XMLELEMTYPE_TEXT, "Unexpected type %ld.\n", type);
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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"val"), "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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"val"), "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(L"next"); 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, "Unexpected hr %#lx.\n", hr);
SysFreeString(str); SysFreeString(str);
str = SysAllocString(L"next"); 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, "Unexpected hr %#lx.\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, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(str, L"next"), "Expected 'val'\n"); ok(!lstrcmpW(str, L"next"), "Expected 'val'\n");
SysFreeString(str); SysFreeString(str);
......
...@@ -108,44 +108,44 @@ static void create_test(void) ...@@ -108,44 +108,44 @@ static void create_test(void)
hr = CoCreateInstance(&CLSID_XMLParser30, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLParser, (void**)&parser); hr = CoCreateInstance(&CLSID_XMLParser30, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLParser, (void**)&parser);
if (FAILED(hr)) if (FAILED(hr))
{ {
win_skip("IXMLParser is not available (0x%08x)\n", hr); win_skip("IXMLParser is not available, hr %#lx.\n", hr);
return; return;
} }
flags = IXMLParser_GetFlags(parser); flags = IXMLParser_GetFlags(parser);
ok(flags == 0, "Expected 0 got %d\n", flags); ok(!flags, "Unexpected flags %#lx.\n", flags);
hr = IXMLParser_SetFlags(parser, XMLFLAG_SAX); hr = IXMLParser_SetFlags(parser, XMLFLAG_SAX);
ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
flags = IXMLParser_GetFlags(parser); flags = IXMLParser_GetFlags(parser);
ok(flags == XMLFLAG_SAX, "Expected 0 got %d\n", flags); ok(flags == XMLFLAG_SAX, "Unexpected flags %ld.\n", flags);
hr = IXMLParser_GetFactory(parser, NULL); hr = IXMLParser_GetFactory(parser, NULL);
ok(hr == E_INVALIDARG, "Expected S_OK got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLParser_GetFactory(parser, &nodefactory); hr = IXMLParser_GetFactory(parser, &nodefactory);
ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(nodefactory == NULL, "expected NULL\n"); ok(nodefactory == NULL, "expected NULL\n");
hr = IXMLParser_SetFactory(parser, &thenodefactory); hr = IXMLParser_SetFactory(parser, &thenodefactory);
ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLParser_GetFactory(parser, &nodefactory); hr = IXMLParser_GetFactory(parser, &nodefactory);
ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(nodefactory == &thenodefactory, "expected NULL\n"); ok(nodefactory == &thenodefactory, "expected NULL\n");
hr = IXMLParser_SetInput(parser, NULL); hr = IXMLParser_SetInput(parser, NULL);
ok(hr == E_INVALIDARG, "Expected S_OK got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXMLParser_SetFactory(parser, NULL); hr = IXMLParser_SetFactory(parser, NULL);
ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLParser_SetFlags(parser, 0); hr = IXMLParser_SetFlags(parser, 0);
ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLParser_GetParserState(parser); hr = IXMLParser_GetParserState(parser);
ok(hr == XMLPARSER_IDLE, "got 0x%08x\n", hr); ok(hr == XMLPARSER_IDLE, "Unexpected hr %#lx.\n", hr);
IXMLParser_Release(parser); IXMLParser_Release(parser);
} }
......
...@@ -128,7 +128,7 @@ static HRESULT WINAPI HTMLEvents_Invoke(IDispatch *iface, DISPID dispIdMember, R ...@@ -128,7 +128,7 @@ static HRESULT WINAPI HTMLEvents_Invoke(IDispatch *iface, DISPID dispIdMember, R
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, "Unexpected hr %#lx.\n", hr);
if (!memcmp(state, completeW, sizeof(completeW))) if (!memcmp(state, completeW, sizeof(completeW)))
loaded = TRUE; loaded = TRUE;
SysFreeString(state); SysFreeString(state);
...@@ -161,28 +161,28 @@ static void test_QueryInterface(void) ...@@ -161,28 +161,28 @@ static void test_QueryInterface(void)
win_skip("Failed to create XMLView instance\n"); win_skip("Failed to create XMLView instance\n");
return; return;
} }
ok(hres == S_OK, "CoCreateInstance returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = IUnknown_QueryInterface(xmlview, &IID_IPersistMoniker, (void**)&unk); hres = IUnknown_QueryInterface(xmlview, &IID_IPersistMoniker, (void**)&unk);
ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
IUnknown_Release(unk); IUnknown_Release(unk);
hres = IUnknown_QueryInterface(xmlview, &IID_IPersistHistory, (void**)&unk); hres = IUnknown_QueryInterface(xmlview, &IID_IPersistHistory, (void**)&unk);
ok(hres == S_OK, "QueryInterface(IID_IPersistHistory) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
IUnknown_Release(unk); IUnknown_Release(unk);
hres = IUnknown_QueryInterface(xmlview, &IID_IOleCommandTarget, (void**)&unk); hres = IUnknown_QueryInterface(xmlview, &IID_IOleCommandTarget, (void**)&unk);
ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
IUnknown_Release(unk); IUnknown_Release(unk);
hres = IUnknown_QueryInterface(xmlview, &IID_IOleObject, (void**)&unk); hres = IUnknown_QueryInterface(xmlview, &IID_IOleObject, (void**)&unk);
ok(hres == S_OK, "QueryInterface(IID_IOleObject) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
IUnknown_Release(unk); IUnknown_Release(unk);
hres = IUnknown_QueryInterface(xmlview, &IID_IHTMLDocument, (void**)&htmldoc); hres = IUnknown_QueryInterface(xmlview, &IID_IHTMLDocument, (void**)&htmldoc);
ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = IHTMLDocument_QueryInterface(htmldoc, &IID_IUnknown, (void**)&unk); hres = IHTMLDocument_QueryInterface(htmldoc, &IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "QueryInterface(IID_IUnknown) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
ok(unk == xmlview, "Aggregation is not working as expected\n"); ok(unk == xmlview, "Aggregation is not working as expected\n");
IUnknown_Release(unk); IUnknown_Release(unk);
IHTMLDocument_Release(htmldoc); IHTMLDocument_Release(htmldoc);
...@@ -218,26 +218,26 @@ static void test_Load(void) ...@@ -218,26 +218,26 @@ static void test_Load(void)
win_skip("Failed to create XMLView instance\n"); win_skip("Failed to create XMLView instance\n");
return; return;
} }
ok(hres == S_OK, "CoCreateInstance returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = IPersistMoniker_QueryInterface(pers_mon, &IID_IHTMLDocument2, (void**)&html_doc); hres = IPersistMoniker_QueryInterface(pers_mon, &IID_IHTMLDocument2, (void**)&html_doc);
ok(hres == S_OK, "QueryInterface(HTMLDocument2) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = IPersistMoniker_QueryInterface(pers_mon, &IID_IConnectionPointContainer, (void**)&cpc); hres = IPersistMoniker_QueryInterface(pers_mon, &IID_IConnectionPointContainer, (void**)&cpc);
ok(hres == S_OK, "QueryInterface(IConnectionPointContainer) returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = IConnectionPointContainer_FindConnectionPoint(cpc, &IID_IDispatch, &cp); hres = IConnectionPointContainer_FindConnectionPoint(cpc, &IID_IDispatch, &cp);
ok(hres == S_OK, "FindConnectionPoint returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = IConnectionPoint_Advise(cp, (IUnknown*)&HTMLEvents, NULL); hres = IConnectionPoint_Advise(cp, (IUnknown*)&HTMLEvents, NULL);
ok(hres == S_OK, "Advise returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
IConnectionPoint_Release(cp); IConnectionPoint_Release(cp);
IConnectionPointContainer_Release(cpc); IConnectionPointContainer_Release(cpc);
hres = CreateBindCtx(0, &bctx); hres = CreateBindCtx(0, &bctx);
ok(hres == S_OK, "CreateBindCtx returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = pCreateURLMoniker(NULL, buf, &mon); hres = pCreateURLMoniker(NULL, buf, &mon);
ok(hres == S_OK, "CreateUrlMoniker returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
loaded = FALSE; loaded = FALSE;
hres = IPersistMoniker_Load(pers_mon, TRUE, mon, bctx, 0); hres = IPersistMoniker_Load(pers_mon, TRUE, mon, bctx, 0);
ok(hres == S_OK, "Load returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
IBindCtx_Release(bctx); IBindCtx_Release(bctx);
IMoniker_Release(mon); IMoniker_Release(mon);
...@@ -247,9 +247,9 @@ static void test_Load(void) ...@@ -247,9 +247,9 @@ static void test_Load(void)
} }
hres = IHTMLDocument2_get_body(html_doc, &elem); hres = IHTMLDocument2_get_body(html_doc, &elem);
ok(hres == S_OK, "get_body returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
hres = IHTMLElement_get_outerHTML(elem, &source); hres = IHTMLElement_get_outerHTML(elem, &source);
ok(hres == S_OK, "get_outerHTML returned %x, expected S_OK\n", hres); ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
ok(!html_src_compare(source, xmlview_html), "Incorrect HTML source: %s\n", wine_dbgstr_w(source)); ok(!html_src_compare(source, xmlview_html), "Incorrect HTML source: %s\n", wine_dbgstr_w(source));
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
SysFreeString(source); SysFreeString(source);
......
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