mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:18:16 +00:00
xmllite/writer: Enable some more tests for WriteNode().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
493db3b1f7
commit
2821d9cb41
|
@ -136,8 +136,12 @@ static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
|
|||
/* used to test all Write* methods for consistent error state */
|
||||
static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
|
||||
{
|
||||
IXmlReader *reader;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
/* FIXME: add WriteAttributes */
|
||||
|
||||
hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a");
|
||||
|
@ -179,8 +183,18 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
|
|||
hr = IXmlWriter_WriteNmToken(writer, L"a");
|
||||
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
|
||||
|
||||
/* FIXME: add WriteNode */
|
||||
/* FIXME: add WriteNodeShallow */
|
||||
hr = IXmlWriter_WriteNode(writer, NULL, FALSE);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
|
||||
|
||||
reader_set_input(reader, "<a/>");
|
||||
hr = IXmlWriter_WriteNode(writer, reader, FALSE);
|
||||
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
|
||||
|
||||
reader_set_input(reader, "<a/>");
|
||||
hr = IXmlReader_Read(reader, NULL);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
hr = IXmlWriter_WriteNodeShallow(writer, reader, FALSE);
|
||||
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
|
||||
|
||||
hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
|
||||
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
|
||||
|
@ -207,6 +221,8 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
|
|||
|
||||
hr = IXmlWriter_WriteWhitespace(writer, L" ");
|
||||
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
|
||||
|
||||
IXmlReader_Release(reader);
|
||||
}
|
||||
|
||||
static IStream *writer_set_output(IXmlWriter *writer)
|
||||
|
@ -354,8 +370,12 @@ static void test_writer_create(void)
|
|||
|
||||
static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
|
||||
{
|
||||
IXmlReader *reader;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IXmlWriter_SetOutput(writer, output);
|
||||
ok(hr == S_OK, "Failed to set output, hr %#lx.\n", hr);
|
||||
|
||||
|
@ -400,8 +420,12 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
|
|||
hr = IXmlWriter_WriteNmToken(writer, L"a");
|
||||
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
/* TODO: WriteNode */
|
||||
/* TODO: WriteNodeShallow */
|
||||
reader_set_input(reader, "<a/>");
|
||||
hr = IXmlWriter_WriteNode(writer, reader, FALSE);
|
||||
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IXmlWriter_WriteNodeShallow(writer, reader, FALSE);
|
||||
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
|
||||
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
|
||||
|
@ -431,6 +455,8 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
|
|||
|
||||
hr = IXmlWriter_Flush(writer);
|
||||
ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
|
||||
|
||||
IXmlReader_Release(reader);
|
||||
}
|
||||
|
||||
static void test_writeroutput(void)
|
||||
|
@ -2295,6 +2321,9 @@ static void test_WriteNode(void)
|
|||
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IXmlWriter_WriteNode(writer, NULL, FALSE);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
|
@ -2445,6 +2474,9 @@ static void test_WriteNodeShallow(void)
|
|||
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IXmlWriter_WriteNodeShallow(writer, NULL, FALSE);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
|
|
|
@ -1600,6 +1600,9 @@ static HRESULT WINAPI xmlwriter_WriteNode(IXmlWriter *iface, IXmlReader *reader,
|
|||
|
||||
TRACE("%p, %p, %d.\n", iface, reader, write_default_attributes);
|
||||
|
||||
if (!reader)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (SUCCEEDED(hr = writer_write_node(iface, reader, FALSE, write_default_attributes)))
|
||||
hr = IXmlReader_Read(reader, NULL);
|
||||
|
||||
|
@ -1610,6 +1613,9 @@ static HRESULT WINAPI xmlwriter_WriteNodeShallow(IXmlWriter *iface, IXmlReader *
|
|||
{
|
||||
TRACE("%p, %p, %d.\n", iface, reader, write_default_attributes);
|
||||
|
||||
if (!reader)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return writer_write_node(iface, reader, TRUE, write_default_attributes);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue