[MSXML3_WINETEST] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-20 12:29:29 +01:00
parent bab6b90fd9
commit 3662ed8775
10 changed files with 390 additions and 97 deletions

View file

@ -13,7 +13,12 @@ list(APPEND SOURCE
xmlview.c xmlview.c
precomp.h) precomp.h)
add_executable(msxml3_winetest ${SOURCE} testlist.c rsrc.rc) add_executable(msxml3_winetest
${SOURCE}
guid.c
testlist.c
rsrc.rc)
add_idl_headers(xmlparser_idlheader_test xmlparser.idl) add_idl_headers(xmlparser_idlheader_test xmlparser.idl)
add_dependencies(msxml3_winetest xmlparser_idlheader_test) add_dependencies(msxml3_winetest xmlparser_idlheader_test)
set_module_type(msxml3_winetest win32cui) set_module_type(msxml3_winetest win32cui)

View file

@ -21,9 +21,27 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "precomp.h"
#include <asptlb.h> #define COBJMACROS
#define CONST_VTABLE
#include <stdio.h>
#include <assert.h>
#include "windows.h"
#include "msxml.h"
#include "msxml2.h"
#include "msxml2did.h"
#include "ole2.h"
#include "dispex.h"
#include "objsafe.h"
#include "mshtml.h"
#include "initguid.h"
#include "asptlb.h"
#include "wine/heap.h"
#include "wine/test.h"
/* undef the #define in msxml2 so that we can access all versions */ /* undef the #define in msxml2 so that we can access all versions */
#undef CLSID_DOMDocument #undef CLSID_DOMDocument
@ -155,7 +173,7 @@ static ULONG WINAPI dispevent_Release(IDispatch *iface)
ULONG ref = InterlockedDecrement( &This->ref ); ULONG ref = InterlockedDecrement( &This->ref );
if (ref == 0) if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return ref; return ref;
} }
@ -215,7 +233,7 @@ static const IDispatchVtbl dispeventVtbl =
static IDispatch* create_dispevent(void) static IDispatch* create_dispevent(void)
{ {
dispevent *event = HeapAlloc(GetProcessHeap(), 0, sizeof(*event)); dispevent *event = heap_alloc(sizeof(*event));
event->IDispatch_iface.lpVtbl = &dispeventVtbl; event->IDispatch_iface.lpVtbl = &dispeventVtbl;
event->ref = 1; event->ref = 1;
@ -682,8 +700,10 @@ static void _expect_list_len(IXMLDOMNodeList *list, LONG len, int line)
#define EXPECT_HR(hr,hr_exp) \ #define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
#ifdef __REACTOS__
#define EXPECT_NOT_HR(hr,hr_exp) \ #define EXPECT_NOT_HR(hr,hr_exp) \
ok(hr != hr_exp, "got 0x%08x, expected not 0x%08x\n", hr, hr_exp) ok(hr != hr_exp, "got 0x%08x, expected not 0x%08x\n", hr, hr_exp)
#endif
static const WCHAR szEmpty[] = { 0 }; static const WCHAR szEmpty[] = { 0 };
static const WCHAR szIncomplete[] = { static const WCHAR szIncomplete[] = {
@ -10168,13 +10188,68 @@ static void write_to_file(const char *name, const char *data)
CloseHandle(hfile); CloseHandle(hfile);
} }
static void test_doc_load_from_path(IXMLDOMDocument *doc, const char *path)
{
IXMLDOMDocument *doc2;
IXMLDOMElement *elem;
BSTR url, url2;
VARIANT_BOOL b;
VARIANT src;
HRESULT hr;
url = _bstr_(path);
V_VT(&src) = VT_BSTR;
V_BSTR(&src) = url;
hr = IXMLDOMDocument_load(doc, src, &b);
ok(hr == S_OK, "Failed to load document, %#x.\n", hr);
ok(b == VARIANT_TRUE, "got %d\n", b);
V_VT(&src) = VT_BSTR | VT_BYREF;
V_BSTRREF(&src) = &url;
hr = IXMLDOMDocument_load(doc, src, &b);
ok(hr == S_OK, "Failed to load document, %#x.\n", hr);
ok(b == VARIANT_TRUE, "got %d\n", b);
url = NULL;
hr = IXMLDOMDocument_get_url(doc, &url);
ok(hr == S_OK, "Failed to get document url, hr %#x.\n", hr);
hr = IXMLDOMDocument_get_documentElement(doc, &elem);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* Create another instance for the same document, check url */
hr = IXMLDOMElement_get_ownerDocument(elem, &doc2);
ok(hr == S_OK, "Failed to get owner document, hr %#x.\n", hr);
hr = IXMLDOMDocument_get_url(doc2, &url2);
ok(hr == S_OK, "Failed to get document url, hr %#x.\n", hr);
ok(!lstrcmpW(url, url2), "Unexpected url %s.\n", wine_dbgstr_w(url2));
IXMLDOMDocument_Release(doc2);
IXMLDOMElement_Release(elem);
SysFreeString(url2);
SysFreeString(url);
}
static void url_forward_slash(char *url)
{
char *p = url;
while (*p)
{
if (*p == '\\')
*p = '/';
p++;
}
}
static void test_load(void) static void test_load(void)
{ {
IXMLDOMDocument *doc, *doc2; char path[MAX_PATH], path2[MAX_PATH];
BSTR pathW, bstr1, bstr2;
IXMLDOMNodeList *list; IXMLDOMNodeList *list;
IXMLDOMElement *elem; IXMLDOMDocument *doc;
char path[MAX_PATH]; BSTR bstr1, bstr2;
VARIANT_BOOL b; VARIANT_BOOL b;
VARIANT src; VARIANT src;
HRESULT hr; HRESULT hr;
@ -10195,47 +10270,26 @@ static void test_load(void)
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
ok(b == VARIANT_FALSE, "got %d\n", b); ok(b == VARIANT_FALSE, "got %d\n", b);
pathW = _bstr_(path); /* "file://" url */
strcpy(path2, "file://");
strcat(path2, path);
test_doc_load_from_path(doc, path2);
/* load from path: VT_BSTR */ /* file:// url, forward slashes */
V_VT(&src) = VT_BSTR; url_forward_slash(path2);
V_BSTR(&src) = pathW; test_doc_load_from_path(doc, path2);
hr = IXMLDOMDocument_load(doc, src, &b);
EXPECT_HR(hr, S_OK);
ok(b == VARIANT_TRUE, "got %d\n", b);
bstr1 = NULL; /* "file:/" url */
hr = IXMLDOMDocument_get_url(doc, &bstr1); strcpy(path2, "file:/");
ok(hr == S_OK, "got 0x%08x\n", hr); strcat(path2, path);
SysFreeString(bstr1); test_doc_load_from_path(doc, path);
/* load from a path: VT_BSTR|VT_BYREF */ /* file:/ with forward slashes. */
V_VT(&src) = VT_BSTR | VT_BYREF; url_forward_slash(path2);
V_BSTRREF(&src) = &pathW; test_doc_load_from_path(doc, path2);
hr = IXMLDOMDocument_load(doc, src, &b);
EXPECT_HR(hr, S_OK);
ok(b == VARIANT_TRUE, "got %d\n", b);
bstr1 = NULL; /* Regular local path. */
hr = IXMLDOMDocument_get_url(doc, &bstr1); test_doc_load_from_path(doc, path);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMDocument_get_documentElement(doc, &elem);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* create another instance for the same document, check url */
hr = IXMLDOMElement_get_ownerDocument(elem, &doc2);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMDocument_get_url(doc, &bstr2);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(bstr1, bstr2), "got %s\n", wine_dbgstr_w(bstr2));
IXMLDOMDocument_Release(doc2);
IXMLDOMElement_Release(elem);
SysFreeString(bstr1);
SysFreeString(bstr2);
/* load from a path: VT_BSTR|VT_BYREF, null ptr */ /* load from a path: VT_BSTR|VT_BYREF, null ptr */
V_VT(&src) = VT_BSTR | VT_BYREF; V_VT(&src) = VT_BSTR | VT_BYREF;
@ -10255,7 +10309,7 @@ static void test_load(void)
write_to_file(path, nocontent); write_to_file(path, nocontent);
V_VT(&src) = VT_BSTR; V_VT(&src) = VT_BSTR;
V_BSTR(&src) = pathW; V_BSTR(&src) = _bstr_(path);
b = VARIANT_TRUE; b = VARIANT_TRUE;
hr = IXMLDOMDocument_load(doc, src, &b); hr = IXMLDOMDocument_load(doc, src, &b);
ok(hr == S_FALSE, "got 0x%08x\n", hr); ok(hr == S_FALSE, "got 0x%08x\n", hr);
@ -12124,34 +12178,148 @@ static void test_put_data(void)
type++; type++;
} }
/* \r\n sequence is never escaped */ IXMLDOMDocument_Release(doc);
free_bstrs();
}
static void test_newline_normalization(void)
{
const struct msxmlsupported_data_t *table = domdoc_support_data;
IXMLDOMDocument *doc;
IXMLDOMText *text;
IXMLDOMNode *node;
VARIANT v;
VARIANT_BOOL b;
BSTR s;
HRESULT hr;
LONG length;
V_VT(&v) = VT_I2; V_VT(&v) = VT_I2;
V_I2(&v) = NODE_TEXT; V_I2(&v) = NODE_TEXT;
hr = IXMLDOMDocument_createNode(doc, v, _bstr_("name"), NULL, &node); while (table->clsid)
ok(hr == S_OK, "got 0x%08x\n", hr); {
if (!is_clsid_supported(table->clsid, &IID_IXMLDOMDocument))
{
table++;
continue;
}
IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)&text); hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (void**)&doc);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMText_put_data(text, _bstr_("\r\n")); hr = IXMLDOMDocument_createNode(doc, v, _bstr_("name"), NULL, &node);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMText_get_data(text, &get_data); IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)&text);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* \r\n is normalized to \n and back to \r\n */
hr = IXMLDOMText_put_data(text, _bstr_("\r\n"));
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMText_get_data(text, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("\n")), "got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
hr = IXMLDOMText_get_length(text, &length);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(length == 1, "got %d, expected 1\n", length);
hr = IXMLDOMText_get_xml(text, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("\r\n")), "got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
/* \r\r\n is normalized to \n\n and back to \r\n\r\n */
hr = IXMLDOMText_put_data(text, _bstr_("\r\r\n"));
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMText_get_data(text, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("\n\n")), "got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
hr = IXMLDOMText_get_length(text, &length);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(length == 2, "got %d, expected 2\n", length);
hr = IXMLDOMText_get_xml(text, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("\r\n\r\n")), "got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
/* the same normalizations are applied when loading a document as a whole */
hr = IXMLDOMDocument_loadXML(doc, _bstr_("<?xml version=\"1.0\"?><root>foo\n\r\n\r\r\nbar</root>"), &b);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMDocument_get_text(doc, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("foo\n\n\n\nbar")), "got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
hr = IXMLDOMDocument_get_xml(doc, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("<?xml version=\"1.0\"?>\r\n<root>foo\r\n\r\n\r\n\r\nbar</root>\r\n")),
"got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
/* even if xml:space="preserve" */
hr = IXMLDOMDocument_loadXML(doc, _bstr_("<?xml version=\"1.0\"?>"
"<root xml:space=\"preserve\">foo\n\r\n\r\r\nbar</root>"), &b);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMDocument_get_text(doc, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("foo\n\n\n\nbar")), "got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
hr = IXMLDOMDocument_get_xml(doc, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("<?xml version=\"1.0\"?>\r\n"
"<root xml:space=\"preserve\">foo\r\n\r\n\r\n\r\nbar</root>\r\n")),
"got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
/* or preserveWhiteSpace is set */
hr = IXMLDOMDocument_put_preserveWhiteSpace(doc, VARIANT_TRUE);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMDocument_loadXML(doc, _bstr_("<?xml version=\"1.0\"?><root>foo\n\r\n\r\r\nbar</root>"), &b);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXMLDOMDocument_get_text(doc, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(s, _bstr_("foo\n\n\n\nbar")), "got %s\n", wine_dbgstr_w(s));
SysFreeString(s);
hr = IXMLDOMDocument_get_xml(doc, &s);
ok(hr == S_OK, "got 0x%08x\n", hr);
if (IsEqualGUID(table->clsid, &CLSID_DOMDocument60))
{
/* DOMDocument60 does the newline normalization but does not insert line breaks around the root node */
todo_wine todo_wine
ok(!lstrcmpW(get_data, _bstr_("\n")), "got %s\n", wine_dbgstr_w(get_data)); ok(!lstrcmpW(s, _bstr_("<?xml version=\"1.0\"?><root>foo\r\n\r\n\r\n\r\nbar</root>")),
SysFreeString(get_data); "got %s\n", wine_dbgstr_w(s));
}
else
{
ok(!lstrcmpW(s, _bstr_("<?xml version=\"1.0\"?>\r\n<root>foo\r\n\r\n\r\n\r\nbar</root>\r\n")),
"got %s\n", wine_dbgstr_w(s));
}
SysFreeString(s);
hr = IXMLDOMText_get_xml(text, &get_data); IXMLDOMText_Release(text);
ok(hr == S_OK, "got 0x%08x\n", hr); IXMLDOMNode_Release(node);
ok(!lstrcmpW(get_data, _bstr_("\r\n")), "got %s\n", wine_dbgstr_w(get_data)); IXMLDOMDocument_Release(doc);
SysFreeString(get_data); free_bstrs();
table++;
IXMLDOMText_Release(text); }
IXMLDOMNode_Release(node);
IXMLDOMDocument_Release(doc);
free_bstrs();
} }
static void test_putref_schemas(void) static void test_putref_schemas(void)
@ -12735,6 +12903,7 @@ START_TEST(domdoc)
test_nodeValue(); test_nodeValue();
test_get_namespaces(); test_get_namespaces();
test_put_data(); test_put_data();
test_newline_normalization();
test_putref_schemas(); test_putref_schemas();
test_namedmap_newenum(); test_namedmap_newenum();
test_xmlns_attribute(); test_xmlns_attribute();

