diff options
-rw-r--r-- | src/unittests/resources/dye/dye.cc | 13 | ||||
-rw-r--r-- | src/unittests/resources/map/speciallayer.cc | 13 | ||||
-rw-r--r-- | src/unittests/resources/resourcemanager/resourcemanager.cc | 10 | ||||
-rw-r--r-- | src/unittests/resources/sdlimagehelper.cc | 13 | ||||
-rw-r--r-- | src/unittests/sdl.cc | 1 | ||||
-rw-r--r-- | src/unittests/utils/xmlutils.cc | 34 |
6 files changed, 83 insertions, 1 deletions
diff --git a/src/unittests/resources/dye/dye.cc b/src/unittests/resources/dye/dye.cc index fcdeb7b17..b53601abe 100644 --- a/src/unittests/resources/dye/dye.cc +++ b/src/unittests/resources/dye/dye.cc @@ -21,6 +21,7 @@ #include "unittests/unittests.h" #include "client.h" +#include "dirs.h" #include "graphicsmanager.h" #include "logger.h" @@ -29,6 +30,8 @@ #include "fs/virtfs/fs.h" #include "gui/gui.h" +#include "gui/userpalette.h" +#include "gui/theme.h" #include "resources/sdlimagehelper.h" #ifdef USE_SDL2 @@ -1985,6 +1988,13 @@ TEST_CASE("Dye real dye", "") 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(); SECTION("B dye") @@ -2001,6 +2011,9 @@ TEST_CASE("Dye real dye", "") { dyeCheck("|A:#0000FFFF,FF000050", "arrow_up_A.png"); } + + delete2(userPalette); + delete2(theme); delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); diff --git a/src/unittests/resources/map/speciallayer.cc b/src/unittests/resources/map/speciallayer.cc index 0461a98c4..c46c67626 100644 --- a/src/unittests/resources/map/speciallayer.cc +++ b/src/unittests/resources/map/speciallayer.cc @@ -21,12 +21,16 @@ #include "unittests/unittests.h" #include "client.h" +#include "dirs.h" #include "logger.h" #include "graphicsmanager.h" #include "being/actorsprite.h" +#include "gui/userpalette.h" +#include "gui/theme.h" + #include "enums/resources/map/mapitemtype.h" #include "fs/virtfs/fs.h" @@ -72,6 +76,13 @@ TEST_CASE("SpecialLayer updateCache", "") 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(); SpecialLayer *layer = nullptr; @@ -275,6 +286,8 @@ TEST_CASE("SpecialLayer updateCache", "") delete layer; ResourceManager::cleanOrphans(); + delete2(userPalette); + delete2(theme); delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); diff --git a/src/unittests/resources/resourcemanager/resourcemanager.cc b/src/unittests/resources/resourcemanager/resourcemanager.cc index 90bc873ab..cd67b10d8 100644 --- a/src/unittests/resources/resourcemanager/resourcemanager.cc +++ b/src/unittests/resources/resourcemanager/resourcemanager.cc @@ -30,6 +30,8 @@ #include "fs/virtfs/fs.h" #include "gui/gui.h" +#include "gui/userpalette.h" +#include "gui/theme.h" #include "resources/sdlimagehelper.h" @@ -118,11 +120,15 @@ TEST_CASE("resourcemanager", "resourcemanager") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 - ActorSprite::load(); + userPalette = new UserPalette; + theme = new Theme; + Theme::selectSkin(); Dirs::initRootDir(); Dirs::initHomeDir(); + ActorSprite::load(); + // ConfigManager::initConfiguration(); // getConfigDefaults2(config.getDefaultValues()); @@ -684,6 +690,8 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(ResourceManager::getDeletedResources().empty() == true); } + delete2(userPalette); + delete2(theme); delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); diff --git a/src/unittests/resources/sdlimagehelper.cc b/src/unittests/resources/sdlimagehelper.cc index 2a3aec45b..fa897c01d 100644 --- a/src/unittests/resources/sdlimagehelper.cc +++ b/src/unittests/resources/sdlimagehelper.cc @@ -29,12 +29,16 @@ PRAGMA48(GCC diagnostic pop) #include "unittests/unittests.h" #include "client.h" +#include "dirs.h" #include "graphicsmanager.h" #include "being/actorsprite.h" #include "fs/virtfs/fs.h" +#include "gui/userpalette.h" +#include "gui/theme.h" + #include "utils/delete2.h" #include "utils/env.h" @@ -84,6 +88,13 @@ TEST_CASE("sdlimagehelper combineSurface", "") 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(); SECTION("empty copy1") @@ -531,6 +542,8 @@ TEST_CASE("sdlimagehelper combineSurface", "") MSDL_FreeSurface(surface2); } + delete2(userPalette); + delete2(theme); delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); diff --git a/src/unittests/sdl.cc b/src/unittests/sdl.cc index 1d469061b..b75b9a453 100644 --- a/src/unittests/sdl.cc +++ b/src/unittests/sdl.cc @@ -404,6 +404,7 @@ TEST_CASE("sdl tests", "sdl") ResourceManager::cleanOrphans(true); delete2(userPalette); + delete2(theme); delete2(client); VirtFs::unmountDirSilent("data"); 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"); |