[Libreoffice-commits] core.git: include/test test/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Apr 30 00:39:07 PDT 2014
include/test/xmltesttools.hxx | 26 ++++++++++++++++++++++++++
test/source/xmltesttools.cxx | 26 --------------------------
2 files changed, 26 insertions(+), 26 deletions(-)
New commits:
commit 76715b105fcfeffa140b03fb54d5c0846db1fba2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Apr 30 09:30:48 2014 +0200
test: move XmlTestTools API documentation to the header
Change-Id: Iae56b1fb68fde0cbc44f6b9e37ba1a66194b25e0
diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx
index a12d780..5a9cdb1 100644
--- a/include/test/xmltesttools.hxx
+++ b/include/test/xmltesttools.hxx
@@ -31,14 +31,40 @@ protected:
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx);
xmlNodeSetPtr getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath);
+ /**
+ * Same as the assertXPath(), but don't assert: return the string instead.
+ */
OUString getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute);
+ /**
+ * Same as the assertXPathContent(), but don't assert: return the string instead.
+ */
OUString getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath);
+ /**
+ * Get the position of the child named rName of the parent node specified by rXPath.
+ * Useful for checking relative order of elements.
+ */
int getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rChildName);
+ /**
+ * Assert that rXPath exists, and returns exactly one node.
+ * In case rAttribute is provided, the rXPath's attribute's value must
+ * equal to the rExpected value.
+ */
void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath,
const OString& rAttribute = OString(),
const OUString& rExpectedValue = OUString());
+ /**
+ * Assert that rXPath exists, and returns exactly nNumberOfNodes nodes.
+ * Useful for checking that we do _not_ export some node (nNumberOfNodes == 0).
+ */
void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfNodes);
+ /**
+ * Assert that rXPath exists, and its content equals rContent.
+ */
void assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rContent);
+ /**
+ * Assert that rXPath exists, and has exactly nNumberOfChildNodes child nodes.
+ * Useful for checking that we do have a no child nodes to a specific node (nNumberOfChildNodes == 0).
+ */
void assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfChildNodes);
};
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 9815351..e80674d 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -27,9 +27,6 @@ void XmlTestTools::registerNamespaces(xmlXPathContextPtr& /*pXmlXpathCtx*/)
{
}
-/**
- * Same as the assertXPath(), but don't assert: return the string instead.
- */
OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute)
{
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
@@ -41,9 +38,6 @@ OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const
return OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())));
}
-/**
- * Same as the assertXPathContent(), but don't assert: return the string instead.
- */
OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
{
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
@@ -55,11 +49,6 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
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
- * equal to the rExpected value.
- */
void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue)
{
OUString aValue = getXPath(pXmlDoc, rXPath, rAttribute);
@@ -67,10 +56,6 @@ void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const O
rExpectedValue, aValue);
}
-/**
- * Assert that rXPath exists, and returns exactly nNumberOfNodes nodes.
- * Useful for checking that we do _not_ export some node (nNumberOfNodes == 0).
- */
void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfNodes)
{
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
@@ -78,18 +63,11 @@ void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNu
nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes));
}
-/**
- * Assert that rXPath exists, and its content equals rContent.
- */
void XmlTestTools::assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rContent)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("XPath contents of child does not match", rContent, getXPathContent(pXmlDoc, rXPath));
}
-/**
- * Assert that rXPath exists, and has exactly nNumberOfChildNodes child nodes.
- * Useful for checking that we do have a no child nodes to a specific node (nNumberOfChildNodes == 0).
- */
void XmlTestTools::assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfChildNodes)
{
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
@@ -100,10 +78,6 @@ void XmlTestTools::assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath,
nNumberOfChildNodes, (int)xmlChildElementCount(pXmlNode));
}
-/**
- * Get the position of the child named rName of the parent node specified by rXPath.
- * Useful for checking relative order of elements.
- */
int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rChildName)
{
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
More information about the Libreoffice-commits
mailing list