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
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 @@
#include "wine/heap.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__)
static void _expect_ref(IUnknown* obj, ULONG ref, int line)
{
ULONG rc;
IUnknown_AddRef(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)
......@@ -60,7 +57,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
expected_hr = supported ? S_OK : E_NOINTERFACE;
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))
IUnknown_Release(unk);
}
......@@ -1286,8 +1283,8 @@ static HRESULT WINAPI dispevent_Invoke(IDispatch *iface, DISPID member, REFIID r
LONG state;
HRESULT hr;
ok(member == 0, "expected 0 member, got %d\n", member);
ok(lcid == LOCALE_SYSTEM_DEFAULT, "expected LOCALE_SYSTEM_DEFAULT, got lcid %x\n", lcid);
ok(!member, "expected 0 member, got %ld.\n", member);
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(params->cArgs == 0, "got %d\n", params->cArgs);
......@@ -1303,13 +1300,13 @@ static HRESULT WINAPI dispevent_Invoke(IDispatch *iface, DISPID member, REFIID r
state = READYSTATE_UNINITIALIZED;
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)
{
BSTR text = NULL;
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);
}
......@@ -1364,10 +1361,10 @@ static void set_safety_opt(IUnknown *unk, DWORD mask, DWORD opts)
HRESULT hr;
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);
ok(hr == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IObjectSafety_Release(obj_safety);
}
......@@ -1378,7 +1375,7 @@ static void set_xhr_site(IXMLHttpRequest *xhr)
HRESULT hr;
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;
......@@ -1398,7 +1395,7 @@ static void set_xhr_site(IXMLHttpRequest *xhr)
SET_EXPECT(site_qi_IOleClientSite);
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);
todo_wine
......@@ -1436,7 +1433,7 @@ static void _test_open(unsigned line, IXMLHttpRequest *xhr, const char *method,
V_BOOL(&vfalse) = VARIANT_FALSE;
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)
......@@ -1450,7 +1447,7 @@ static void _test_server_open(unsigned line, IServerXMLHTTPRequest *xhr, const c
V_BOOL(&vfalse) = VARIANT_FALSE;
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)
......@@ -1481,38 +1478,38 @@ static void test_XMLHTTP(void)
V_ERROR(&dummy) = DISP_E_MEMBERNOTFOUND;
hr = IXMLHttpRequest_put_onreadystatechange(xhr, NULL);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLHttpRequest_abort(xhr);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&varbody) = VT_I2;
V_I2(&varbody) = 1;
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));
V_VT(&varbody) = VT_I2;
V_I2(&varbody) = 1;
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));
/* send before open */
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 */
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;
hr = IXMLHttpRequest_get_status(xhr, &status);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "got %d\n", status);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "Unexpected state %ld.\n", status);
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 */
test_open(xhr, NULL, NULL, E_INVALIDARG);
......@@ -1520,31 +1517,31 @@ static void test_XMLHTTP(void)
test_open(xhr, NULL, urlA, E_INVALIDARG);
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);
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"));
EXPECT_HR(hr, E_INVALIDARG);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
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);
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;
hr = IXMLHttpRequest_get_readyState(xhr, &state);
EXPECT_HR(hr, S_OK);
ok(state == READYSTATE_UNINITIALIZED, "got %d, expected READYSTATE_UNINITIALIZED\n", state);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(state == READYSTATE_UNINITIALIZED, "Unexpected state %ld.\n", state);
httpreq = xhr;
event = create_dispevent();
EXPECT_REF(event, 1);
hr = IXMLHttpRequest_put_onreadystatechange(xhr, event);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
EXPECT_REF(event, 2);
g_unexpectedcall = g_expectedcall = 0;
......@@ -1557,33 +1554,33 @@ static void test_XMLHTTP(void)
/* status code after ::open() */
status = 0xdeadbeef;
hr = IXMLHttpRequest_get_status(xhr, &status);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "got %d\n", status);
ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "Unexpected hr %#lx.\n", hr);
ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "Unexpected state %ld.\n", status);
state = -1;
hr = IXMLHttpRequest_get_readyState(xhr, &state);
EXPECT_HR(hr, S_OK);
ok(state == READYSTATE_LOADING, "got %d, expected READYSTATE_LOADING\n", state);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(state == READYSTATE_LOADING, "Unexpected state %ld.\n", state);
hr = IXMLHttpRequest_abort(xhr);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
state = -1;
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 */,
"got %d, expected READYSTATE_UNINITIALIZED\n", state);
"Unexpected state %ld.\n", state);
test_open(xhr, "POST", urlA, S_OK);
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"));
EXPECT_HR(hr, E_INVALIDARG);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
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_BSTR(&varbody) = _bstr_(bodyA);
......@@ -1595,42 +1592,42 @@ static void test_XMLHTTP(void)
IXMLHttpRequest_Release(xhr);
return;
}
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* response headers */
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);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* status line is stripped already */
ok(memcmp(str, L"HTTP", 4*sizeof(WCHAR)), "got response headers %s\n", wine_dbgstr_w(str));
ok(*str, "got empty headers\n");
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);
SysFreeString(str1);
SysFreeString(str);
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);
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);
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));
SysFreeString(str);
/* status code after ::send() */
status = 0xdeadbeef;
status = 0;
hr = IXMLHttpRequest_get_status(xhr, &status);
EXPECT_HR(hr, S_OK);
ok(status == 200, "got %d\n", status);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(status == 200, "Unexpected status %ld.\n", status);
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);
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));
SysFreeString(str);
......@@ -1639,10 +1636,10 @@ static void test_XMLHTTP(void)
V_BSTR(&varbody) = _bstr_(bodyA);
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);
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
* not what the server expects */
if(hr == S_OK)
......@@ -1656,7 +1653,7 @@ static void test_XMLHTTP(void)
test_open(xhr, "POST", urlA, S_OK);
hr = IXMLHttpRequest_send(xhr, varbody);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* GET request */
test_open(xhr, "GET", xmltestA, S_OK);
......@@ -1670,33 +1667,33 @@ static void test_XMLHTTP(void)
IXMLHttpRequest_Release(xhr);
return;
}
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!memcmp(bstrResponse, _bstr_(xmltestbodyA), sizeof(xmltestbodyA)*sizeof(WCHAR)),
"expected %s, got %s\n", xmltestbodyA, wine_dbgstr_w(bstrResponse));
SysFreeString(bstrResponse);
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;
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(SafeArrayGetDim(V_ARRAY(&varbody)) == 1, "got %d, expected one dimension\n", SafeArrayGetDim(V_ARRAY(&varbody)));
bound = -1;
hr = SafeArrayGetLBound(V_ARRAY(&varbody), 1, &bound);
EXPECT_HR(hr, S_OK);
ok(bound == 0, "got %d, expected zero bound\n", bound);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!bound, "Unexpected bound %ld.\n", bound);
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");
SafeArrayUnaccessData(V_ARRAY(&varbody));
......@@ -1704,17 +1701,17 @@ static void test_XMLHTTP(void)
/* get_responseStream */
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;
hr = IXMLHttpRequest_get_responseStream(xhr, &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);
g = NULL;
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);
VariantClear(&varbody);
......@@ -1725,21 +1722,21 @@ static void test_XMLHTTP(void)
V_VT(&varbody) = VT_EMPTY;
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);
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));
SysFreeString(str);
/* interaction with object 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);
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);
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");
IObjectWithSite_Release(obj_site2);
......@@ -1750,38 +1747,38 @@ static void test_XMLHTTP(void)
V_VT(&varbody) = VT_EMPTY;
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);
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));
SysFreeString(str);
SysFreeString(str1);
/* try to set site another time */
hr = IObjectWithSite_SetSite(obj_site, &testsite);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IObjectWithSite_Release(obj_site);
/* HEAD request */
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);
V_VT(&varbody) = VT_EMPTY;
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;
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));
SysFreeString(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");
SysFreeString(str);
......@@ -1795,7 +1792,7 @@ static void test_XMLHTTP(void)
V_VT(&varbody) = VT_EMPTY;
hr = IXMLHttpRequest_send(xhr, varbody);
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);
free_bstrs();
......@@ -1822,10 +1819,10 @@ static void test_server_xhr(void)
IServerXMLHTTPRequest_Release(xhr);
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);
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));
SysFreeString(response);
......@@ -1839,7 +1836,7 @@ static void test_server_xhr(void)
V_VT(&body) = VT_EMPTY;
hr = IServerXMLHTTPRequest_send(xhr, body);
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);
free_bstrs();
......@@ -1876,11 +1873,11 @@ static void test_supporterrorinfo(void)
EXPECT_REF(xhr, 1);
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);
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");
EXPECT_REF(xhr, 3);
......@@ -1894,11 +1891,11 @@ static void test_supporterrorinfo(void)
EXPECT_REF(server_xhr, 1);
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);
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");
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 @@
#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)
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
expected_hr = supported ? S_OK : E_NOINTERFACE;
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))
IUnknown_Release(unk);
}
......@@ -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 szOpenSeqXML4[] = "<test><x/><x/><y/><z/><z/><v/></test>";
#define check_ref_expr(expr, n) { \
LONG ref = expr; \
ok(ref == n, "expected %i refs, got %i\n", n, ref); \
}
#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); \
static ULONG get_refcount(void *iface)
{
IUnknown_AddRef((IUnknown *)iface);
return IUnknown_Release((IUnknown *)iface);
}
#define _expect64(expr, str, base, TYPE, CONV) { \
......@@ -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);
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;
}
......@@ -510,10 +491,10 @@ static void test_schema_refs(void)
IXMLDOMDocument2 *doc;
IXMLDOMNode *node;
IXMLDOMSchemaCollection *cache;
LONG len, refcount;
VARIANT v;
VARIANT_BOOL b;
BSTR str;
LONG len;
HRESULT hr;
doc = create_document(&IID_IXMLDOMDocument2);
......@@ -529,150 +510,190 @@ static void test_schema_refs(void)
VariantInit(&v);
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);
SysFreeString(str);
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);
/* 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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &len));
ok(len == 1, "got %d\n", len);
hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "Unexpected length %ld.\n", len);
/* read back - empty valid BSTR */
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);
SysFreeString(str);
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);
IXMLDOMNode_Release(node);
node = NULL;
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);
IXMLDOMNode_Release(node);
SysFreeString(str);
/* 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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &len));
ok(len == 0, "got %d\n", len);
hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "Unexpected length %ld.\n", len);
/* same, but with VT_UNKNOWN type */
V_VT(&v) = VT_UNKNOWN;
V_UNKNOWN(&v) = (IUnknown*)doc;
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;
hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len == 1, "got %d\n", len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "Unexpected length %ld.\n", len);
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;
hr = IXMLDOMSchemaCollection_get_length(cache, &len);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len == 0, "got %d\n", len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "Unexpected length %ld.\n", len);
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 */
check_refs(IXMLDOMDocument2, doc, 1);
refcount = get_refcount(doc);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
SysFreeString(str);
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));
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_DISPATCH(&v) = (IDispatch*)cache;
/* check that putref_schemas takes a ref */
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
check_refs(IXMLDOMSchemaCollection, cache, 3);
hr = IXMLDOMDocument2_putref_schemas(doc, v);
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 */
V_VT(&v) = VT_INT;
/* 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));
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() */
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));
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 */
check_ref_expr(IXMLDOMSchemaCollection_Release(cache), 3);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache), 2);
refcount = IXMLDOMSchemaCollection_Release(cache);
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_ref_expr(IXMLDOMDocument2_AddRef(doc), 2);
check_refs(IXMLDOMSchemaCollection, cache, 2);
check_ref_expr(IXMLDOMDocument2_Release(doc), 1);
refcount = IXMLDOMDocument2_AddRef(doc);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
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 */
V_VT(&v) = VT_INT;
ole_expect(IXMLDOMDocument2_putref_schemas(doc, v), E_FAIL);
check_refs(IXMLDOMSchemaCollection, cache, 2);
hr = IXMLDOMDocument2_putref_schemas(doc, v);
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 */
V_VT(&v) = VT_EMPTY;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
check_refs(IXMLDOMSchemaCollection, cache, 1);
hr = IXMLDOMDocument2_putref_schemas(doc, v);
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 */
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_UNKNOWN(&v) = (IUnknown*)cache;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
check_refs(IXMLDOMSchemaCollection, cache, 3);
hr = IXMLDOMDocument2_putref_schemas(doc, v);
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 */
/* calling with VT_NULL releases the schema */
V_VT(&v) = VT_NULL;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
check_refs(IXMLDOMSchemaCollection, cache, 1);
hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
refcount = get_refcount(cache);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
/* refs now 1 */
/* 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_UNKNOWN(&v) = (IUnknown*)cache;
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
check_refs(IXMLDOMSchemaCollection, cache, 3);
hr = IXMLDOMDocument2_putref_schemas(doc, v);
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 */
/* 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);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache), 0);
refcount = get_refcount(cache);
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)
{
IXMLDOMDocument2 *schema1, *schema2, *schema3;
IXMLDOMSchemaCollection *cache1, *cache2, *cache3;
LONG refcount, length;
VARIANT_BOOL b;
LONG length;
HRESULT hr;
schema1 = create_document(&IID_IXMLDOMDocument2);
ok(schema1 != NULL, "Failed to create a document.\n");
......@@ -695,93 +716,166 @@ static void test_collection_refs(void)
cache2 = 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");
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");
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");
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1)));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2)));
ole_check(IXMLDOMSchemaCollection_add(cache3, _bstr_(xdr_schema3_uri), _variantdoc_(schema3)));
check_ref_expr(IXMLDOMDocument2_Release(schema1), 0);
check_ref_expr(IXMLDOMDocument2_Release(schema2), 0);
check_ref_expr(IXMLDOMDocument2_Release(schema3), 0);
hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_add(cache3, _bstr_(xdr_schema3_uri), _variantdoc_(schema3));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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;
schema2 = NULL;
schema3 = NULL;
/* releasing the original doc does not affect the schema cache */
ole_check(IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1));
ole_check(IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2));
ole_check(IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3));
hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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 */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1);
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1);
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1);
if (schema1)
{
refcount = get_refcount(schema1);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
ole_expect(IXMLDOMSchemaCollection_addCollection(cache1, NULL), E_POINTER);
ole_check(IXMLDOMSchemaCollection_addCollection(cache2, cache1));
ole_check(IXMLDOMSchemaCollection_addCollection(cache3, cache2));
if (schema2)
{
refcount = get_refcount(schema2);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
}
length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache1, &length));
ok(length == 1, "expected length 1, got %i\n", length);
if (schema3)
{
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;
ole_check(IXMLDOMSchemaCollection_get_length(cache2, &length));
ok(length == 2, "expected length 2, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache1, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 1, "Unexpected length %ld.\n", length);
length = -1;
ole_check(IXMLDOMSchemaCollection_get_length(cache3, &length));
ok(length == 3, "expected length 3, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache2, &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 */
check_refs(IXMLDOMSchemaCollection, cache1, 1);
check_refs(IXMLDOMSchemaCollection, cache2, 1);
check_refs(IXMLDOMSchemaCollection, cache3, 1);
refcount = get_refcount(cache1);
ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
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 */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1);
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1);
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1);
if (schema1)
{
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;
schema2 = NULL;
schema3 = NULL;
/* releasing the domdoc instances doesn't change the cache */
ole_check(IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1));
ole_check(IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2));
ole_check(IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3));
hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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 */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1);
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1);
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1);
if (schema1)
{
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 */
check_ref_expr(IXMLDOMSchemaCollection_Release(cache1), 0);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache2), 0);
check_ref_expr(IXMLDOMSchemaCollection_Release(cache3), 0);
refcount = IXMLDOMSchemaCollection_Release(cache1);
ok(!refcount, "Unexpected refcount %ld.\n", refcount);
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 */
if (schema1) check_refs(IXMLDOMDocument2, schema1, 1);
if (schema2) check_refs(IXMLDOMDocument2, schema2, 1);
if (schema3) check_refs(IXMLDOMDocument2, schema3, 1);
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);
if (schema1)
{
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);
}
free_bstrs();
}
......@@ -791,6 +885,7 @@ static void test_length(void)
IXMLDOMDocument2 *schema1, *schema2, *schema3;
IXMLDOMSchemaCollection *cache;
VARIANT_BOOL b;
HRESULT hr;
VARIANT v;
LONG length;
......@@ -813,62 +908,81 @@ static void test_length(void)
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");
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");
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");
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 */
ole_check(IXMLDOMSchemaCollection_remove(cache, NULL));
ole_check(IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema1_uri)));
hr = IXMLDOMSchemaCollection_remove(cache, NULL);
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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length));
ok(length == 0, "expected length 0, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache, &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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length));
ok(length == 1, "expected length 1, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache, &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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length));
ok(length == 2, "expected length 2, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache, &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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length));
ok(length == 3, "expected length 3, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache, &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 */
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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length));
ok(length == 2, "expected length 2, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache, &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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length));
ok(length == 1, "expected length 1, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache, &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;
ole_check(IXMLDOMSchemaCollection_get_length(cache, &length));
ok(length == 0, "expected length 0, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 0, "Unexpected length %ld.\n", length);
IXMLDOMDocument2_Release(schema1);
IXMLDOMDocument2_Release(schema2);
......@@ -907,22 +1021,29 @@ static void test_collection_content(void)
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");
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");
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");
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1)));
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema2_uri), _variantdoc_(schema2)));
ole_check(IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema3_uri), _variantdoc_(schema3)));
hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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;
ole_check(IXMLDOMSchemaCollection_get_length(cache1, &length));
ok(length == 3, "expected length 3, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache1, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 3, "Unexpected length %ld.\n", length);
IXMLDOMDocument2_Release(schema1);
IXMLDOMDocument2_Release(schema2);
......@@ -935,27 +1056,38 @@ static void test_collection_content(void)
schema3 = create_document_version(40, &IID_IXMLDOMDocument2);
schema4 = 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");
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");
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");
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");
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");
/* combining XDR and XSD schemas in the same cache is fine */
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema1_uri), _variantdoc_(schema1)));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2)));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema1_uri), _variantdoc_(schema3)));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema2_uri), _variantdoc_(schema4)));
ole_check(IXMLDOMSchemaCollection_add(cache2, _bstr_(xsd_schema3_uri), _variantdoc_(schema5)));
hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
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;
ole_check(IXMLDOMSchemaCollection_get_length(cache2, &length));
ok(length == 5, "expected length 5, got %i\n", length);
hr = IXMLDOMSchemaCollection_get_length(cache2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 5, "Unexpected length %ld.\n", length);
IXMLDOMDocument2_Release(schema1);
IXMLDOMDocument2_Release(schema2);
......@@ -967,27 +1099,33 @@ static void test_collection_content(void)
bstr = (void*)0xdeadbeef;
/* error if index is out of range */
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);
/* 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 */
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;
/* 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");
/* 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");
/* 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)
{
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");
content[i] = bstr;
......@@ -1006,7 +1144,8 @@ static void test_collection_content(void)
for (i = 0; i < 5; ++i)
{
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");
for (j = 0; j < i; ++j)
......@@ -1060,20 +1199,23 @@ L"<?xml version='1.0'?>"
swprintf(buffer, ARRAY_SIZE(buffer), regex_doc, input);
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");
SysFreeString(bstr);
swprintf(buffer, ARRAY_SIZE(buffer), regex_schema, regex);
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");
SysFreeString(bstr);
/* add the schema to the cache */
V_VT(&v) = VT_DISPATCH;
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");
namespace = alloc_str_from_narrow("urn:test");
hr = IXMLDOMSchemaCollection_add(cache, namespace, v);
......@@ -1085,9 +1227,11 @@ L"<?xml version='1.0'?>"
/* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH;
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");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v);
/* validate the doc
......@@ -1154,13 +1298,13 @@ static void test_regex(void)
{
HRESULT hr = validate_regex_document(doc60, schema60, cache60, tests[i].regex, tests[i].input);
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));
if (doc40 && schema40 && cache40)
{
hr = validate_regex_document(doc40, schema40, cache40, tests[i].regex, tests[i].input);
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));
}
}
......@@ -1188,6 +1332,7 @@ static void test_XDR_schemas(void)
IXMLDOMSchemaCollection* cache;
IXMLDOMParseError* err;
VARIANT_BOOL b;
HRESULT hr;
VARIANT v;
BSTR bstr;
......@@ -1206,26 +1351,32 @@ static void test_XDR_schemas(void)
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");
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");
/* load the schema */
V_VT(&v) = VT_DISPATCH;
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");
ole_check(IXMLDOMSchemaCollection_add(cache, _bstr_(""), v));
hr = IXMLDOMSchemaCollection_add(cache, _bstr_(""), v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v);
/* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH;
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");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v);
/* validate the doc
......@@ -1233,9 +1384,11 @@ static void test_XDR_schemas(void)
* this is fine */
err = 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");
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));
SysFreeString(bstr);
IXMLDOMParseError_Release(err);
......@@ -1243,15 +1396,18 @@ static void test_XDR_schemas(void)
/* load the next doc */
IXMLDOMDocument2_Release(doc);
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");
/* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH;
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");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v);
/* validate the doc
......@@ -1259,9 +1415,11 @@ static void test_XDR_schemas(void)
* this is fine */
err = 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");
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));
SysFreeString(bstr);
IXMLDOMParseError_Release(err);
......@@ -1269,22 +1427,26 @@ static void test_XDR_schemas(void)
/* load the next doc */
IXMLDOMDocument2_Release(doc);
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");
/* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH;
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");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v);
/* validate the doc
* fails, extra elements are only allowed at the end */
err = 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");
todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
......@@ -1293,22 +1455,26 @@ static void test_XDR_schemas(void)
/* load the next doc */
IXMLDOMDocument2_Release(doc);
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");
/* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH;
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");
ole_check(IXMLDOMDocument2_putref_schemas(doc, v));
hr = IXMLDOMDocument2_putref_schemas(doc, v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v);
/* validate the doc
* fails, undeclared elements are not allowed */
err = 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");
todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
......@@ -1389,53 +1555,53 @@ static void test_XDR_datatypes(void)
}
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");
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");
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");
err = NULL;
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");
hr = IXMLDOMParseError_get_errorCode(err, &l);
EXPECT_HR(hr, S_OK);
ok(l == E_XML_NODTD, "got %08x\n", l);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(l == E_XML_NODTD, "Unexpected error code %#lx.\n", l);
IXMLDOMParseError_Release(err);
err = NULL;
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");
hr = IXMLDOMParseError_get_errorCode(err, &l);
EXPECT_HR(hr, S_OK);
ok(l == E_XML_NODTD, "got %08x\n", l);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(l == E_XML_NODTD, "Unexpected error code %#lx.\n", l);
IXMLDOMParseError_Release(err);
/* now load the schema */
V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL;
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");
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);
/* associate the cache to the doc */
V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = NULL;
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");
hr = IXMLDOMDocument2_putref_schemas(doc2, v);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
VariantClear(&v);
/* validate the doc */
......@@ -1443,13 +1609,13 @@ static void test_XDR_datatypes(void)
l = 0;
bstr = NULL;
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");
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);
EXPECT_HR(hr, S_FALSE);
ok(l == 0, "got %08x : %s\n", l, wine_dbgstr_w(bstr));
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(l == 0, "Unexpected value %lx : %s\n", l, wine_dbgstr_w(bstr));
SysFreeString(bstr);
IXMLDOMParseError_Release(err);
......@@ -1461,20 +1627,20 @@ static void test_XDR_datatypes(void)
/* check data types without the schema */
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");
V_VT(&type) = VT_EMPTY;
V_BSTR(&type) = (void*)-1;
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));
/* when returning VT_NULL, the pointer is set to NULL */
ok(V_BSTR(&type) == NULL, "got %p\n", V_BSTR(&type));
VariantClear(&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));
VariantClear(&type);
IXMLDOMNode_Release(node);
......@@ -1482,27 +1648,27 @@ static void test_XDR_datatypes(void)
/* check the data with schema */
node = NULL;
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");
V_VT(&type) = VT_EMPTY;
hr = IXMLDOMNode_get_dataType(node, &type);
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(!lstrcmpW(V_BSTR(&type), _bstr_(ptr->typename)), "got %s\n", wine_dbgstr_w(V_BSTR(&type)));
}
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));
}
VariantClear(&type);
VariantClear(&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)
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)
break;
case VT_I4:
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"))
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
ok(V_I4(&v) == -420000000, "got %i\n", V_I4(&v));
ok(V_I4(&v) == -420000000, "got %ld\n", V_I4(&v));
break;
case VT_I8:
expect_int64(V_I8(&v), -4200000000, 10);
......@@ -1547,7 +1713,7 @@ static void test_XDR_datatypes(void)
ok(V_UI2(&v) == 0xFFFF, "got %04x\n", V_UI2(&v));
break;
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;
case VT_UI8:
expect_uint64(V_UI8(&v), 0xFFFFFFFFFFFFFFFF, 16);
......@@ -1581,11 +1747,11 @@ static void test_validate_on_load(void)
if (!cache) return;
hr = IXMLDOMSchemaCollection2_get_validateOnLoad(cache, NULL);
EXPECT_HR(hr, E_POINTER);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
b = VARIANT_FALSE;
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);
IXMLDOMSchemaCollection2_Release(cache);
......@@ -1602,42 +1768,42 @@ static void test_obj_dispex(IUnknown *obj)
BSTR name;
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;
ticnt = 0;
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);
name = SysAllocString(L"*");
hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive);
EXPECT_HR(hr, E_NOTIMPL);
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
SysFreeString(name);
hr = IDispatchEx_DeleteMemberByDispID(dispex, dispid);
EXPECT_HR(hr, E_NOTIMPL);
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
props = 0;
hr = IDispatchEx_GetMemberProperties(dispex, dispid, grfdexPropCanAll, &props);
EXPECT_HR(hr, E_NOTIMPL);
ok(props == 0, "expected 0 got %d\n", props);
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
ok(props == 0, "expected 0 got %ld\n", props);
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);
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;
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);
name = SysAllocString(L"testprop");
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);
IDispatchEx_Release(dispex);
......@@ -1656,12 +1822,12 @@ static void test_dispex(void)
if (!cache) return;
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);
IUnknown_Release(unk);
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_I4(&arg) = 0;
......@@ -1673,7 +1839,7 @@ static void test_dispex(void)
V_VT(&ret) = VT_EMPTY;
V_DISPATCH(&ret) = (void*)0x1;
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_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret));
......@@ -1698,10 +1864,10 @@ static void test_get(void)
if (!cache) return;
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);
EXPECT_HR(hr, E_NOTIMPL);
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
IXMLDOMSchemaCollection2_Release(cache);
......@@ -1709,10 +1875,10 @@ static void test_get(void)
if (!cache) return;
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);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IXMLDOMSchemaCollection2_Release(cache);
free_bstrs();
......@@ -1734,32 +1900,32 @@ static void test_remove(void)
ok(doc != NULL, "got %p\n", doc);
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_DISPATCH(&v) = (IDispatch*)doc;
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;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK);
ok(len == 1, "got %d\n", len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "Unexpected length %ld.\n", len);
/* ::remove() is a stub for version 6 */
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"));
EXPECT_HR(hr, E_NOTIMPL);
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_(xsd_schema1_uri));
EXPECT_HR(hr, E_NOTIMPL);
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK);
ok(len == 1, "got %d\n", len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "Unexpected length %ld.\n", len);
IXMLDOMDocument_Release(doc);
IXMLDOMSchemaCollection2_Release(cache);
......@@ -1773,36 +1939,36 @@ static void test_remove(void)
ok(doc != NULL, "got %p\n", doc);
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_DISPATCH(&v) = (IDispatch*)doc;
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;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK);
ok(len == 1, "got %d\n", len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "Unexpected length %ld.\n", len);
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"));
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK);
ok(len == 1, "got %d\n", len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 1, "Unexpected length %ld.\n", len);
hr = IXMLDOMSchemaCollection2_remove(cache, _bstr_(xsd_schema1_uri));
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
len = -1;
hr = IXMLDOMSchemaCollection2_get_length(cache, &len);
EXPECT_HR(hr, S_OK);
ok(len == 0, "got %d\n", len);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "Unexpected length %ld.\n", len);
IXMLDOMDocument_Release(doc);
IXMLDOMSchemaCollection2_Release(cache);
......@@ -1821,8 +1987,8 @@ static void test_ifaces(void)
/* CLSID_XMLSchemaCache60 is returned as an interface (the same as IXMLDOMSchemaCollection2). */
hr = IXMLDOMSchemaCollection2_QueryInterface(cache, &CLSID_XMLSchemaCache60, (void**)&unk);
ok (hr == S_OK, "Could not get CLSID_XMLSchemaCache60 iface: %08x\n", hr);
ok (unk == (IUnknown*)cache, "unk != cache\n");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk == (IUnknown*)cache, "unk != cache\n");
IUnknown_Release(unk);
check_interface(cache, &IID_IXMLDOMSchemaCollection, TRUE);
......
......@@ -29,9 +29,6 @@
#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 */
#define XML_E_INVALIDATROOTLEVEL 0xc00ce556
......@@ -70,10 +67,10 @@ static void create_stream_on_file(IStream **stream, LPCSTR path)
ptr = GlobalLock(hglobal);
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);
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");
CloseHandle(hfile);
......@@ -97,18 +94,18 @@ static void test_xmldoc(void)
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&IID_IXMLDocument, (void**)&doc);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* IDispatch */
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 */
hr = IDispatch_GetTypeInfo(disp, 0, 0, &ti);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
name = 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));
SysFreeString(name);
......@@ -116,22 +113,22 @@ static void test_xmldoc(void)
IDispatch_Release(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");
GetFullPathNameA("bank.xml", MAX_PATH, path, NULL);
create_stream_on_file(&stream, path);
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");
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");
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)
goto cleanup;
......@@ -139,86 +136,86 @@ static void test_xmldoc(void)
/* version field */
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;
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));
SysFreeString(name);
/* doctype */
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);
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));
SysFreeString(name);
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");
/* ::root() returns new instance each time */
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 != element, "Expected new element instance\n");
IXMLElement_Release(child);
hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(name);
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");
hr = IXMLElementCollection_get_length(collection, &num_child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 2, "Expected 2, got %d\n", num_child);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 2, "Unexpected length %ld.\n", num_child);
V_VT(&vIndex) = VT_I4;
V_I4(&vIndex) = 0;
V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
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");
hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(name);
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");
hr = IXMLElementCollection_get_length(inner, &num_child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 1, "Expected 1, got %d\n", num_child);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 1, "Unexpected length %ld.\n", num_child);
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");
hr = IXMLElement_get_type(value, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Unexpected type %ld.\n", type);
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");
SysFreeString(name);
......@@ -226,7 +223,7 @@ static void test_xmldoc(void)
inner = (IXMLElementCollection *)0xdeadbeef;
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);
IXMLElement_Release(value);
......@@ -236,37 +233,37 @@ static void test_xmldoc(void)
V_I4(&vIndex) = 1;
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");
hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(name);
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");
hr = IXMLElementCollection_get_length(inner, &num_child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 1, "Expected 1, got %d\n", num_child);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 1, "Unexpected length %ld.\n", num_child);
V_I4(&vIndex) = 0;
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");
hr = IXMLElement_get_type(value, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Unexpected type %ld.\n", type);
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");
SysFreeString(name);
......@@ -274,7 +271,7 @@ static void test_xmldoc(void)
inner = (IXMLElementCollection *)0xdeadbeef;
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);
IXMLElement_Release(value);
......@@ -299,14 +296,14 @@ static void test_createElement(void)
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&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 */
V_VT(&vType) = VT_NULL;
V_VT(&vName) = VT_NULL;
element = (IXMLElement *)0xdeadbeef;
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");
/* invalid vType value */
......@@ -321,17 +318,16 @@ static void test_createElement(void)
if (element != NULL)
{
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 */
ok(type == XMLELEMTYPE_OTHER || type == XMLELEMTYPE_ELEMENT,
"Expected XMLELEMTYPE_OTHER || XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(type == XMLELEMTYPE_OTHER || type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
IXMLElement_Release(element);
}
}
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");
}
......@@ -340,12 +336,12 @@ static void test_createElement(void)
V_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_I4;
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");
hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
IXMLElement_Release(element);
......@@ -354,24 +350,24 @@ static void test_createElement(void)
V_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_I4;
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;
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");
V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_NULL;
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");
/* createElement does not set the new element as root */
root = (IXMLElement *)0xdeadbeef;
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");
IXMLElement_Release(element);
......@@ -393,27 +389,27 @@ static void test_persiststreaminit(void)
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&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);
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");
/* null arguments */
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);
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);
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);
ok(hr == E_POINTER, "Expected E_POINTER, got %08x\n", hr);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
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");
GetFullPathNameA("bank.xml", MAX_PATH, path, NULL);
......@@ -422,73 +418,73 @@ static void test_persiststreaminit(void)
/* GetSizeMax not implemented */
size.QuadPart = 0;
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");
hr = IPersistStreamInit_Load(psi, 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)
goto cleanup;
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 */
stream = NULL;
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);
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;
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");
IStream_Release(stream);
str = SysAllocString(L"test");
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);
ok(hr == E_NOTIMPL, "Expected E_NOTIMPL, got %08x\n", hr);
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
IXMLElement_Release(element);
SysFreeString(str);
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);
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);
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 */
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);
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;
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);
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;
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");
IStream_Release(stream);
memset(&id, 0, sizeof(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");
cleanup:
......@@ -520,91 +516,91 @@ static void test_xmlelem_children(void)
IXMLElement *element = NULL, *child = NULL, *child2 = NULL;
IXMLElementCollection *collection = NULL;
VARIANT vType, vName, vIndex;
LONG length;
LONG length, refcount;
HRESULT hr;
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&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_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_NULL;
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");
V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL;
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");
V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL;
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");
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);
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");
length = 0;
hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 1, "Expected 1, got %08x\n", length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 1, "Unexpected length %ld.\n", length);
/* remove/add child and check what happens with collection */
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;
hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 0, "Expected 0, got %08x\n", length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!length, "Unexpected length %ld.\n", length);
IXMLElementCollection_Release(collection);
hr = IXMLElement_AddRef(child);
ok(hr == 2, "Expected 2, got %08x\n", hr);
refcount = IXMLElement_AddRef(child);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
IXMLElement_Release(child);
hr = IXMLElement_addChild(element, child, 0, -1);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXMLElement_AddRef(child);
ok(hr == 2, "Expected 2, got %08x\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
refcount = IXMLElement_AddRef(child);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
IXMLElement_Release(child);
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);
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");
hr = IXMLElement_AddRef(child);
ok(hr == 2, "Expected 2, got %08x\n", hr);
refcount = IXMLElement_AddRef(child);
ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
IXMLElement_Release(child);
length = 0;
hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 2, "Expected 2, got %08x\n", length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Unexpected length %ld.\n", length);
IXMLElement_Release(child2);
length = 0;
hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 2, "Expected 2, got %08x\n", length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Unexpected length %ld.\n", length);
V_VT(&vIndex) = VT_I4;
V_I4(&vIndex) = 1;
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");
IXMLElementCollection_Release(collection);
IXMLElement_Release(child2);
......@@ -614,20 +610,20 @@ static void test_xmlelem_children(void)
V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL;
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");
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);
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);
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);
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(child);
......@@ -652,7 +648,7 @@ static void test_xmlelem_collection(void)
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&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");
GetFullPathNameA("bank.xml", MAX_PATH, pathA, NULL);
......@@ -660,131 +656,131 @@ static void test_xmlelem_collection(void)
url = SysAllocString(path);
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);
if(hr != S_OK)
goto cleanup;
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");
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");
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);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 2, "Expected 2, got %d\n", length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Unexpected count %ld.\n", length);
/* IXMLElementCollection:put_length does nothing */
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);
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);
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);
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);
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);
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 */
hr = IXMLElementCollection_get_length(collection, &length);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(length == 2, "Expected 2, got %d\n", length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == 2, "Unexpected count %ld.\n", length);
/* IXMLElementCollection implements IEnumVARIANT */
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");
IEnumVARIANT_Release(enumVar);
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");
enumVar = (void *)0xdeadbeef;
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);
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");
IUnknown_Release(unk);
/* <Number>1234</Number> */
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(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);
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");
VariantClear(&var[0]);
hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(str);
IXMLElement_Release(child);
/* <Name>Captain Ahab</Name> */
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(num_vars == 1, "Expected 1, got %d\n", num_vars);
ok(num_vars == 1, "Unexpected count %ld.\n", num_vars);
VariantClear(&var[0]);
/* try advance further, no children left */
V_VT(&dummy) = VT_I4;
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(num_vars == 0, "Expected 0, got %d\n", num_vars);
ok(!num_vars, "Unexpected count %ld.\n", num_vars);
V_VT(&dummy) = VT_I4;
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));
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 */
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[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;
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(num_vars == 0, "Expected 0, got %d\n", num_vars);
ok(!num_vars, "Unexpected count %ld.\n", num_vars);
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[0]);
......@@ -793,26 +789,26 @@ static void test_xmlelem_collection(void)
/* request more elements than available */
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[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[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);
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");
VariantClear(&var[1]);
VariantClear(&var[0]);
hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(str);
IXMLElement_Release(child);
......@@ -823,15 +819,15 @@ static void test_xmlelem_collection(void)
V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
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");
hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(str);
IXMLElement_Release(child);
......@@ -842,28 +838,28 @@ static void test_xmlelem_collection(void)
V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
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");
hr = IXMLElement_get_type(child, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(str);
IXMLElement_Release(child);
V_I4(&vIndex) = 100;
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");
V_I4(&vIndex) = -1;
child = (IXMLElement *)0xdeadbeef;
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");
IEnumVARIANT_Release(enumVar);
......@@ -890,44 +886,44 @@ static void test_xmlelem(void)
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
&IID_IXMLDocument, (LPVOID*)&doc);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_ELEMENT;
V_VT(&vName) = VT_NULL;
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");
/* test for IDispatch */
disp = NULL;
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);
EXPECT_HR(hr, S_OK);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
name = 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);
ITypeInfo_Release(ti);
IDispatch_Release(disp);
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));
SysFreeString(str);
parent = (IXMLElement *)0xdeadbeef;
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");
str = SysAllocString(L"noexist");
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_BSTR(&vValue) == NULL, "Expected null value\n");
VariantClear(&vValue);
......@@ -938,13 +934,13 @@ static void test_xmlelem(void)
V_VT(&vValue) = VT_BSTR;
V_BSTR(&vValue) = val;
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(val);
str = SysAllocString(L"CRAZYCASE");
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(!lstrcmpW(V_BSTR(&vValue), L"val"), "Expected 'val'\n");
VariantClear(&vValue);
......@@ -955,24 +951,24 @@ static void test_xmlelem(void)
V_VT(&vValue) = VT_BSTR;
V_BSTR(&vValue) = val;
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);
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(!lstrcmpW(V_BSTR(&vValue), L"val"), "Expected 'val'\n");
VariantClear(&vValue);
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 */
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);
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_BSTR(&vValue) == NULL, "Expected null value\n");
SysFreeString(str);
......@@ -980,92 +976,92 @@ static void test_xmlelem(void)
children = (IXMLElementCollection *)0xdeadbeef;
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");
hr = IXMLElement_get_type(element, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
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");
SysFreeString(str);
/* put_text with an ELEMENT */
str = SysAllocString(L"val");
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);
V_VT(&vType) = VT_I4;
V_I4(&vType) = XMLELEMTYPE_TEXT;
V_VT(&vName) = VT_NULL;
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");
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");
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);
parent = (IXMLElement *)0xdeadbeef;
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");
hr = IXMLElement_get_type(parent, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Expected XMLELEMTYPE_ELEMENT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_ELEMENT, "Unexpected type %ld.\n", type);
children = (IXMLElementCollection *)0xdeadbeef;
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");
hr = IXMLElementCollection_get_length(children, &num_child);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(num_child == 1, "Expected 1, got %d\n", num_child);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(num_child == 1, "Unexpected length %ld.\n", num_child);
V_VT(&vIndex) = VT_I4;
V_I4(&vIndex) = 0;
V_VT(&vName) = VT_ERROR;
V_ERROR(&vName) = DISP_E_PARAMNOTFOUND;
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");
hr = IXMLElement_get_type(child2, &type);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Expected XMLELEMTYPE_TEXT, got %d\n", type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XMLELEMTYPE_TEXT, "Unexpected type %ld.\n", type);
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");
SysFreeString(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");
SysFreeString(str);
/* try put_text on ELEMENT again, now that it has a text child */
str = SysAllocString(L"next");
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);
str = SysAllocString(L"next");
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);
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");
SysFreeString(str);
......
......@@ -108,44 +108,44 @@ static void create_test(void)
hr = CoCreateInstance(&CLSID_XMLParser30, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLParser, (void**)&parser);
if (FAILED(hr))
{
win_skip("IXMLParser is not available (0x%08x)\n", hr);
win_skip("IXMLParser is not available, hr %#lx.\n", hr);
return;
}
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);
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);
ok(flags == XMLFLAG_SAX, "Expected 0 got %d\n", flags);
ok(flags == XMLFLAG_SAX, "Unexpected flags %ld.\n", flags);
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);
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");
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);
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");
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);
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);
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);
ok(hr == XMLPARSER_IDLE, "got 0x%08x\n", hr);
ok(hr == XMLPARSER_IDLE, "Unexpected hr %#lx.\n", hr);
IXMLParser_Release(parser);
}
......
......@@ -128,7 +128,7 @@ static HRESULT WINAPI HTMLEvents_Invoke(IDispatch *iface, DISPID dispIdMember, R
BSTR 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)))
loaded = TRUE;
SysFreeString(state);
......@@ -161,28 +161,28 @@ static void test_QueryInterface(void)
win_skip("Failed to create XMLView instance\n");
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);
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);
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);
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);
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);
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);
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");
IUnknown_Release(unk);
IHTMLDocument_Release(htmldoc);
......@@ -218,26 +218,26 @@ static void test_Load(void)
win_skip("Failed to create XMLView instance\n");
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);
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);
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);
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);
ok(hres == S_OK, "Advise returned %x, expected S_OK\n", hres);
ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
IConnectionPoint_Release(cp);
IConnectionPointContainer_Release(cpc);
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);
ok(hres == S_OK, "CreateUrlMoniker returned %x, expected S_OK\n", hres);
ok(hres == S_OK, "Unexpected hr %#lx.\n", hres);
loaded = FALSE;
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);
IMoniker_Release(mon);
......@@ -247,9 +247,9 @@ static void test_Load(void)
}
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);
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));
IHTMLElement_Release(elem);
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