Kaydet (Commit) d3e15e0c authored tarafından Jacobo Aragunde Pérez's avatar Jacobo Aragunde Pérez

qa: Added SwModelTestBase::getXPathContent

Equivalent to assertXPathContent but returning the string.

Change-Id: I06ae4ba7c17db188af64d152b9c2807cc84535ce
üst 4e642a3f
...@@ -573,6 +573,20 @@ protected: ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment