summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-09-30 11:48:59 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-09-30 12:07:32 +0200
commit548b360c0e4693aac0cbdd2fcc1aab433fc54010 (patch)
treeb1c0931208a55b870cfd5f160c2a91258431507e /test
parenta87d0bc0f5ace66c5d0d71f310f99ba9dbebc543 (diff)
Factor out duplicated code to XmlTestTools::assertXPathNoAttribute()
Change-Id: I1eb3778e6bcdd8c44ffb9a7548add109331fc83b
Diffstat (limited to 'test')
-rw-r--r--test/source/xmltesttools.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 5ba9162dcac1..32908a068699 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -114,6 +114,18 @@ void XmlTestTools::assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath,
#endif
}
+void XmlTestTools::assertXPathNoAttribute(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute)
+{
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
+ 1, xmlXPathNodeSetGetLength(pXmlNodes));
+ xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath + "' unexpected '" + rAttribute + "' attribute").getStr(),
+ static_cast<xmlChar*>(0), xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())));
+ xmlXPathFreeObject(pXmlObj);
+}
+
int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rChildName)
{
xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);