View file

@ -0,0 +1,16 @@
/* DO NOT USE THE PRECOMPILED HEADER FOR THIS FILE! */
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#include <windef.h>
#include <winbase.h>
#include <initguid.h>
#include <objsafe.h>
#include <msxml2.h>
#include <mshtml.h>
#include <xmlparser.h>
/* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */

View file

@ -18,7 +18,25 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "precomp.h"
#define COBJMACROS
#define CONST_VTABLE
#include <stdio.h>
#include <assert.h>
#include "windows.h"
#include "msxml2.h"
#include "msxml2did.h"
#include "dispex.h"
#include "initguid.h"
#include "objsafe.h"
#include "mshtml.h"
#include "wine/heap.h"
#include "wine/test.h"
#define EXPECT_HR(hr,hr_exp) \ #define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
@ -1226,7 +1244,7 @@ static ULONG WINAPI dispevent_Release(IDispatch *iface)
ULONG ref = InterlockedDecrement( &This->ref ); ULONG ref = InterlockedDecrement( &This->ref );
if (ref == 0) if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return ref; return ref;
} }
@ -1303,7 +1321,7 @@ static const IDispatchVtbl dispeventVtbl =
static IDispatch* create_dispevent(void) static IDispatch* create_dispevent(void)
{ {
dispevent *event = HeapAlloc(GetProcessHeap(), 0, sizeof(*event)); dispevent *event = heap_alloc(sizeof(*event));
event->IDispatch_iface.lpVtbl = &dispeventVtbl; event->IDispatch_iface.lpVtbl = &dispeventVtbl;
event->ref = 1; event->ref = 1;

View file

@ -1,9 +1,8 @@
#ifndef _MSXML3_WINETEST_PRECOMP_H_ #ifndef _MSXML3_WINETEST_PRECOMP_H_
#define _MSXML3_WINETEST_PRECOMP_H_ #define _MSXML3_WINETEST_PRECOMP_H_
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS #define COBJMACROS
#define CONST_VTABLE #define CONST_VTABLE
@ -12,14 +11,14 @@
#include <assert.h> #include <assert.h>
#include <wine/test.h> #include <wine/test.h>
#include <wine/heap.h>
#include <winnls.h> #include <windows.h>
#include <wingdi.h>
#include <initguid.h>
#include <ole2.h> #include <ole2.h>
#include <msxml2.h> #include <msxml2.h>
#include <msxml2did.h>
#include <objsafe.h> #include <objsafe.h>
#include <ocidl.h>
#include <dispex.h>
#include <mshtml.h> #include <mshtml.h>
#include <xmlparser.h> #include <xmlparser.h>

View file

@ -20,9 +20,21 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "precomp.h" #define COBJMACROS
#define CONST_VTABLE
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); #include <stdio.h>
#include <assert.h>
#include "windows.h"
#include "ole2.h"
#include "msxml2.h"
#include "msxml2did.h"
#include "ocidl.h"
#include "dispex.h"
#include "wine/heap.h"
#include "wine/test.h"
static const WCHAR emptyW[] = {0}; static const WCHAR emptyW[] = {0};
@ -246,16 +258,13 @@ static void add_call(struct call_sequence **seq, int sequence_index,
if (!call_seq->sequence) if (!call_seq->sequence)
{ {
call_seq->size = 10; call_seq->size = 10;
call_seq->sequence = HeapAlloc(GetProcessHeap(), 0, call_seq->sequence = heap_alloc(call_seq->size * sizeof (struct call_entry));
call_seq->size * sizeof (struct call_entry));
} }
if (call_seq->count == call_seq->size) if (call_seq->count == call_seq->size)
{ {
call_seq->size *= 2; call_seq->size *= 2;
call_seq->sequence = HeapReAlloc(GetProcessHeap(), 0, call_seq->sequence = heap_realloc(call_seq->sequence, call_seq->size * sizeof (struct call_entry));
call_seq->sequence,
call_seq->size * sizeof (struct call_entry));
} }
assert(call_seq->sequence); assert(call_seq->sequence);
@ -290,7 +299,7 @@ static inline void flush_sequence(struct call_sequence **seg, int sequence_index
SysFreeString(call_seq->sequence[i].attributes[j].qnameW); SysFreeString(call_seq->sequence[i].attributes[j].qnameW);
SysFreeString(call_seq->sequence[i].attributes[j].valueW); SysFreeString(call_seq->sequence[i].attributes[j].valueW);
} }
HeapFree(GetProcessHeap(), 0, call_seq->sequence[i].attributes); heap_free(call_seq->sequence[i].attributes);
call_seq->sequence[i].attr_count = 0; call_seq->sequence[i].attr_count = 0;
SysFreeString(call_seq->sequence[i].arg1W); SysFreeString(call_seq->sequence[i].arg1W);
@ -298,7 +307,7 @@ static inline void flush_sequence(struct call_sequence **seg, int sequence_index
SysFreeString(call_seq->sequence[i].arg3W); SysFreeString(call_seq->sequence[i].arg3W);
} }
HeapFree(GetProcessHeap(), 0, call_seq->sequence); heap_free(call_seq->sequence);
call_seq->sequence = NULL; call_seq->sequence = NULL;
call_seq->count = call_seq->size = 0; call_seq->count = call_seq->size = 0;
} }
@ -525,7 +534,7 @@ static void init_call_sequences(struct call_sequence **seq, int n)
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct call_sequence)); seq[i] = heap_alloc_zero(sizeof(struct call_sequence));
} }
static const WCHAR szSimpleXML[] = { static const WCHAR szSimpleXML[] = {
@ -1212,7 +1221,7 @@ static HRESULT WINAPI contentHandler_startElement(
int i; int i;
struct attribute_entry *attr; struct attribute_entry *attr;
attr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(struct attribute_entry)); attr = heap_alloc_zero(len * sizeof(*attr));
v = VARIANT_TRUE; v = VARIANT_TRUE;
hr = ISAXXMLReader_getFeature(g_reader, _bstr_("http://xml.org/sax/features/namespaces"), &v); hr = ISAXXMLReader_getFeature(g_reader, _bstr_("http://xml.org/sax/features/namespaces"), &v);
@ -2780,6 +2789,36 @@ static void test_saxreader_features(void)
continue; continue;
} }
if (IsEqualGUID(entry->guid, &CLSID_SAXXMLReader40) ||
IsEqualGUID(entry->guid, &CLSID_SAXXMLReader60))
{
value = VARIANT_TRUE;
hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value);
ok(hr == S_OK, "Failed to get feature value, hr %#x.\n", hr);
ok(value == VARIANT_FALSE, "Unexpected default feature value.\n");
hr = ISAXXMLReader_putFeature(reader, _bstr_("exhaustive-errors"), VARIANT_FALSE);
ok(hr == S_OK, "Failed to put feature value, hr %#x.\n", hr);
value = VARIANT_TRUE;
hr = ISAXXMLReader_getFeature(reader, _bstr_("schema-validation"), &value);
ok(hr == S_OK, "Failed to get feature value, hr %#x.\n", hr);
ok(value == VARIANT_FALSE, "Unexpected default feature value.\n");
hr = ISAXXMLReader_putFeature(reader, _bstr_("exhaustive-errors"), VARIANT_FALSE);
ok(hr == S_OK, "Failed to put feature value, hr %#x.\n", hr);
}
else
{
value = 123;
hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value);
ok(hr == E_INVALIDARG, "Failed to get feature value, hr %#x.\n", hr);
ok(value == 123, "Unexpected value %d.\n", value);
value = 123;
hr = ISAXXMLReader_getFeature(reader, _bstr_("schema-validation"), &value);
ok(hr == E_INVALIDARG, "Failed to get feature value, hr %#x.\n", hr);
ok(value == 123, "Unexpected value %d.\n", value);
}
name = feature_names; name = feature_names;
while (*name) while (*name)
{ {
@ -3296,7 +3335,7 @@ static void test_mxwriter_flush(void)
ok(pos2.QuadPart == 0, "expected stream beginning\n"); ok(pos2.QuadPart == 0, "expected stream beginning\n");
len = 2048; len = 2048;
buff = HeapAlloc(GetProcessHeap(), 0, len+1); buff = heap_alloc(len + 1);
memset(buff, 'A', len); memset(buff, 'A', len);
buff[len] = 0; buff[len] = 0;
hr = ISAXContentHandler_characters(content, _bstr_(buff), len); hr = ISAXContentHandler_characters(content, _bstr_(buff), len);
@ -3379,7 +3418,7 @@ static void test_mxwriter_flush(void)
ok(SysStringLen(V_BSTR(&dest)) == len, "got len=%d, expected %d\n", SysStringLen(V_BSTR(&dest)), len); ok(SysStringLen(V_BSTR(&dest)) == len, "got len=%d, expected %d\n", SysStringLen(V_BSTR(&dest)), len);
VariantClear(&dest); VariantClear(&dest);
HeapFree(GetProcessHeap(), 0, buff); heap_free(buff);
ISAXContentHandler_Release(content); ISAXContentHandler_Release(content);
IStream_Release(stream); IStream_Release(stream);
IMXWriter_Release(writer); IMXWriter_Release(writer);

View file

@ -19,9 +19,23 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "precomp.h" #include <stdio.h>
#include <assert.h>
#define COBJMACROS
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); #include "initguid.h"
#include "windows.h"
#include "ole2.h"
#include "msxml2.h"
#undef CLSID_DOMDocument
#include "msxml2did.h"
#include "dispex.h"
#include "wine/test.h"
#ifdef __REACTOS__
#include <cguid.h>
#endif
#define EXPECT_HR(hr,hr_exp) \ #define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
@ -426,8 +440,13 @@ static const CHAR szOpenSeqXML4[] = "<test><x/><x/><y/><z/><z/><v/></test>";
wine_dbgstr_longlong(v1), wine_dbgstr_longlong(v2)); \ wine_dbgstr_longlong(v1), wine_dbgstr_longlong(v2)); \
} }
#ifdef __REACTOS__
#define expect_int64(expr, x, base) _expect64(expr, #x, base, LONG64, _strtoi64) #define expect_int64(expr, x, base) _expect64(expr, #x, base, LONG64, _strtoi64)
#define expect_uint64(expr, x, base) _expect64(expr, #x, base, ULONG64, _strtoui64) #define expect_uint64(expr, x, base) _expect64(expr, #x, base, ULONG64, _strtoui64)
#else
#define expect_int64(expr, x, base) _expect64(expr, #x, base, LONG64, strtoll)
#define expect_uint64(expr, x, base) _expect64(expr, #x, base, ULONG64, strtoull)
#endif
static BSTR alloced_bstrs[256]; static BSTR alloced_bstrs[256];
static int alloced_bstrs_count; static int alloced_bstrs_count;

