summaryrefslogtreecommitdiff
path: root/src/unittests/utils/xmlutils.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-30 01:16:45 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-30 01:16:45 +0300
commita5f01058610fbb5ce099d0a11acf2eaf6a4b3515 (patch)
treef372942f301e31bb831ac2c3a0c46ffd5cda5f39 /src/unittests/utils/xmlutils.cc
parent04b6502017530882a754f5c8ae6adb592324d723 (diff)
downloadmanaplus-a5f01058610fbb5ce099d0a11acf2eaf6a4b3515.tar.gz
manaplus-a5f01058610fbb5ce099d0a11acf2eaf6a4b3515.tar.bz2
manaplus-a5f01058610fbb5ce099d0a11acf2eaf6a4b3515.tar.xz
manaplus-a5f01058610fbb5ce099d0a11acf2eaf6a4b3515.zip
Add missing init code into some unit tests.
Diffstat (limited to 'src/unittests/utils/xmlutils.cc')
-rw-r--r--src/unittests/utils/xmlutils.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/unittests/utils/xmlutils.cc b/src/unittests/utils/xmlutils.cc
index c17ca98e4..c2b3bd349 100644
--- a/src/unittests/utils/xmlutils.cc
+++ b/src/unittests/utils/xmlutils.cc
@@ -21,6 +21,8 @@
#include "unittests/unittests.h"
#include "client.h"
+#include "configuration.h"
+#include "dirs.h"
#include "graphicsmanager.h"
#include "being/actorsprite.h"
@@ -28,6 +30,8 @@
#include "fs/virtfs/fs.h"
#include "gui/gui.h"
+#include "gui/userpalette.h"
+#include "gui/theme.h"
#include "utils/delete2.h"
#include "utils/env.h"
@@ -71,6 +75,13 @@ TEST_CASE("xmlutils readXmlIntVector 1", "")
graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
#endif // USE_SDL2
+ userPalette = new UserPalette;
+ theme = new Theme;
+ Theme::selectSkin();
+
+ Dirs::initRootDir();
+ Dirs::initHomeDir();
+
ActorSprite::load();
STD_VECTOR<int> arr;
@@ -89,6 +100,9 @@ TEST_CASE("xmlutils readXmlIntVector 1", "")
REQUIRE(0 == arr[2]);
REQUIRE(1 == arr[3]);
REQUIRE(1 == arr[4]);
+
+ delete2(userPalette);
+ delete2(theme);
delete2(client);
ResourceManager::deleteInstance();
VirtFs::unmountDirSilent("data");
@@ -118,6 +132,13 @@ TEST_CASE("xmlutils readXmlStringMap 1", "")
graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
#endif // USE_SDL2
+ userPalette = new UserPalette;
+ theme = new Theme;
+ Theme::selectSkin();
+
+ Dirs::initRootDir();
+ Dirs::initHomeDir();
+
ActorSprite::load();
std::map<std::string, std::string> arr;
@@ -135,6 +156,9 @@ TEST_CASE("xmlutils readXmlStringMap 1", "")
REQUIRE(arr["Kitty"] == "0");
REQUIRE(arr["xD"] == "1");
REQUIRE(arr["Metal"] == "26");
+
+ delete2(userPalette);
+ delete2(theme);
delete2(client);
ResourceManager::deleteInstance();
VirtFs::unmountDirSilent("data");
@@ -166,6 +190,13 @@ TEST_CASE("xmlutils readXmlIntMap 1", "")
graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
#endif // USE_SDL2
+ userPalette = new UserPalette;
+ theme = new Theme;
+ Theme::selectSkin();
+
+ Dirs::initRootDir();
+ Dirs::initHomeDir();
+
ActorSprite::load();
std::map<int32_t, int32_t> arr;
@@ -183,6 +214,9 @@ TEST_CASE("xmlutils readXmlIntMap 1", "")
REQUIRE(arr[1] == 2);
REQUIRE(arr[10] == 20);
REQUIRE(arr[3] == 0);
+
+ delete2(userPalette);
+ delete2(theme);
delete2(client);
ResourceManager::deleteInstance();
VirtFs::unmountDirSilent("data/test");