From 753e05959ceb0b15fd00ddb86be294b9858af4b8 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 10 Nov 2019 14:08:17 +0100 Subject: [PATCH] [MSXML3_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- modules/rostests/winetests/msxml3/saxreader.c | 94 ++++++++++++++++++- modules/rostests/winetests/msxml3/schema.c | 4 +- 2 files changed, 95 insertions(+), 3 deletions(-) diff --git a/modules/rostests/winetests/msxml3/saxreader.c b/modules/rostests/winetests/msxml3/saxreader.c index eeef5b64c12..4e77b00a639 100644 --- a/modules/rostests/winetests/msxml3/saxreader.c +++ b/modules/rostests/winetests/msxml3/saxreader.c @@ -1162,6 +1162,9 @@ static HRESULT WINAPI contentHandler_startPrefixMapping( { struct call_entry call; + ok(prefix != NULL, "prefix == NULL\n"); + ok(uri != NULL, "uri == NULL\n"); + init_call_entry(locator, &call); call.id = CH_STARTPREFIXMAPPING; call.arg1W = SysAllocStringLen(prefix, prefix_len); @@ -1177,6 +1180,8 @@ static HRESULT WINAPI contentHandler_endPrefixMapping( { struct call_entry call; + ok(prefix != NULL, "prefix == NULL\n"); + init_call_entry(locator, &call); call.id = CH_ENDPREFIXMAPPING; call.arg1W = SysAllocStringLen(prefix, len); @@ -1197,6 +1202,10 @@ static HRESULT WINAPI contentHandler_startElement( HRESULT hr; int len; + ok(uri != NULL, "uri == NULL\n"); + ok(localname != NULL, "localname == NULL\n"); + ok(qname != NULL, "qname == NULL\n"); + hr = ISAXAttributes_QueryInterface(saxattr, &IID_IMXAttributes, (void**)&mxattr); EXPECT_HR(hr, E_NOINTERFACE); @@ -1272,6 +1281,10 @@ static HRESULT WINAPI contentHandler_endElement( { struct call_entry call; + ok(uri != NULL, "uri == NULL\n"); + ok(localname != NULL, "localname == NULL\n"); + ok(qname != NULL, "qname == NULL\n"); + init_call_entry(locator, &call); call.id = CH_ENDELEMENT; call.arg1W = SysAllocStringLen(uri, uri_len); @@ -1289,6 +1302,8 @@ static HRESULT WINAPI contentHandler_characters( { struct call_entry call; + ok(chars != NULL, "chars == NULL\n"); + init_call_entry(locator, &call); call.id = CH_CHARACTERS; call.arg1W = SysAllocStringLen(chars, len); @@ -1303,6 +1318,8 @@ static HRESULT WINAPI contentHandler_ignorableWhitespace( { struct call_entry call; + ok(chars != NULL, "chars == NULL\n"); + init_call_entry(locator, &call); call.id = CH_IGNORABLEWHITESPACE; call.arg1W = SysAllocStringLen(chars, len); @@ -1318,6 +1335,9 @@ static HRESULT WINAPI contentHandler_processingInstruction( { struct call_entry call; + ok(target != NULL, "target == NULL\n"); + ok(data != NULL, "data == NULL\n"); + init_call_entry(locator, &call); call.id = CH_PROCESSINGINSTRUCTION; call.arg1W = SysAllocStringLen(target, target_len); @@ -1333,6 +1353,8 @@ static HRESULT WINAPI contentHandler_skippedEntity( { struct call_entry call; + ok(name != NULL, "name == NULL\n"); + init_call_entry(locator, &call); call.id = CH_SKIPPEDENTITY; call.arg1W = SysAllocStringLen(name, len); @@ -3950,10 +3972,13 @@ static const struct writer_characters_t writer_characters[] = { static void test_mxwriter_characters(void) { static const WCHAR chardataW[] = {'T','E','S','T','C','H','A','R','D','A','T','A',' ','.',0}; + static const WCHAR embedded_nullbytes[] = {'a',0,'b',0,0,0,'c',0}; const struct writer_characters_t *table = writer_characters; + IVBSAXContentHandler *vb_content; ISAXContentHandler *content; IMXWriter *writer; VARIANT dest; + BSTR str; HRESULT hr; int i = 0; @@ -3964,6 +3989,9 @@ static void test_mxwriter_characters(void) hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content); EXPECT_HR(hr, S_OK); + hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXContentHandler, (void**)&vb_content); + EXPECT_HR(hr, S_OK); + hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE); EXPECT_HR(hr, S_OK); @@ -3976,6 +4004,10 @@ static void test_mxwriter_characters(void) hr = ISAXContentHandler_characters(content, chardataW, 0); EXPECT_HR(hr, S_OK); + str = _bstr_("VbChars"); + hr = IVBSAXContentHandler_characters(vb_content, &str); + EXPECT_HR(hr, S_OK); + hr = ISAXContentHandler_characters(content, chardataW, ARRAY_SIZE(chardataW) - 1); EXPECT_HR(hr, S_OK); @@ -3983,13 +4015,14 @@ static void test_mxwriter_characters(void) hr = IMXWriter_get_output(writer, &dest); EXPECT_HR(hr, S_OK); ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest)); - ok(!lstrcmpW(_bstr_("TESTCHARDATA ."), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest))); + ok(!lstrcmpW(_bstr_("VbCharsTESTCHARDATA ."), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest))); VariantClear(&dest); hr = ISAXContentHandler_endDocument(content); EXPECT_HR(hr, S_OK); ISAXContentHandler_Release(content); + IVBSAXContentHandler_Release(vb_content); IMXWriter_Release(writer); /* try empty characters data to see if element is closed */ @@ -4025,6 +4058,65 @@ static void test_mxwriter_characters(void) ISAXContentHandler_Release(content); IMXWriter_Release(writer); + /* test embedded null bytes */ + hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER, + &IID_IMXWriter, (void**)&writer); + EXPECT_HR(hr, S_OK); + + hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content); + EXPECT_HR(hr, S_OK); + + hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE); + EXPECT_HR(hr, S_OK); + + hr = ISAXContentHandler_startDocument(content); + EXPECT_HR(hr, S_OK); + + hr = ISAXContentHandler_characters(content, embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes)); + EXPECT_HR(hr, S_OK); + + V_VT(&dest) = VT_EMPTY; + hr = IMXWriter_get_output(writer, &dest); + EXPECT_HR(hr, S_OK); + ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest)); + ok(SysStringLen(V_BSTR(&dest)) == ARRAY_SIZE(embedded_nullbytes), "unexpected len %d\n", SysStringLen(V_BSTR(&dest))); + ok(!memcmp(V_BSTR(&dest), embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes)), + "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest))); + VariantClear(&dest); + + ISAXContentHandler_Release(content); + IMXWriter_Release(writer); + + hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER, + &IID_IMXWriter, (void**)&writer); + EXPECT_HR(hr, S_OK); + + hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXContentHandler, (void**)&vb_content); + EXPECT_HR(hr, S_OK); + + hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE); + EXPECT_HR(hr, S_OK); + + hr = IVBSAXContentHandler_startDocument(vb_content); + EXPECT_HR(hr, S_OK); + + str = SysAllocStringLen(embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes)); + hr = IVBSAXContentHandler_characters(vb_content, &str); + EXPECT_HR(hr, S_OK); + SysFreeString(str); + + V_VT(&dest) = VT_EMPTY; + hr = IMXWriter_get_output(writer, &dest); + EXPECT_HR(hr, S_OK); + ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest)); + ok(SysStringLen(V_BSTR(&dest)) == ARRAY_SIZE(embedded_nullbytes), "unexpected len %d\n", SysStringLen(V_BSTR(&dest))); + ok(!memcmp(V_BSTR(&dest), embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes)), + "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest))); + VariantClear(&dest); + + IVBSAXContentHandler_Release(vb_content); + IMXWriter_Release(writer); + /* batch tests */ while (table->clsid) { diff --git a/modules/rostests/winetests/msxml3/schema.c b/modules/rostests/winetests/msxml3/schema.c index a62314dd263..c615e859817 100644 --- a/modules/rostests/winetests/msxml3/schema.c +++ b/modules/rostests/winetests/msxml3/schema.c @@ -1380,10 +1380,10 @@ static void test_XDR_datatypes(void) break; case VT_R8: if (!strcmp(ptr->typename, "float")) - ok(V_R8(&v) == (double)3.14159, "got %f\n", V_R8(&v)); + ok(V_R8(&v) == 3.14159, "got %f\n", V_R8(&v)); else todo_wine - ok(V_R8(&v) == (double)3.14159265358979323846, "got %.20f\n", V_R8(&v)); + ok(V_R8(&v) == 3.14159265358979323846, "got %.20f\n", V_R8(&v)); break; case VT_UI1: ok(V_UI1(&v) == 0xFF, "got %02x\n", V_UI1(&v));