From 6c1275a57cef4c5a03ff9df2c346a349e095397d Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 13 Jan 2010 00:30:46 +0300 Subject: [PATCH] msxml3/xmldoc: IPersistStreamInit::InitNew() seems to do nothing for IXMLDocument. --- dlls/msxml3/tests/xmldoc.c | 25 +++++++++++++++++++++++-- dlls/msxml3/xmldoc.c | 5 +++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/dlls/msxml3/tests/xmldoc.c b/dlls/msxml3/tests/xmldoc.c index 426ef6f7ba2..9611f7c7bb5 100644 --- a/dlls/msxml3/tests/xmldoc.c +++ b/dlls/msxml3/tests/xmldoc.c @@ -355,6 +355,7 @@ static void test_createElement(void) static void test_persiststreaminit(void) { IXMLDocument *doc = NULL; + IXMLElement *element = NULL; IPersistStreamInit *psi = NULL; IStream *stream = NULL; STATSTG stat; @@ -362,6 +363,8 @@ static void test_persiststreaminit(void) ULARGE_INTEGER size; CHAR path[MAX_PATH]; CLSID id; + BSTR str; + static const WCHAR testW[] = {'t','e','s','t',0}; hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDocument, (LPVOID*)&doc); @@ -382,7 +385,10 @@ static void test_persiststreaminit(void) todo_wine ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); hr = IPersistStreamInit_GetClassID(psi, NULL); - ok(hr == E_POINTER, "Expected E_INVALIDARG, got %08x\n", hr); + ok(hr == E_POINTER, "Expected E_POINTER, got %08x\n", hr); + + hr = IPersistStreamInit_IsDirty(psi); + todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); create_xml_file("bank.xml"); GetFullPathNameA("bank.xml", MAX_PATH, path, NULL); @@ -400,6 +406,9 @@ static void test_persiststreaminit(void) if(hr == XML_E_INVALIDATROOTLEVEL) goto cleanup; + hr = IPersistStreamInit_IsDirty(psi); + todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); + /* try to save document */ stream = NULL; hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); @@ -413,9 +422,21 @@ static void test_persiststreaminit(void) todo_wine ok(stat.cbSize.QuadPart > 0, "Expected >0\n"); IStream_Release(stream); + str = SysAllocString(testW); + hr = IXMLDocument_get_root(doc, &element); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + hr = IXMLElement_put_text(element, str); + SysFreeString(str); + + hr = IPersistStreamInit_IsDirty(psi); + todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); + /* reset internal stream */ hr = IPersistStreamInit_InitNew(psi); - todo_wine ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = IPersistStreamInit_IsDirty(psi); + todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr); stream = NULL; hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); diff --git a/dlls/msxml3/xmldoc.c b/dlls/msxml3/xmldoc.c index 7f5e41dc3e6..2ca874b1845 100644 --- a/dlls/msxml3/xmldoc.c +++ b/dlls/msxml3/xmldoc.c @@ -670,8 +670,9 @@ static HRESULT WINAPI xmldoc_IPersistStreamInit_GetSizeMax( static HRESULT WINAPI xmldoc_IPersistStreamInit_InitNew( IPersistStreamInit *iface) { - FIXME("(%p): stub!\n", iface); - return E_NOTIMPL; + xmldoc *This = impl_from_IPersistStreamInit(iface); + TRACE("(%p)\n", This); + return S_OK; } static const IPersistStreamInitVtbl xmldoc_IPersistStreamInit_VTable = -- 2.11.4.GIT