summaryrefslogtreecommitdiff
path: root/test/source/xmltesttools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'test/source/xmltesttools.cxx')
-rw-r--r--test/source/xmltesttools.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index a79b039332dd..26973b440c61 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -183,13 +183,19 @@ void XmlTestTools::assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const OStrin
}
}
-void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes)
+int XmlTestTools::countXPathNodes(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath)
{
xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
- CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
- nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes));
+ const int n = xmlXPathNodeSetGetLength(pXmlNodes);
xmlXPathFreeObject(pXmlObj);
+ return n;
+}
+
+void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes)
+{
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
+ nNumberOfNodes, countXPathNodes(pXmlDoc, rXPath));
}
void XmlTestTools::assertXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OUString& rContent)