Commit e3a6d593 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/writer: Fix WriteEndElement()/WriteFullEndElement() on ready state.

parent 6ca1ebdd
......@@ -91,13 +91,14 @@ todo_wine
hr = IXmlWriter_WriteEndElement(writer);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
todo_wine {
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);
......@@ -915,13 +916,25 @@ static void test_WriteRaw(void)
static void test_writer_state(void)
{
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* initial state */
check_writer_state(writer, E_UNEXPECTED);
/* set output and call 'wrong' method */
stream = writer_set_output(writer);
hr = IXmlWriter_WriteEndElement(writer);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream);
IXmlWriter_Release(writer);
}
......
......@@ -788,6 +788,10 @@ static HRESULT WINAPI xmlwriter_WriteEndElement(IXmlWriter *iface)
{
case XmlWriterState_Initial:
return E_UNEXPECTED;
case XmlWriterState_Ready:
case XmlWriterState_DocClosed:
This->state = XmlWriterState_DocClosed;
return WR_E_INVALIDACTION;
default:
;
}
......@@ -827,6 +831,18 @@ static HRESULT WINAPI xmlwriter_WriteFullEndElement(IXmlWriter *iface)
TRACE("%p\n", This);
switch (This->state)
{
case XmlWriterState_Initial:
return E_UNEXPECTED;
case XmlWriterState_Ready:
case XmlWriterState_DocClosed:
This->state = XmlWriterState_DocClosed;
return WR_E_INVALIDACTION;
default:
;
}
element = pop_element(This);
if (!element)
return WR_E_INVALIDACTION;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment