From a5f01058610fbb5ce099d0a11acf2eaf6a4b3515 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 30 Aug 2017 01:16:45 +0300 Subject: Add missing init code into some unit tests. --- src/unittests/utils/xmlutils.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/unittests/utils/xmlutils.cc') 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 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 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 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"); -- cgit v1.2.3-70-g09d2