From 59d9b799fa5bf3c8ba99cc6f703b83751f1d3497 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Sep 2017 04:05:51 +0300 Subject: Fix unit tests after last changes in configuration.cpp --- src/unittests/resources/dye/dye.cc | 11 ++++++++--- src/unittests/resources/dye/dyepalette.cc | 6 +++--- src/unittests/resources/map/maplayer/draw.cc | 2 -- src/unittests/resources/map/maplayer/drawfringenormal.cc | 9 +++++++++ src/unittests/resources/map/maplayer/drawfringesimple.cc | 9 +++++++++ src/unittests/resources/map/maplayer/drawspeciallayer1.cc | 9 +++++++++ src/unittests/resources/map/maplayer/drawspeciallayer2.cc | 9 +++++++++ src/unittests/resources/map/speciallayer.cc | 10 ++++++++-- src/unittests/resources/resourcemanager/resourcemanager.cc | 10 ++++++++-- src/unittests/resources/sdlimagehelper.cc | 10 ++++++++-- src/unittests/resources/sprite/animatedsprite.cc | 6 +++--- 11 files changed, 74 insertions(+), 17 deletions(-) (limited to 'src/unittests/resources') diff --git a/src/unittests/resources/dye/dye.cc b/src/unittests/resources/dye/dye.cc index 54ddd7c45..499e570ea 100644 --- a/src/unittests/resources/dye/dye.cc +++ b/src/unittests/resources/dye/dye.cc @@ -21,6 +21,8 @@ #include "unittests/unittests.h" #include "client.h" +#include "configmanager.h" +#include "configuration.h" #include "dirs.h" #include "graphicsmanager.h" @@ -28,7 +30,6 @@ #include "fs/virtfs/fs.h" -#include "gui/gui.h" #include "gui/userpalette.h" #include "gui/theme.h" @@ -1977,12 +1978,16 @@ TEST_CASE("Dye real dye", "") #endif // USE_SDL2 userPalette = new UserPalette; - theme = new Theme; - Theme::selectSkin(); Dirs::initRootDir(); Dirs::initHomeDir(); + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + + theme = new Theme; + Theme::selectSkin(); + ActorSprite::load(); SECTION("B dye") diff --git a/src/unittests/resources/dye/dyepalette.cc b/src/unittests/resources/dye/dyepalette.cc index 54d947358..7c49f02c1 100644 --- a/src/unittests/resources/dye/dyepalette.cc +++ b/src/unittests/resources/dye/dyepalette.cc @@ -77,9 +77,6 @@ TEST_CASE("DyePalette tests", "") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 - theme = new Theme; - Theme::selectSkin(); - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -87,6 +84,9 @@ TEST_CASE("DyePalette tests", "") setConfigDefaults2(config); setBrandingDefaults(branding); + theme = new Theme; + Theme::selectSkin(); + ActorSprite::load(); gui = new Gui(); gui->postInit(mainGraphics); diff --git a/src/unittests/resources/map/maplayer/draw.cc b/src/unittests/resources/map/maplayer/draw.cc index ac7fba9b7..5e6cfdddf 100644 --- a/src/unittests/resources/map/maplayer/draw.cc +++ b/src/unittests/resources/map/maplayer/draw.cc @@ -25,8 +25,6 @@ #include "unittests/render/mockgraphics.h" -#include "utils/delete2.h" - #include "resources/image/image.h" #include "resources/map/map.h" diff --git a/src/unittests/resources/map/maplayer/drawfringenormal.cc b/src/unittests/resources/map/maplayer/drawfringenormal.cc index 6ab0a395c..4ec72484b 100644 --- a/src/unittests/resources/map/maplayer/drawfringenormal.cc +++ b/src/unittests/resources/map/maplayer/drawfringenormal.cc @@ -20,6 +20,9 @@ #include "unittests/unittests.h" +#include "configmanager.h" +#include "configuration.h" +#include "dirs.h" #include "graphicsmanager.h" #include "being/localplayer.h" @@ -65,6 +68,12 @@ TEST_CASE("MapLayer drawFringe normal", "") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + theme = new Theme; Theme::selectSkin(); diff --git a/src/unittests/resources/map/maplayer/drawfringesimple.cc b/src/unittests/resources/map/maplayer/drawfringesimple.cc index 6a362b8aa..8c3457e8f 100644 --- a/src/unittests/resources/map/maplayer/drawfringesimple.cc +++ b/src/unittests/resources/map/maplayer/drawfringesimple.cc @@ -20,6 +20,9 @@ #include "unittests/unittests.h" +#include "configmanager.h" +#include "configuration.h" +#include "dirs.h" #include "graphicsmanager.h" #include "being/localplayer.h" @@ -62,6 +65,12 @@ TEST_CASE("MapLayer drawFringe simple", "") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + theme = new Theme; Theme::selectSkin(); diff --git a/src/unittests/resources/map/maplayer/drawspeciallayer1.cc b/src/unittests/resources/map/maplayer/drawspeciallayer1.cc index 3224eb5ef..2927deb48 100644 --- a/src/unittests/resources/map/maplayer/drawspeciallayer1.cc +++ b/src/unittests/resources/map/maplayer/drawspeciallayer1.cc @@ -20,6 +20,9 @@ #include "unittests/unittests.h" +#include "configmanager.h" +#include "configuration.h" +#include "dirs.h" #include "graphicsmanager.h" #include "enums/resources/map/mapitemtype.h" @@ -59,6 +62,12 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + Map *map = nullptr; MapLayer *layer = nullptr; SpecialLayer *specialLayer = nullptr; diff --git a/src/unittests/resources/map/maplayer/drawspeciallayer2.cc b/src/unittests/resources/map/maplayer/drawspeciallayer2.cc index 0092b2019..ec101a099 100644 --- a/src/unittests/resources/map/maplayer/drawspeciallayer2.cc +++ b/src/unittests/resources/map/maplayer/drawspeciallayer2.cc @@ -20,6 +20,9 @@ #include "unittests/unittests.h" +#include "configmanager.h" +#include "configuration.h" +#include "dirs.h" #include "graphicsmanager.h" #include "enums/resources/map/mapitemtype.h" @@ -59,6 +62,12 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + Map *map = nullptr; MapLayer *layer = nullptr; SpecialLayer *specialLayer = nullptr; diff --git a/src/unittests/resources/map/speciallayer.cc b/src/unittests/resources/map/speciallayer.cc index ef9b79e48..49b50c932 100644 --- a/src/unittests/resources/map/speciallayer.cc +++ b/src/unittests/resources/map/speciallayer.cc @@ -21,6 +21,8 @@ #include "unittests/unittests.h" #include "client.h" +#include "configmanager.h" +#include "configuration.h" #include "dirs.h" #include "graphicsmanager.h" @@ -65,12 +67,16 @@ TEST_CASE("SpecialLayer updateCache", "") #endif // USE_SDL2 userPalette = new UserPalette; - theme = new Theme; - Theme::selectSkin(); Dirs::initRootDir(); Dirs::initHomeDir(); + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + + theme = new Theme; + Theme::selectSkin(); + ActorSprite::load(); SpecialLayer *layer = nullptr; diff --git a/src/unittests/resources/resourcemanager/resourcemanager.cc b/src/unittests/resources/resourcemanager/resourcemanager.cc index d035faafb..66656558b 100644 --- a/src/unittests/resources/resourcemanager/resourcemanager.cc +++ b/src/unittests/resources/resourcemanager/resourcemanager.cc @@ -21,6 +21,8 @@ #include "unittests/unittests.h" #include "client.h" +#include "configmanager.h" +#include "configuration.h" #include "dirs.h" #include "graphicsmanager.h" @@ -110,12 +112,16 @@ TEST_CASE("resourcemanager", "resourcemanager") #endif // USE_SDL2 userPalette = new UserPalette; - theme = new Theme; - Theme::selectSkin(); Dirs::initRootDir(); Dirs::initHomeDir(); + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + + theme = new Theme; + Theme::selectSkin(); + ActorSprite::load(); // ConfigManager::initConfiguration(); diff --git a/src/unittests/resources/sdlimagehelper.cc b/src/unittests/resources/sdlimagehelper.cc index fa897c01d..e76e6f26d 100644 --- a/src/unittests/resources/sdlimagehelper.cc +++ b/src/unittests/resources/sdlimagehelper.cc @@ -29,6 +29,8 @@ PRAGMA48(GCC diagnostic pop) #include "unittests/unittests.h" #include "client.h" +#include "configmanager.h" +#include "configuration.h" #include "dirs.h" #include "graphicsmanager.h" @@ -89,12 +91,16 @@ TEST_CASE("sdlimagehelper combineSurface", "") #endif // USE_SDL2 userPalette = new UserPalette; - theme = new Theme; - Theme::selectSkin(); Dirs::initRootDir(); Dirs::initHomeDir(); + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + + theme = new Theme; + Theme::selectSkin(); + ActorSprite::load(); SECTION("empty copy1") diff --git a/src/unittests/resources/sprite/animatedsprite.cc b/src/unittests/resources/sprite/animatedsprite.cc index a48c21baa..0dab6d9cd 100644 --- a/src/unittests/resources/sprite/animatedsprite.cc +++ b/src/unittests/resources/sprite/animatedsprite.cc @@ -78,9 +78,6 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 - theme = new Theme; - Theme::selectSkin(); - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -88,6 +85,9 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") setConfigDefaults2(config); setBrandingDefaults(branding); + theme = new Theme; + Theme::selectSkin(); + ActorSprite::load(); gui = new Gui(); gui->postInit(mainGraphics); -- cgit v1.2.3-60-g2f50