Commit bbfa8d17 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

msxml3/tests: Add some tests for IVBSAXContentHandler::startElement() and…

msxml3/tests: Add some tests for IVBSAXContentHandler::startElement() and IVBSAXContentHandler::endElement(). These are mostly a copy of ISAXContentHandler::startElement() and ISAXContentHandler::endElement() tests. Signed-off-by: 's avatarDmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 036f1f3b
......@@ -3824,8 +3824,10 @@ static void test_mxwriter_startendelement_batch2(const struct writer_startendele
static void test_mxwriter_startendelement(void)
{
ISAXContentHandler *content;
IVBSAXContentHandler *vb_content;
IMXWriter *writer;
VARIANT dest;
BSTR bstr_null = NULL, bstr_empty, bstr_a, bstr_b, bstr_ab;
HRESULT hr;
test_mxwriter_startendelement_batch(writer_startendelement);
......@@ -3835,12 +3837,93 @@ static void test_mxwriter_startendelement(void)
&IID_IMXWriter, (void**)&writer);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
ok(hr == S_OK, "got %08x\n", hr);
hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXContentHandler, (void**)&vb_content);
ok(hr == S_OK, "got %08x\n", hr);
hr = IVBSAXContentHandler_startDocument(vb_content);
ok(hr == S_OK, "got %08x\n", hr);
bstr_empty = SysAllocString(L"");
bstr_a = SysAllocString(L"a");
bstr_b = SysAllocString(L"b");
bstr_ab = SysAllocString(L"a:b");
hr = IVBSAXContentHandler_startElement(vb_content, &bstr_null, &bstr_empty, &bstr_b, NULL);
todo_wine
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IVBSAXContentHandler_startElement(vb_content, &bstr_empty, &bstr_b, &bstr_empty, NULL);
ok(hr == S_OK, "got %08x\n", hr);
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_get_output(writer, &dest);
ok(hr == S_OK, "got %08x\n", hr);
ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
todo_wine
ok(!lstrcmpW(L"<>", V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
hr = IVBSAXContentHandler_startElement(vb_content, &bstr_empty, &bstr_empty, &bstr_b, NULL);
ok(hr == S_OK, "got %08x\n", hr);
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_get_output(writer, &dest);
ok(hr == S_OK, "got %08x\n", hr);
ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
todo_wine
ok(!lstrcmpW(L"<><b>", V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
hr = IVBSAXContentHandler_endElement(vb_content, &bstr_null, &bstr_null, &bstr_b);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IVBSAXContentHandler_endElement(vb_content, &bstr_null, &bstr_a, &bstr_b);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IVBSAXContentHandler_endElement(vb_content, &bstr_a, &bstr_b, &bstr_null);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IVBSAXContentHandler_endElement(vb_content, &bstr_empty, &bstr_null, &bstr_b);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IVBSAXContentHandler_endElement(vb_content, &bstr_empty, &bstr_b, &bstr_null);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IVBSAXContentHandler_endElement(vb_content, &bstr_empty, &bstr_empty, &bstr_b);
ok(hr == S_OK, "got %08x\n", hr);
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_get_output(writer, &dest);
ok(hr == S_OK, "got %08x\n", hr);
ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
todo_wine
ok(!lstrcmpW(L"<><b></b>", V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
SysFreeString(bstr_empty);
SysFreeString(bstr_a);
SysFreeString(bstr_b);
SysFreeString(bstr_ab);
hr = IVBSAXContentHandler_endDocument(vb_content);
ok(hr == S_OK, "got %08x\n", hr);
IVBSAXContentHandler_Release(vb_content);
IMXWriter_Release(writer);
hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
&IID_IMXWriter, (void**)&writer);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
ok(hr == S_OK, "got %08x\n", hr);
hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_startDocument(content);
ok(hr == S_OK, "got %08x\n", hr);
......
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