[PATCH 0/3] MR11222: msxml3/xpath: Fix comparison direction for node-set vs value case.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11222
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/msxml3/xpath.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dlls/msxml3/xpath.c b/dlls/msxml3/xpath.c index 3f4e2e44634..df397283e85 100644 --- a/dlls/msxml3/xpath.c +++ b/dlls/msxml3/xpath.c @@ -4773,7 +4773,6 @@ start: break; default: xpath_comp_op_eval(ctxt, op); - if (ctxt->error != XPATH_EXPRESSION_OK) if (ctxt->error != XPATH_EXPRESSION_OK) return -1; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11222
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/msxml3/tests/domdoc.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 037697d9a01..68def3e7083 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -5336,8 +5336,24 @@ static void test_query_result_(const struct query_test *test, IXMLDOMNodeList *l static void test_XPath(void) { + static const char node_value_cmp[] = + "<?xml version='1.0' encoding='utf-8'?>" + "<root>" + " <elem min=\"-1\" max=\"100\" />" + " <elem min=\"10\" max=\"20\" />" + " <elem min=\"0\" max=\"0\" />" + " <elem min=\"-10\" max=\"-10\" />" + "</root>"; + + static const struct query_test node_value_cmp_test[] = + { + { "//elem[@min <= 0 and @max >= 0]", "E1.E2.D1 E3.E2.D1", true }, + { "//elem[0 >= @min and 10 <= @max]", "E1.E2.D1" }, + { NULL }, + }; + const selection_ns_t *ptr = selection_ns_data; - const struct query_test *xptest = xpath_test; + const struct query_test *xptest; IXMLDOMNamedNodeMap *map; VARIANT var; VARIANT_BOOL b; @@ -5357,6 +5373,23 @@ static void test_XPath(void) if (!is_clsid_supported(&CLSID_DOMDocument2, &IID_IXMLDOMDocument2)) return; doc = create_document(&IID_IXMLDOMDocument2); + hr = IXMLDOMDocument2_loadXML(doc, _bstr_(node_value_cmp), NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_setProperty(doc, _bstr_("SelectionLanguage"), _variantbstr_("XPath")); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + for (xptest = node_value_cmp_test; xptest->query; xptest++) + { + winetest_push_context("Test %s", xptest->query); + + hr = IXMLDOMDocument2_selectNodes(doc, _bstr_(xptest->query), &list); + test_query_result(xptest, list, hr); + if (list) + IXMLDOMNodeList_Release(list); + + winetest_pop_context(); + } + hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szExampleXML), &b); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(b == VARIANT_TRUE, "failed to load XML string\n"); @@ -5383,7 +5416,7 @@ static void test_XPath(void) expect_list_and_release(list, "E2.D1"); /* perform xpath tests */ - for ( ; xptest->query ; xptest++ ) + for (xptest = xpath_test; xptest->query ; xptest++) { winetest_push_context("Test %s", xptest->query); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11222
From: Nikolay Sivov <nsivov@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59894 Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/msxml3/tests/domdoc.c | 2 +- dlls/msxml3/xpath.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 68def3e7083..77a36b6e4fe 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -5347,7 +5347,7 @@ static void test_XPath(void) static const struct query_test node_value_cmp_test[] = { - { "//elem[@min <= 0 and @max >= 0]", "E1.E2.D1 E3.E2.D1", true }, + { "//elem[@min <= 0 and @max >= 0]", "E1.E2.D1 E3.E2.D1" }, { "//elem[0 >= @min and 10 <= @max]", "E1.E2.D1" }, { NULL }, }; diff --git a/dlls/msxml3/xpath.c b/dlls/msxml3/xpath.c index df397283e85..b338dd4ef86 100644 --- a/dlls/msxml3/xpath.c +++ b/dlls/msxml3/xpath.c @@ -4398,7 +4398,7 @@ static bool xpath_compare_values(struct xpath_parser_context *ctxt, bool inf, bo else { if (arg1->type == _XPATH_NODESET) - ret = xpath_compare_nodeset_value(ctxt, !inf, strict, arg1, arg2); + ret = xpath_compare_nodeset_value(ctxt, inf, strict, arg1, arg2); else ret = xpath_compare_nodeset_value(ctxt, !inf, strict, arg2, arg1); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11222
participants (2)
-
Nikolay Sivov -
Nikolay Sivov (@nsivov)