summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-01 04:50:26 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-01 04:50:26 +0300
commit7df01a8695e46e7e8cce603782f0e16caf54169b (patch)
tree030a0125429c9605c24ad74e3d523fd900f155cd /src/utils
parent0f172abb004bed203f8bf329e4f43eb174a8a58c (diff)
downloadplus-7df01a8695e46e7e8cce603782f0e16caf54169b.tar.gz
plus-7df01a8695e46e7e8cce603782f0e16caf54169b.tar.bz2
plus-7df01a8695e46e7e8cce603782f0e16caf54169b.tar.xz
plus-7df01a8695e46e7e8cce603782f0e16caf54169b.zip
Fix tests running without physfs.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/chatutils_unittest.cc2
-rw-r--r--src/utils/stringutils_unittest.cc6
-rw-r--r--src/utils/translation/poparser_unittest.cc2
-rw-r--r--src/utils/xml_unittest.cc3
-rw-r--r--src/utils/xmlutils_unittest.cc25
5 files changed, 28 insertions, 10 deletions
diff --git a/src/utils/chatutils_unittest.cc b/src/utils/chatutils_unittest.cc
index fc9677c30..421798227 100644
--- a/src/utils/chatutils_unittest.cc
+++ b/src/utils/chatutils_unittest.cc
@@ -238,6 +238,8 @@ TEST_CASE("chatutils replaceVars")
delete2(actorManager);
delete2(localPlayer);
delete2(client);
+ VirtFs::removeDirFromSearchPath("data");
+ VirtFs::removeDirFromSearchPath("../data");
delete2(logger);
// VirtFs::deinit();
}
diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc
index 82a15fdff..b0fdbf0de 100644
--- a/src/utils/stringutils_unittest.cc
+++ b/src/utils/stringutils_unittest.cc
@@ -1615,9 +1615,13 @@ TEST_CASE("stringuntils replaceItemLinks")
REQUIRE(str == "[[test name 1 ,test name2[] test name 1]");
}
ResourceManager::deleteInstance();
- delete2(logger);
delete_all(infos);
infos.clear();
namedInfos.clear();
+ VirtFs::removeDirFromSearchPath("data");
+ VirtFs::removeDirFromSearchPath("../data");
+ VirtFs::removeDirFromSearchPath("data/test");
+ VirtFs::removeDirFromSearchPath("../data/test");
+ delete2(logger);
// VirtFs::deinit();
}
diff --git a/src/utils/translation/poparser_unittest.cc b/src/utils/translation/poparser_unittest.cc
index f8f536f88..9182bebbc 100644
--- a/src/utils/translation/poparser_unittest.cc
+++ b/src/utils/translation/poparser_unittest.cc
@@ -123,6 +123,8 @@ TEST_CASE("PoParser tests", "PoParser")
delete dict;
}
delete2(client);
+ VirtFs::removeDirFromSearchPath("data");
+ VirtFs::removeDirFromSearchPath("../data");
delete2(logger);
// VirtFs::deinit();
}
diff --git a/src/utils/xml_unittest.cc b/src/utils/xml_unittest.cc
index fc40f4439..f5211bcb5 100644
--- a/src/utils/xml_unittest.cc
+++ b/src/utils/xml_unittest.cc
@@ -359,6 +359,9 @@ TEST_CASE("xml doc")
}
delete2(theme);
delete2(client);
+ VirtFs::removeDirFromSearchPath("data");
+ VirtFs::removeDirFromSearchPath("../data");
+
delete2(logger);
// VirtFs::deinit();
}
diff --git a/src/utils/xmlutils_unittest.cc b/src/utils/xmlutils_unittest.cc
index b3b9cba81..dff0b130c 100644
--- a/src/utils/xmlutils_unittest.cc
+++ b/src/utils/xmlutils_unittest.cc
@@ -45,6 +45,8 @@ TEST_CASE("xmlutils readXmlIntVector 1")
XML::initXML();
logger = new Logger();
ResourceManager::init();
+ VirtFs::addDirToSearchPath("data", Append_false);
+ VirtFs::addDirToSearchPath("../data", Append_false);
mainGraphics = new SDLGraphics;
imageHelper = new SDLImageHelper();
@@ -59,9 +61,6 @@ TEST_CASE("xmlutils readXmlIntVector 1")
ActorSprite::load();
- VirtFs::addDirToSearchPath("data", Append_false);
- VirtFs::addDirToSearchPath("../data", Append_false);
-
std::vector<int> arr;
readXmlIntVector("graphics/gui/browserbox.xml",
@@ -80,6 +79,8 @@ TEST_CASE("xmlutils readXmlIntVector 1")
REQUIRE(1 == arr[4]);
delete2(client);
ResourceManager::deleteInstance();
+ VirtFs::removeDirFromSearchPath("data");
+ VirtFs::removeDirFromSearchPath("../data");
delete2(logger);
// VirtFs::deinit();
}
@@ -91,6 +92,8 @@ TEST_CASE("xmlutils readXmlStringMap 1")
XML::initXML();
logger = new Logger();
ResourceManager::init();
+ VirtFs::addDirToSearchPath("data", Append_false);
+ VirtFs::addDirToSearchPath("../data", Append_false);
mainGraphics = new SDLGraphics;
imageHelper = new SDLImageHelper();
@@ -105,9 +108,6 @@ TEST_CASE("xmlutils readXmlStringMap 1")
ActorSprite::load();
- VirtFs::addDirToSearchPath("data", Append_false);
- VirtFs::addDirToSearchPath("../data", Append_false);
-
std::map<std::string, std::string> arr;
readXmlStringMap("graphics/sprites/manaplus_emotes.xml",
@@ -125,6 +125,8 @@ TEST_CASE("xmlutils readXmlStringMap 1")
REQUIRE(arr["Metal"] == "26");
delete2(client);
ResourceManager::deleteInstance();
+ VirtFs::removeDirFromSearchPath("data");
+ VirtFs::removeDirFromSearchPath("../data");
delete2(logger);
// VirtFs::deinit();
}
@@ -136,6 +138,10 @@ TEST_CASE("xmlutils readXmlIntMap 1")
XML::initXML();
logger = new Logger();
ResourceManager::init();
+ VirtFs::addDirToSearchPath("data", Append_false);
+ VirtFs::addDirToSearchPath("../data", Append_false);
+ VirtFs::addDirToSearchPath("data/test", Append_false);
+ VirtFs::addDirToSearchPath("../data/test", Append_false);
mainGraphics = new SDLGraphics;
imageHelper = new SDLImageHelper();
@@ -150,9 +156,6 @@ TEST_CASE("xmlutils readXmlIntMap 1")
ActorSprite::load();
- VirtFs::addDirToSearchPath("data/test", Append_false);
- VirtFs::addDirToSearchPath("../data/test", Append_false);
-
std::map<int32_t, int32_t> arr;
readXmlIntMap("testintmap.xml",
@@ -170,6 +173,10 @@ TEST_CASE("xmlutils readXmlIntMap 1")
REQUIRE(arr[3] == 0);
delete2(client);
ResourceManager::deleteInstance();
+ VirtFs::removeDirFromSearchPath("data/test");
+ VirtFs::removeDirFromSearchPath("../data/test");
+ VirtFs::removeDirFromSearchPath("data");
+ VirtFs::removeDirFromSearchPath("../data");
delete2(logger);
// VirtFs::deinit();
}