qa: Added SwModelTestBase::getXPathContent
Equivalent to assertXPathContent but returning the string. Change-Id: I06ae4ba7c17db188af64d152b9c2807cc84535ce
This commit is contained in:
@@ -573,6 +573,20 @@ protected:
|
|||||||
return OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())));
|
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.
|
* Assert that rXPath exists, and returns exactly one node.
|
||||||
* In case rAttribute is provided, the rXPath's attribute's value must
|
* In case rAttribute is provided, the rXPath's attribute's value must
|
||||||
|
Reference in New Issue
Block a user