From 1d816be12e48e8c5cf7adca2194f946ff55346d3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 30 Apr 2011 15:36:37 +0400 Subject: [PATCH] msxml3: Add support for standalone property. --- dlls/msxml3/mxwriter.c | 21 ++++++++++++++++---- dlls/msxml3/tests/saxreader.c | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c index 6cebf765f32..fed2fda7494 100644 --- a/dlls/msxml3/mxwriter.c +++ b/dlls/msxml3/mxwriter.c @@ -44,6 +44,8 @@ typedef struct _mxwriter ISAXContentHandler ISAXContentHandler_iface; LONG ref; + + VARIANT_BOOL standalone; } mxwriter; static inline mxwriter *impl_from_IMXWriter(IMXWriter *iface) @@ -237,15 +239,24 @@ static HRESULT WINAPI mxwriter_get_indent(IMXWriter *iface, VARIANT_BOOL *indent static HRESULT WINAPI mxwriter_put_standalone(IMXWriter *iface, VARIANT_BOOL value) { mxwriter *This = impl_from_IMXWriter( iface ); - FIXME("(%p)->(%d)\n", This, value); - return E_NOTIMPL; + + TRACE("(%p)->(%d)\n", This, value); + This->standalone = value; + + return S_OK; } static HRESULT WINAPI mxwriter_get_standalone(IMXWriter *iface, VARIANT_BOOL *value) { mxwriter *This = impl_from_IMXWriter( iface ); - FIXME("(%p)->(%p)\n", This, value); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, value); + + if (!value) return E_POINTER; + + *value = This->standalone; + + return S_OK; } static HRESULT WINAPI mxwriter_put_omitXMLDeclaration(IMXWriter *iface, VARIANT_BOOL value) @@ -499,6 +510,8 @@ HRESULT MXWriter_create(IUnknown *pUnkOuter, void **ppObj) This->ISAXContentHandler_iface.lpVtbl = &mxwriter_saxcontent_vtbl; This->ref = 1; + This->standalone = VARIANT_FALSE; + *ppObj = &This->IMXWriter_iface; TRACE("returning iface %p\n", *ppObj); diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index f6c35b8b8d1..784b37a6245 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -694,6 +694,41 @@ static void test_mxwriter_contenthandler(void) IMXWriter_Release(writer); } +static void test_mxwriter_properties(void) +{ + IMXWriter *writer; + VARIANT_BOOL b; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER, + &IID_IMXWriter, (void**)&writer); + if (hr != S_OK) + { + win_skip("MXXMLWriter not supported\n"); + return; + } + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = IMXWriter_get_standalone(writer, NULL); + ok(hr == E_POINTER, "got %08x\n", hr); + + b = VARIANT_TRUE; + hr = IMXWriter_get_standalone(writer, &b); + ok(hr == S_OK, "got %08x\n", hr); + ok(b == VARIANT_FALSE, "got %d\n", b); + + /* set and check */ + hr = IMXWriter_put_standalone(writer, VARIANT_TRUE); + ok(hr == S_OK, "got %08x\n", hr); + + b = VARIANT_FALSE; + hr = IMXWriter_get_standalone(writer, &b); + ok(hr == S_OK, "got %08x\n", hr); + ok(b == VARIANT_TRUE, "got %d\n", b); + + IMXWriter_Release(writer); +} + START_TEST(saxreader) { ISAXXMLReader *reader; @@ -716,6 +751,7 @@ START_TEST(saxreader) test_saxreader(); test_encoding(); test_mxwriter_contenthandler(); + test_mxwriter_properties(); CoUninitialize(); }