[Libreoffice-commits] core.git: include/test test/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 25 12:43:20 UTC 2019
include/test/xmltesttools.hxx | 12 +++++++-----
test/source/xmltesttools.cxx | 5 +++++
2 files changed, 12 insertions(+), 5 deletions(-)
New commits:
commit 3fef9fa3f5d260dd1264b67d8b42aad476332eea
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Apr 25 12:51:40 2019 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Apr 25 14:42:13 2019 +0200
assertXPath: disallow passing rAttribute without rExpectedValue
Change-Id: I7fb59039429361dad04fb68507f40545f9c4dd6d
Reviewed-on: https://gerrit.libreoffice.org/71290
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx
index 4f725f5948c5..c24a81eb65d6 100644
--- a/include/test/xmltesttools.hxx
+++ b/include/test/xmltesttools.hxx
@@ -61,12 +61,14 @@ protected:
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());
+ void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath);
+ /**
+ * Assert that rXPath exists, returns exactly one node, and the rXPath's attribute's value
+ * equals to the rExpected value.
+ */
+ void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute,
+ const OUString& rExpectedValue);
void assertXPathAttrs(xmlDocPtr pXmlDoc, const OString& rXPath,
const std::vector<std::pair<OString, OUString>>& aPairVector);
/**
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 123af01b28db..20149cc03c37 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -135,6 +135,11 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
CPPUNIT_FAIL("Invalid XPath type");
}
+void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath)
+{
+ getXPath(pXmlDoc, rXPath, ""); // it asserts that rXPath exists, and returns exactly one node
+}
+
void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue)
{
OUString aValue = getXPath(pXmlDoc, rXPath, rAttribute);
More information about the Libreoffice-commits
mailing list