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.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 20149cc03c37..3c186dd08d63 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -28,6 +28,11 @@ OUString convert(xmlChar const * string) {
return s;
}
+OString oconvert(xmlChar const * string)
+{
+ return reinterpret_cast<char const *>(string);
+}
+
}
XmlTestTools::XmlTestTools()
@@ -227,7 +232,7 @@ void XmlTestTools::assertXPathNoAttribute(xmlDocPtr pXmlDoc, const OString& rXPa
xmlXPathFreeObject(pXmlObj);
}
-int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rChildName)
+int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rChildName)
{
xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
@@ -236,13 +241,21 @@ int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, con
xmlXPathNodeSetGetLength(pXmlNodes));
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
int nRet = 0;
+ bool bFound = false;
for (xmlNodePtr pChild = pXmlNode->children; pChild; pChild = pChild->next)
{
- if (convert(pChild->name) == rChildName)
+ if (oconvert(pChild->name) == rChildName)
+ {
+ bFound = true;
break;
+ }
++nRet;
}
xmlXPathFreeObject(pXmlObj);
+ CPPUNIT_ASSERT_MESSAGE(OString("In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath
+ + "' child '" + rChildName + "' not found")
+ .getStr(),
+ bFound);
return nRet;
}