summaryrefslogtreecommitdiff
path: root/src/unittests/utils/xml.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-09-19 23:18:16 +0300
committerAndrei Karas <akaras@inbox.ru>2018-09-20 00:29:05 +0300
commit85ec852201fa91664a2345cb76aa2a4fadc2ba3a (patch)
tree56641c8fe62019964500d6f4bc0a296e5d28a070 /src/unittests/utils/xml.cc
parent0eba0cae49ae591ba52ccbbfe95e75c922673ee1 (diff)
downloadmanaplus-85ec852201fa91664a2345cb76aa2a4fadc2ba3a.tar.gz
manaplus-85ec852201fa91664a2345cb76aa2a4fadc2ba3a.tar.bz2
manaplus-85ec852201fa91664a2345cb76aa2a4fadc2ba3a.tar.xz
manaplus-85ec852201fa91664a2345cb76aa2a4fadc2ba3a.zip
Add test with loading xml file from disk.
Diffstat (limited to 'src/unittests/utils/xml.cc')
-rw-r--r--src/unittests/utils/xml.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/unittests/utils/xml.cc b/src/unittests/utils/xml.cc
index 76ddadcb9..4711873ce 100644
--- a/src/unittests/utils/xml.cc
+++ b/src/unittests/utils/xml.cc
@@ -155,6 +155,23 @@ TEST_CASE("xml doc", "")
REQUIRE(!strcmp(XmlChildContent(doc.rootNode()), "this is test"));
}
+ SECTION("load5")
+ {
+ XML::Document doc(pathJoin(VirtFs::getRealDir(
+ "test/serverlistplus.xml"), "test/serverlistplus.xml"),
+ UseVirtFs_false,
+ SkipError_false);
+ REQUIRE(doc.isLoaded() == true);
+ REQUIRE(doc.isValid() == true);
+ REQUIRE(doc.rootNode() != nullptr);
+ REQUIRE(xmlNameEqual(doc.rootNode(), "serverlist") == true);
+ REQUIRE(xmlNameEqual(doc.rootNode(), "serverlist123") == false);
+ REQUIRE(xmlTypeEqual(doc.rootNode(), XML_ELEMENT_NODE) == true);
+ REQUIRE(XmlHasProp(doc.rootNode(), "option1") == false);
+ REQUIRE(XmlHasProp(doc.rootNode(), "option123") == false);
+ REQUIRE(XmlHasProp(doc.rootNode(), "version") == true);
+ }
+
SECTION("properties")
{
XML::Document doc("graphics/gui/browserbox.xml",