Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/msxml3/tests/domdoc.c | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index e94a2c88a81..6ba88cf0bf7 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -8522,10 +8522,20 @@ static void test_events(void)
static void test_createProcessingInstruction(void) { + static const WCHAR xml1[] = L"<?xml version=\"1.0\"?>\r\n<test/>\r\n"; + static const char xml2[] = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\r\n<test/>\r\n"; + static const char xml2_vista[] = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\r\n"; IXMLDOMProcessingInstruction *pi; IXMLDOMDocument *doc; + IXMLDOMNode *node; + IXMLDOMElement *element; WCHAR buff[10]; + BSTR xml; + VARIANT var; HRESULT hr; + IStream *stream; + HGLOBAL global; + char *p;
doc = create_document(&IID_IXMLDOMDocument);
@@ -8538,6 +8548,47 @@ static void test_createProcessingInstruction(void)
IXMLDOMProcessingInstruction_Release(pi); IXMLDOMDocument_Release(doc); + + doc = create_document(&IID_IXMLDOMDocument); + + hr = IXMLDOMDocument_createProcessingInstruction(doc, _bstr_("xml"), _bstr_("version="1.0" encoding="iso-8859-1""), &pi); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IXMLDOMProcessingInstruction_QueryInterface(pi, &IID_IXMLDOMNode, (void **)&node); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IXMLDOMDocument_appendChild(doc, node, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + IXMLDOMNode_Release(node); + IXMLDOMProcessingInstruction_Release(pi); + + hr = IXMLDOMDocument_createElement(doc, _bstr_("test"), &element); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IXMLDOMDocument_appendChild(doc, (IXMLDOMNode *)element, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + IXMLDOMElement_Release(element); + + hr = IXMLDOMDocument_get_xml(doc, &xml); + ok(hr == S_OK, "got 0x%08x\n", hr); +todo_wine + ok(!wcscmp(xml, xml1), "got %s\n", wine_dbgstr_w(xml)); + SysFreeString(xml); + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + V_VT(&var) = VT_UNKNOWN; + V_UNKNOWN(&var) = (IUnknown*)stream; + hr = IXMLDOMDocument_save(doc, var); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &global); + ok(hr == S_OK, "got 0x%08x\n", hr); + p = GlobalLock(global); + p[GlobalSize(global)] = 0; +todo_wine + ok(!strcmp(p, xml2) || broken(!strcmp(p, xml2_vista)), "got %s\n", wine_dbgstr_a(p)); + GlobalUnlock(global); + IStream_Release(stream); + + IXMLDOMDocument_Release(doc); }
static void test_put_nodeTypedValue(void)
What's the status of the first two patches in the series?
On 3/24/21 10:42 AM, Dmitry Timoshkov wrote:
What's the status of the first two patches in the series?
Encoding you used seems to be a reason for broken Vista case. Since this does not test anything encoding-specific, utf-8 will make it work without broken() cases. Test itself belongs to test_save().
Regarding 2/3, the reason to unlink originally was to fix duplicated prologs, occasionally appearing in output. I don't remember details now, it's possible it was about first loading document, and then inserting prolog PI. This is again a case where implementing own dumping logic will help, both with prolog and newlines.
Nikolay Sivov nsivov@codeweavers.com wrote:
On 3/24/21 10:42 AM, Dmitry Timoshkov wrote:
What's the status of the first two patches in the series?
Encoding you used seems to be a reason for broken Vista case. Since this does not test anything encoding-specific, utf-8 will make it work without broken() cases. Test itself belongs to test_save().
Which encoding would you suggest to use for the test then?
Regarding 2/3, the reason to unlink originally was to fix duplicated prologs, occasionally appearing in output. I don't remember details now, it's possible it was about first loading document, and then inserting prolog PI.
I guess since the patch in 2/3 doesn't break existing tests then the problem you mentioned might be fixed already, so it might be safe to assume that the patch is correct.
This is again a case where implementing own dumping logic will help, both with prolog and newlines.
Then again, the patch could be a light alternative to a full rewrite, especially if nobody is planning to work on this in near future.