Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/msxml3/tests/domdoc.c | 80 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+)
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index c4337ab191..eee29add38 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -12998,6 +12998,85 @@ static void test_namespaces_as_attributes(void) free_bstrs(); }
+static const char ticket[] = +"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +"<psf:PrintTicket xmlns:psf="http://a%5C" xmlns:xsi="http://b%5C" xmlns:xsd="http://c%5C" xmlns:psk="http://d%5C%22%3E" +" <psf:Feature name="psk:PageMediaSize">" +" <psf:Option name="psk:ISOA4">" +" <psf:ScoredProperty name="psk:MediaSizeWidth">" +" <psf:Value xsi:type="xsd:integer">210000</psf:Value>" +" </psf:ScoredProperty>" +" <psf:ScoredProperty name="psk:MediaSizeHeight">" +" <psf:Value xsi:type="xsd:integer">297000</psf:Value>" +" </psf:ScoredProperty>" +" </psf:Option>" +" </psf:Feature>" +"</psf:PrintTicket>"; + +static void test_selectSingleNode_ns(void) +{ + IXMLDOMDocument *doc; + IXMLDOMNode *node, *option, *child, *val; + VARIANT_BOOL b; + VARIANT var; + HRESULT hr; + + doc = create_document(&IID_IXMLDOMDocument); + + b = VARIANT_FALSE; + hr = IXMLDOMDocument_loadXML(doc, _bstr_(ticket), &b); + ok(hr == S_OK, "got %#x\n", hr ); + ok(b == VARIANT_TRUE, "got %d\n", b); + + hr = IXMLDOMDocument_selectSingleNode(doc, _bstr_("psf:PrintTicket/psf:Feature[@name='psk:PageMediaSize']"), &node); + ok(hr == S_OK, "got %#x\n", hr ); + + hr = IXMLDOMNode_selectSingleNode(node, _bstr_("./psf:Option"), &option); + ok(hr == S_OK, "got %#x\n", hr ); + + hr = IXMLDOMNode_selectSingleNode(option, _bstr_("./psf:ScoredProperty[@name='psk:MediaSizeWidth']"), &child); + ok(hr == S_OK, "got %#x\n", hr ); + + hr = IXMLDOMNode_selectSingleNode(child, _bstr_("./psf:Value[@xsi:type='xsd:integer']"), &val); +todo_wine + ok(hr == S_OK, "got %#x\n", hr ); + if (hr == S_OK) + { + VariantInit(&var); + hr = IXMLDOMNode_get_nodeTypedValue(val, &var); + ok(hr == S_OK, "got %#x\n", hr ); + ok(V_VT(&var) == VT_BSTR, "got %d\n", V_VT(&var)); + ok(!wcscmp(V_BSTR(&var), L"210000"), "got %s\n", wine_dbgstr_w(V_BSTR(&var))); + VariantClear(&var); + + IXMLDOMNode_Release(val); + } + IXMLDOMNode_Release(child); + + hr = IXMLDOMNode_selectSingleNode(option, _bstr_("./psf:ScoredProperty[@name='psk:MediaSizeHeight']"), &child); + ok(hr == S_OK, "got %#x\n", hr ); + + hr = IXMLDOMNode_selectSingleNode(child, _bstr_("./psf:Value[@xsi:type='xsd:integer']"), &val); +todo_wine + ok(hr == S_OK, "got %#x\n", hr ); + if (hr == S_OK) + { + VariantInit(&var); + hr = IXMLDOMNode_get_nodeTypedValue(val, &var); + ok(hr == S_OK, "got %#x\n", hr ); + ok(V_VT(&var) == VT_BSTR, "got %d\n", V_VT(&var)); + ok(!wcscmp(V_BSTR(&var), L"297000"), "got %s\n", wine_dbgstr_w(V_BSTR(&var))); + VariantClear(&var); + + IXMLDOMNode_Release(val); + } + IXMLDOMNode_Release(child); + + IXMLDOMNode_Release(option); + IXMLDOMNode_Release(node); + IXMLDOMDocument_Release(doc); +} + START_TEST(domdoc) { HRESULT hr; @@ -13014,6 +13093,7 @@ START_TEST(domdoc) return; }
+ test_selectSingleNode_ns(); test_domdoc(); test_persiststream(); test_domnode();
Please use existing function for this.
Nikolay Sivov nsivov@codeweavers.com wrote:
Please use existing function for this.
I considered that, however existing test_selectSingleNode() is cluttered by failure cases, and finally doesn't test anything useful. Using it as a place for new tests would add even more mess. I'd prefer to make new tests for multiple namespaces a separate test, which could be extended with new tests if needed.
On 10/9/19 11:18 AM, Dmitry Timoshkov wrote:
Nikolay Sivov nsivov@codeweavers.com wrote:
Please use existing function for this.
I considered that, however existing test_selectSingleNode() is cluttered by failure cases, and finally doesn't test anything useful. Using it as a place for new tests would add even more mess. I'd prefer to make new tests for multiple namespaces a separate test, which could be extended with new tests if needed.
Just append it there, and remove whatever you think is broken with existing tests. Having separate functions for every occasion is worse.
Nikolay Sivov nsivov@codeweavers.com wrote:
Please use existing function for this.
I considered that, however existing test_selectSingleNode() is cluttered by failure cases, and finally doesn't test anything useful. Using it as a place for new tests would add even more mess. I'd prefer to make new tests for multiple namespaces a separate test, which could be extended with new tests if needed.
Just append it there, and remove whatever you think is broken with existing tests. Having separate functions for every occasion is worse.
There's nothing broken in exising tests, they are just a cluttered mess. Adding new tests to the end of a mess is not very nice IMO. What's wrong with having separate bodies for very different tests?