View file

@ -18,7 +18,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "precomp.h" #define COBJMACROS
#include <stdio.h>
#include "windows.h"
#include "ole2.h"
#include "msxml2.h"
#include "msxml2did.h"
#include "ocidl.h"
#include "wine/test.h"
#define EXPECT_HR(hr,hr_exp) \ #define EXPECT_HR(hr,hr_exp) \
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)

View file

@ -17,8 +17,17 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define COBJMACROS
#define CONST_VTABLE
#include <stdio.h>
#include <assert.h>
#include "windows.h"
#include "ole2.h"
#include "xmlparser.h"
#include "wine/test.h"
#include "precomp.h"
static HRESULT WINAPI nodefact_QueryInterface(IXMLNodeFactory *iface, static HRESULT WINAPI nodefact_QueryInterface(IXMLNodeFactory *iface,
REFIID riid, void **ppvObject) REFIID riid, void **ppvObject)

View file

@ -15,13 +15,23 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define COBJMACROS
#define CONST_VTABLE
#include "precomp.h" #include <stdio.h>
#include <assert.h>
#include <perhist.h> #include "windows.h"
#include <docobj.h> #include "ole2.h"
#include "mshtml.h"
#include "mshtmdid.h"
#include "initguid.h"
#include "perhist.h"
#include "docobj.h"
#include "urlmon.h"
#include "xmlparser.h"
#define DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE DISPID_READYSTATECHANGE #include "wine/test.h"
HRESULT (WINAPI *pCreateURLMoniker)(IMoniker*, LPCWSTR, IMoniker**); HRESULT (WINAPI *pCreateURLMoniker)(IMoniker*, LPCWSTR, IMoniker**);