Nikolay Sivov : xmllite/writer: Handle initial and ready states in the rest of tested Write* methods.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 24 11:04:00 CDT 2016


Module: wine
Branch: master
Commit: e89c2df7c5b28e475dcdd6ab3afe480be451f411
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e89c2df7c5b28e475dcdd6ab3afe480be451f411

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Mar 24 10:41:23 2016 +0300

xmllite/writer: Handle initial and ready states in the rest of tested Write* methods.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/xmllite/tests/writer.c | 10 +----
 dlls/xmllite/writer.c       | 97 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 96 insertions(+), 11 deletions(-)

diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c
index ce4e13d..81945d1 100644
--- a/dlls/xmllite/tests/writer.c
+++ b/dlls/xmllite/tests/writer.c
@@ -63,18 +63,15 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
     /* FIXME: add WriteAttributes */
 
     hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
-todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteCData(writer, aW);
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteCharEntity(writer, aW[0]);
-todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteChars(writer, aW, 1);
-todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteComment(writer, aW);
@@ -92,19 +89,17 @@ todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteEntityRef(writer, aW);
-todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteFullEndElement(writer);
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
-todo_wine {
     hr = IXmlWriter_WriteName(writer, aW);
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteNmToken(writer, aW);
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
-}
+
     /* FIXME: add WriteNode */
     /* FIXME: add WriteNodeShallow */
 
@@ -112,14 +107,12 @@ todo_wine {
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
-todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteRaw(writer, aW);
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteRawChars(writer, aW, 1);
-todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
@@ -129,7 +122,6 @@ todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteString(writer, aW);
-todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     /* FIXME: add WriteSurrogateCharEntity */
diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c
index 6aa851f..7895fb0 100644
--- a/dlls/xmllite/writer.c
+++ b/dlls/xmllite/writer.c
@@ -587,6 +587,16 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
     FIXME("%p %s %s %s %s\n", This, wine_dbgstr_w(pwszPrefix), wine_dbgstr_w(pwszLocalName),
                         wine_dbgstr_w(pwszNamespaceUri), wine_dbgstr_w(pwszValue));
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
@@ -644,8 +654,22 @@ static HRESULT WINAPI xmlwriter_WriteCData(IXmlWriter *iface, LPCWSTR data)
     return S_OK;
 }
 
-static HRESULT WINAPI xmlwriter_WriteCharEntity(IXmlWriter *iface, WCHAR wch)
+static HRESULT WINAPI xmlwriter_WriteCharEntity(IXmlWriter *iface, WCHAR ch)
 {
+    xmlwriter *This = impl_from_IXmlWriter(iface);
+
+    FIXME("%p %x\n", This, ch);
+
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
@@ -655,6 +679,16 @@ static HRESULT WINAPI xmlwriter_WriteChars(IXmlWriter *iface, const WCHAR *pwch,
 
     FIXME("%p %s %d\n", This, wine_dbgstr_w(pwch), cwch);
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
@@ -821,6 +855,16 @@ static HRESULT WINAPI xmlwriter_WriteEntityRef(IXmlWriter *iface, LPCWSTR pwszNa
 
     FIXME("%p %s\n", This, wine_dbgstr_w(pwszName));
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
@@ -862,6 +906,16 @@ static HRESULT WINAPI xmlwriter_WriteName(IXmlWriter *iface, LPCWSTR pwszName)
 
     FIXME("%p %s\n", This, wine_dbgstr_w(pwszName));
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
@@ -871,6 +925,16 @@ static HRESULT WINAPI xmlwriter_WriteNmToken(IXmlWriter *iface, LPCWSTR pwszNmTo
 
     FIXME("%p %s\n", This, wine_dbgstr_w(pwszNmToken));
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
@@ -938,6 +1002,16 @@ static HRESULT WINAPI xmlwriter_WriteQualifiedName(IXmlWriter *iface, LPCWSTR pw
 
     FIXME("%p %s %s\n", This, wine_dbgstr_w(pwszLocalName), wine_dbgstr_w(pwszNamespaceUri));
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
@@ -975,10 +1049,19 @@ static HRESULT WINAPI xmlwriter_WriteRawChars(IXmlWriter *iface,  const WCHAR *p
 
     FIXME("%p %s %d\n", This, wine_dbgstr_w(pwch), cwch);
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 
-
 static HRESULT WINAPI xmlwriter_WriteStartDocument(IXmlWriter *iface, XmlStandalone standalone)
 {
     xmlwriter *This = impl_from_IXmlWriter(iface);
@@ -1047,6 +1130,16 @@ static HRESULT WINAPI xmlwriter_WriteString(IXmlWriter *iface, LPCWSTR pwszText)
 
     FIXME("%p %s\n", This, wine_dbgstr_w(pwszText));
 
+    switch (This->state)
+    {
+    case XmlWriterState_Initial:
+        return E_UNEXPECTED;
+    case XmlWriterState_DocClosed:
+        return WR_E_INVALIDACTION;
+    default:
+        ;
+    }
+
     return E_NOTIMPL;
 }
 




More information about the wine-cvs mailing list