mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 06:01:17 +00:00
xmllite/writer: Fix a bunch of Write* methods to set closed state.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d9f6f7215
commit
1cb6fa5e84
|
@ -918,23 +918,76 @@ static void test_writer_state(void)
|
|||
/* initial state */
|
||||
check_writer_state(writer, E_UNEXPECTED);
|
||||
|
||||
/* set output and call 'wrong' method */
|
||||
/* set output and call 'wrong' method, WriteEndElement */
|
||||
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);
|
||||
|
||||
/* WriteAttributeString */
|
||||
stream = writer_set_output(writer);
|
||||
|
||||
hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
|
||||
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
|
||||
|
||||
check_writer_state(writer, WR_E_INVALIDACTION);
|
||||
IStream_Release(stream);
|
||||
|
||||
/* WriteEndDocument */
|
||||
stream = writer_set_output(writer);
|
||||
|
||||
hr = IXmlWriter_WriteEndDocument(writer);
|
||||
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
|
||||
|
||||
check_writer_state(writer, WR_E_INVALIDACTION);
|
||||
IStream_Release(stream);
|
||||
|
||||
/* WriteFullEndElement */
|
||||
stream = writer_set_output(writer);
|
||||
|
||||
hr = IXmlWriter_WriteFullEndElement(writer);
|
||||
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
|
||||
|
||||
check_writer_state(writer, WR_E_INVALIDACTION);
|
||||
IStream_Release(stream);
|
||||
|
||||
/* WriteCData */
|
||||
stream = writer_set_output(writer);
|
||||
|
||||
hr = IXmlWriter_WriteCData(writer, aW);
|
||||
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
|
||||
|
||||
check_writer_state(writer, WR_E_INVALIDACTION);
|
||||
IStream_Release(stream);
|
||||
|
||||
/* WriteName */
|
||||
stream = writer_set_output(writer);
|
||||
|
||||
hr = IXmlWriter_WriteName(writer, aW);
|
||||
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
|
||||
|
||||
check_writer_state(writer, WR_E_INVALIDACTION);
|
||||
IStream_Release(stream);
|
||||
|
||||
/* WriteNmToken */
|
||||
stream = writer_set_output(writer);
|
||||
|
||||
hr = IXmlWriter_WriteNmToken(writer, aW);
|
||||
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
|
||||
|
||||
check_writer_state(writer, WR_E_INVALIDACTION);
|
||||
IStream_Release(stream);
|
||||
|
||||
/* WriteString */
|
||||
stream = writer_set_output(writer);
|
||||
|
||||
hr = IXmlWriter_WriteString(writer, aW);
|
||||
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
|
||||
|
||||
check_writer_state(writer, WR_E_INVALIDACTION);
|
||||
IStream_Release(stream);
|
||||
|
||||
IXmlWriter_Release(writer);
|
||||
|
|
|
@ -626,7 +626,9 @@ static HRESULT WINAPI xmlwriter_WriteCData(IXmlWriter *iface, LPCWSTR data)
|
|||
case XmlWriterState_ElemStarted:
|
||||
writer_close_starttag(This);
|
||||
break;
|
||||
case XmlWriterState_Ready:
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
;
|
||||
|
@ -912,7 +914,9 @@ static HRESULT WINAPI xmlwriter_WriteName(IXmlWriter *iface, LPCWSTR pwszName)
|
|||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_Ready:
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
;
|
||||
|
@ -931,7 +935,9 @@ static HRESULT WINAPI xmlwriter_WriteNmToken(IXmlWriter *iface, LPCWSTR pwszNmTo
|
|||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_Ready:
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
;
|
||||
|
@ -1136,7 +1142,9 @@ static HRESULT WINAPI xmlwriter_WriteString(IXmlWriter *iface, LPCWSTR pwszText)
|
|||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_Ready:
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
;
|
||||
|
|
Loading…
Reference in a new issue