HRESULT hr;
int i;
- for (i = 0; i < sizeof(table->ifaces)/sizeof(table->ifaces[0]) && table->ifaces[i] != NULL; i++)
+ for (i = 0; i < ARRAY_SIZE(table->ifaces) && table->ifaces[i] != NULL; i++)
{
hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER, table->ifaces[i], (void**)&unk);
if (hr == S_OK) IUnknown_Release(unk);
{
int i;
- for (i = 0; i < sizeof(table->ifaces)/sizeof(table->ifaces[0]) && table->ifaces[i] != NULL; i++)
+ for (i = 0; i < ARRAY_SIZE(table->ifaces) && table->ifaces[i] != NULL; i++)
if (table->ifaces[i] == riid) return table->supported[i];
}
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
&IID_IMXNamespaceManager, (void**)&nsmgr);
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("xml")), "got prefix %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, E_FAIL);
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, _bstr_("ns0 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getURI(nsmgr, _bstr_(""), NULL, buffW, &len);
EXPECT_HR(hr, S_OK);
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns0"), _bstr_("ns0 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("xml")), "got prefix %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("ns0")), "got prefix %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 2, buffW, &len);
EXPECT_HR(hr, S_OK);
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns1"), _bstr_("ns1 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, S_OK);
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, _bstr_("ns0 uri override"));
EXPECT_HR(hr, S_FALSE);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getURI(nsmgr, _bstr_(""), NULL, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("ns0 uri override")), "got uri %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 3, buffW, &len);
EXPECT_HR(hr, S_OK);
free_bstrs();
}
+static void test_normalize_attribute_values(void)
+{
+ IXMLDOMDocument2 *doc;
+ VARIANT var;
+ HRESULT hr;
+
+ if (!is_clsid_supported(&CLSID_DOMDocument60, &IID_IXMLDOMDocument2))
+ {
+ win_skip("NormalizeAttributeValues is not supported.\n");
+ return;
+ }
+
+ doc = create_document_version(60, &IID_IXMLDOMDocument2);
+
+ V_VT(&var) = VT_I2;
+ V_I2(&var) = 10;
+ hr = IXMLDOMDocument2_getProperty(doc, _bstr_("NormalizeAttributeValues"), &var);
+todo_wine {
+ ok(hr == S_OK, "Failed to get property value, hr %#x.\n", hr);
+ ok(V_VT(&var) == VT_BOOL, "Unexpected property value type, vt %d.\n", V_VT(&var));
+ ok(V_BOOL(&var) == VARIANT_FALSE, "Unexpected property value.\n");
+}
+ V_VT(&var) = VT_BOOL;
+ V_BOOL(&var) = VARIANT_TRUE;
+ hr = IXMLDOMDocument2_setProperty(doc, _bstr_("NormalizeAttributeValues"), var);
+ ok(hr == S_OK, "Failed to set property, hr %#x.\n", hr);
+
+ V_VT(&var) = VT_I2;
+ V_I2(&var) = 10;
+ hr = IXMLDOMDocument2_getProperty(doc, _bstr_("NormalizeAttributeValues"), &var);
+todo_wine {
+ ok(hr == S_OK, "Failed to get property value, hr %#x.\n", hr);
+ ok(V_VT(&var) == VT_BOOL, "Unexpected property value type, vt %d.\n", V_VT(&var));
+ ok(V_BOOL(&var) == VARIANT_TRUE, "Unexpected property value.\n");
+}
+ IXMLDOMDocument2_Release(doc);
+}
+
+typedef struct _namespace_as_attribute_t {
+ const GUID *guid;
+ const char *clsid;
+ const char *xmlns_uri;
+} namespace_as_attribute_t;
+
+static const namespace_as_attribute_t namespace_as_attribute_test_data[] = {
+ { &CLSID_DOMDocument, "CLSID_DOMDocument", "" },
+ { &CLSID_DOMDocument2, "CLSID_DOMDocument2", "" },
+ { &CLSID_DOMDocument26, "CLSID_DOMDocument26", "" },
+ { &CLSID_DOMDocument30, "CLSID_DOMDocument30", "" },
+ { &CLSID_DOMDocument40, "CLSID_DOMDocument40", "" },
+ { &CLSID_DOMDocument60, "CLSID_DOMDocument60", "http://www.w3.org/2000/xmlns/" },
+ { 0 }
+};
+
+static void test_namespaces_as_attributes(void)
+{
+ const namespace_as_attribute_t *entry = namespace_as_attribute_test_data;
+ struct test {
+ const char *xml;
+ int explen;
+ const char *names[3];
+ const char *prefixes[3];
+ const char *basenames[3];
+ const char *uris[3];
+ const char *texts[3];
+ };
+ static const struct test tests[] = {
+ {
+ "<a ns:b=\"b attr\" d=\"d attr\" xmlns:ns=\"nshref\" />", 3,
+ { "ns:b", "d", "xmlns:ns" }, /* nodeName */
+ { "ns", NULL, "xmlns" }, /* prefix */
+ { "b", "d", "ns" }, /* baseName */
+ { "nshref", NULL, "" }, /* namespaceURI */
+ { "b attr", "d attr", "nshref" }, /* text */
+ },
+ /* property only */
+ {
+ "<a d=\"d attr\" />", 1,
+ { "d" }, /* nodeName */
+ { NULL }, /* prefix */
+ { "d" }, /* baseName */
+ { NULL }, /* namespaceURI */
+ { "d attr" }, /* text */
+ },
+ /* namespace only */
+ {
+ "<a xmlns:ns=\"nshref\" />", 1,
+ { "xmlns:ns" }, /* nodeName */
+ { "xmlns" }, /* prefix */
+ { "ns" }, /* baseName */
+ { "" }, /* namespaceURI */
+ { "nshref" }, /* text */
+ },
+ /* no properties or namespaces */
+ {
+ "<a />", 0,
+ },
+
+ { NULL }
+ };
+ const struct test *test;
+ IXMLDOMNamedNodeMap *map;
+ IXMLDOMNode *node, *item;
+ IXMLDOMDocument *doc;
+ VARIANT_BOOL b;
+ LONG len, i;
+ HRESULT hr;
+ BSTR str;
+
+ while (entry->guid)
+ {
+ if (!is_clsid_supported(entry->guid, &IID_IXMLDOMDocument2))
+ {
+ entry++;
+ continue;
+ }
+
+ test = tests;
+ while (test->xml) {
+ hr = CoCreateInstance(entry->guid, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (void **)&doc);
+ ok(SUCCEEDED(hr), "Failed to create document %s, hr %#x.\n", wine_dbgstr_guid(entry->guid), hr);
+
+ hr = IXMLDOMDocument_loadXML(doc, _bstr_(test->xml), &b);
+ ok(hr == S_OK, "Failed to load xml, hr %#x.\n", hr);
+
+ node = NULL;
+ hr = IXMLDOMDocument_selectSingleNode(doc, _bstr_("a"), &node);
+ ok(SUCCEEDED(hr), "Failed to select a node, hr %#x.\n", hr);
+
+ hr = IXMLDOMNode_get_attributes(node, &map);
+ ok(SUCCEEDED(hr), "Failed to get attributes, hr %#x.\n", hr);
+
+ len = -1;
+ hr = IXMLDOMNamedNodeMap_get_length(map, &len);
+ ok(SUCCEEDED(hr), "Failed to get map length, hr %#x.\n", hr);
+ ok(len == test->explen, "got %d\n", len);
+
+ item = NULL;
+ hr = IXMLDOMNamedNodeMap_get_item(map, test->explen+1, &item);
+ ok(hr == S_FALSE, "Failed to get item, hr %#x.\n", hr);
+ ok(!item, "Item should be NULL\n");
+
+ for (i = 0; i < len; i++)
+ {
+ item = NULL;
+ hr = IXMLDOMNamedNodeMap_get_item(map, i, &item);
+ ok(SUCCEEDED(hr), "Failed to get item, hr %#x.\n", hr);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_nodeName(item, &str);
+ ok(SUCCEEDED(hr), "Failed to get node name, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->names[i])), "got %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_prefix(item, &str);
+ if (test->prefixes[i])
+ {
+ ok(hr == S_OK, "Failed to get node name, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->prefixes[i])), "got %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+ }
+ else
+ ok(hr == S_FALSE, "Failed to get node name, hr %#x.\n", hr);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_baseName(item, &str);
+ ok(SUCCEEDED(hr), "Failed to get base name, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->basenames[i])), "got %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_namespaceURI(item, &str);
+ if (test->uris[i])
+ {
+ ok(hr == S_OK, "Failed to get node name, hr %#x.\n", hr);
+ if (test->prefixes[i] && !strcmp(test->prefixes[i], "xmlns"))
+ ok(!lstrcmpW(str, _bstr_(entry->xmlns_uri)), "got %s\n", wine_dbgstr_w(str));
+ else
+ ok(!lstrcmpW(str, _bstr_(test->uris[i])), "got %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+ }
+ else
+ ok(hr == S_FALSE, "Failed to get node name, hr %#x.\n", hr);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_text(item, &str);
+ ok(SUCCEEDED(hr), "Failed to get node text, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->texts[i])), "got %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ IXMLDOMNode_Release(item);
+ }
+
+ IXMLDOMNamedNodeMap_Release(map);
+ IXMLDOMNode_Release(node);
+ IXMLDOMDocument_Release(doc);
+
+ test++;
+ }
+
+ entry++;
+ }
+ free_bstrs();
+}
+
START_TEST(domdoc)
{
HRESULT hr;
test_url();
test_merging_text();
test_transformNodeToObject();
+ test_normalize_attribute_values();
+ test_namespaces_as_attributes();
test_xsltemplate();
test_xsltext();
ok_(__FILE__, line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
}
+static const char xmltestA[] = "http://test.winehq.org/tests/xmltest.xml";
+static const CHAR xmltestbodyA[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<a>TEST</a>\n";
+
DEFINE_GUID(SID_SContainerDispatch, 0xb722be00, 0x4e68, 0x101b, 0xa2, 0xbc, 0x00, 0xaa, 0x00, 0x40, 0x47, 0x70);
DEFINE_GUID(SID_UnknownSID, 0x75dd09cb, 0x6c40, 0x11d5, 0x85, 0x43, 0x00, 0xc0, 0x4f, 0xa0, 0xfb, 0xa3);
static int g_unexpectedcall, g_expectedcall;
+static int strcmp_wa(const WCHAR *strw, const char *stra)
+{
+ WCHAR buf[512];
+ MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, ARRAY_SIZE(buf));
+ return lstrcmpW(strw, buf);
+}
+
static BSTR alloc_str_from_narrow(const char *str)
{
int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
if(!str)
return NULL;
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %08x, expected %08x\n", method, url, hr, exhres);
}
+#define test_server_open(a,b,c,d) _test_server_open(__LINE__,a,b,c,d)
+static void _test_server_open(unsigned line, IServerXMLHTTPRequest *xhr, const char *method, const char *url, HRESULT exhres)
+{
+ VARIANT empty, vfalse;
+ HRESULT hr;
+
+ V_VT(&empty) = VT_EMPTY;
+ V_VT(&vfalse) = VT_BOOL;
+ 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);
+}
+
static void test_XMLHTTP(void)
{
static const char bodyA[] = "mode=Test";
static const char urlA[] = "http://test.winehq.org/tests/post.php";
- static const char xmltestA[] = "http://test.winehq.org/tests/xmltest.xml";
static const char referertesturl[] = "http://test.winehq.org/tests/referer.php";
static const WCHAR wszExpectedResponse[] = {'F','A','I','L','E','D',0};
- static const CHAR xmltestbodyA[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<a>TEST</a>\n";
static const WCHAR norefererW[] = {'n','o',' ','r','e','f','e','r','e','r',' ','s','e','t',0};
IXMLHttpRequest *xhr;
SysFreeString(str);
IXMLHttpRequest_Release(xhr);
+
+ /* invalid host */
+ xhr = create_xhr();
+
+ test_open(xhr, "GET", "http://invalid.host.test.winehq.org/test/path", S_OK);
+
+ 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);
+
+ IXMLHttpRequest_Release(xhr);
+ free_bstrs();
+}
+
+static void test_server_xhr(void)
+{
+ IServerXMLHTTPRequest *xhr;
+ BSTR response;
+ VARIANT body;
+ HRESULT hr;
+
+ /* GET request */
+ xhr = create_server_xhr();
+
+ test_server_open(xhr, "GET", xmltestA, S_OK);
+
+ V_VT(&body) = VT_EMPTY;
+
+ hr = IServerXMLHTTPRequest_send(xhr, body);
+ if (hr == INET_E_RESOURCE_NOT_FOUND)
+ {
+ skip("No connection could be made with test.winehq.org\n");
+ IServerXMLHTTPRequest_Release(xhr);
+ return;
+ }
+ ok(hr == S_OK, "send failed: %08x\n", hr);
+
+ hr = IServerXMLHTTPRequest_get_responseText(xhr, &response);
+ ok(hr == S_OK, "get_responseText failed: %08x\n", hr);
+ ok(!strcmp_wa(response, xmltestbodyA), "got %s\n", wine_dbgstr_w(response));
+ SysFreeString(response);
+
+ IServerXMLHTTPRequest_Release(xhr);
+
+ /* invalid host */
+ xhr = create_server_xhr();
+
+ test_server_open(xhr, "GET", "http://invalid.host.test.winehq.org/test/path", S_OK);
+
+ 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);
+
+ IServerXMLHTTPRequest_Release(xhr);
free_bstrs();
}
IXMLHttpRequest_Release(xhr);
test_XMLHTTP();
+ test_server_xhr();
test_safe_httpreq();
test_supporterrorinfo();
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
/* exit earlier on length mismatch */
if (lenexp != len) return;
- MultiByteToWideChar(CP_ACP, 0, expected, -1, buf, sizeof(buf)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, expected, -1, buf, ARRAY_SIZE(buf));
cmp = memcmp(str, buf, lenexp*sizeof(WCHAR));
if (cmp && todo)
EXPECT_REF(writer, 1);
- for (i = 0; i < sizeof(riids)/sizeof(REFIID); i++)
+ for (i = 0; i < ARRAY_SIZE(riids); i++)
{
IUnknown *handler;
IMXWriter *writer2;
hr = ISAXContentHandler_characters(content, chardataW, 0);
EXPECT_HR(hr, S_OK);
- hr = ISAXContentHandler_characters(content, chardataW, sizeof(chardataW)/sizeof(WCHAR) - 1);
+ hr = ISAXContentHandler_characters(content, chardataW, ARRAY_SIZE(chardataW) - 1);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
IStream *stream;
LARGE_INTEGER pos;
ULARGE_INTEGER pos2;
- DWORD test_count = sizeof(mxwriter_stream_tests)/sizeof(mxwriter_stream_tests[0]);
+ DWORD test_count = ARRAY_SIZE(mxwriter_stream_tests);
for(current_stream_test_index = 0; current_stream_test_index < test_count; ++current_stream_test_index) {
const mxwriter_stream_test *test = mxwriter_stream_tests+current_stream_test_index;
ok(!lstrcmpW(_bstr_("<!---->\r\n"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
- hr = ISAXLexicalHandler_comment(lexical, commentW, sizeof(commentW)/sizeof(WCHAR)-1);
+ hr = ISAXLexicalHandler_comment(lexical, commentW, ARRAY_SIZE(commentW) - 1);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
hr = IVBSAXLexicalHandler_startDTD(vblexical, NULL, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, sizeof(pubW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, sizeof(pubW)/sizeof(WCHAR), sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR), NULL, 0, NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), NULL, 0, NULL, 0);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
VariantClear(&dest);
/* system id is required if public is present */
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR), pubW, sizeof(pubW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), pubW, ARRAY_SIZE(pubW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR),
- pubW, sizeof(pubW)/sizeof(WCHAR), sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW),
+ pubW, ARRAY_SIZE(pubW), sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
hr = IVBSAXDeclHandler_elementDecl(vbdecl, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), contentW, sizeof(contentW)/sizeof(WCHAR));
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW, ARRAY_SIZE(contentW));
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_put_output(writer, dest);
EXPECT_HR(hr, S_OK);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), contentW, 0);
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW, 0);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;