Commit 5de86e12 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/writer: Close open tag on WriteProcessingInstruction().

parent cd55a674
......@@ -2131,6 +2131,30 @@ static void test_WriteWhitespace(void)
IXmlWriter_Release(writer);
}
static void test_WriteProcessingInstruction(void)
{
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
hr = IXmlWriter_WriteStartElement(writer, NULL, L"w", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteProcessingInstruction(writer, L"pi", L"content");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, "<w><?pi content?>");
IStream_Release(stream);
IXmlWriter_Release(writer);
}
START_TEST(writer)
{
test_writer_create();
......@@ -2154,4 +2178,5 @@ START_TEST(writer)
test_WriteString();
test_WriteDocType();
test_WriteWhitespace();
test_WriteProcessingInstruction();
}
......@@ -1500,6 +1500,8 @@ static HRESULT WINAPI xmlwriter_WriteProcessingInstruction(IXmlWriter *iface, LP
return WR_E_INVALIDACTION;
break;
case XmlWriterState_ElemStarted:
writer_close_starttag(This);
break;
case XmlWriterState_DocClosed:
return WR_E_INVALIDACTION;
default:
......
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