qa: Added SwModelTestBase::getXPathContent

Equivalent to assertXPathContent but returning the string.

Change-Id: I06ae4ba7c17db188af64d152b9c2807cc84535ce
This commit is contained in:
Jacobo Aragunde Pérez
2014-03-22 12:51:17 +01:00
parent 4e642a3f6b
commit d3e15e0cb1

View File

@@ -573,6 +573,20 @@ protected:
return OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())));
}
/**
* Same as the assertXPathContent(), but don't assert: return the string instead.
*/
OUString getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
{
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
CPPUNIT_ASSERT_MESSAGE(OString("XPath '" + rXPath + "' not found").getStr(),
xmlXPathNodeSetGetLength(pXmlNodes) > 0);
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
return OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
}
/**
* Assert that rXPath exists, and returns exactly one node.
* In case rAttribute is provided, the rXPath's attribute's value must