summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-05-01 09:17:14 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-05-01 12:30:22 +0200
commitd822953cbc1d8814ac9f9eac2107177d37103542 (patch)
treebfe57eba2ec0e1dbb816d3ce5972298d65780b3d /include
parent54fa7c42d4b0907a0aba820ce167b8929c0f0246 (diff)
Make getXPathPosition assert on requested child found
Previously, for an XML like this: <sharedItems> <d v="2017-07-10T09:11:02"/> <d v="2017-07-10T09:11:03"/> <m/> </sharedItems> the call like int pos = getXPathPosition(pDoc, "/x:sharedItems", "absent"); gave 3. That could result in mistakes, when a test would assert on position "3" for a child element which name is mistyped. I made such a mistake when creating a unit test trying to assert on a position of the last element, and writing its name as "x:m", like in rXPath itself; the return was 3, and I initially wrongly assumed that the return is 1-based (like in xpath bracketed expressions). rChildName made const OString&, for consistency with rXPath, or with rAttribute in getXPath: child name is just a part of a longer xpath. Change-Id: I7ba9c4466c75b1b10fce1ccf26ef3b56b4e11e87 Reviewed-on: https://gerrit.libreoffice.org/71614 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/test/xmltesttools.hxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx
index c24a81eb65d6..f8f10da387bd 100644
--- a/include/test/xmltesttools.hxx
+++ b/include/test/xmltesttools.hxx
@@ -58,7 +58,7 @@ protected:
* Get the position of the child named rName of the parent node specified by rXPath.
* Useful for checking relative order of elements.
*/
- int getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rChildName);
+ int getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rChildName);
/**
* Assert that rXPath exists, and returns exactly one node.
*/