From 4133ef1e7821cae6205d4ee5a8e3277eec9fe540 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 14 Sep 2017 02:52:41 +0300 Subject: Fix unit tests error with undefined config variable. --- src/unittests/resources/dye/dye.cc | 12 ++++++------ src/unittests/resources/dye/dyepalette.cc | 15 ++++++++------- src/unittests/resources/map/maplayer/drawfringenormal.cc | 13 +++++++------ src/unittests/resources/map/maplayer/drawfringesimple.cc | 13 +++++++------ src/unittests/resources/map/maplayer/drawspeciallayer1.cc | 13 +++++++------ src/unittests/resources/map/maplayer/drawspeciallayer2.cc | 13 +++++++------ src/unittests/resources/map/speciallayer.cc | 13 +++++++------ .../resources/resourcemanager/resourcemanager.cc | 13 +++++++------ src/unittests/resources/sdlimagehelper.cc | 13 +++++++------ src/unittests/resources/sprite/animatedsprite.cc | 15 ++++++++------- 10 files changed, 71 insertions(+), 62 deletions(-) (limited to 'src/unittests/resources') diff --git a/src/unittests/resources/dye/dye.cc b/src/unittests/resources/dye/dye.cc index ada0f5d40..a0294a84f 100644 --- a/src/unittests/resources/dye/dye.cc +++ b/src/unittests/resources/dye/dye.cc @@ -1963,6 +1963,12 @@ TEST_CASE("Dye real dye", "") VirtFs::mountDirSilent("data/test", Append_false); VirtFs::mountDirSilent("../data/test", Append_false); + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 imageHelper = new SurfaceImageHelper; @@ -1978,12 +1984,6 @@ TEST_CASE("Dye real dye", "") userPalette = new UserPalette; - Dirs::initRootDir(); - Dirs::initHomeDir(); - - setBrandingDefaults(branding); - ConfigManager::initConfiguration(); - theme = new Theme; Theme::selectSkin(); diff --git a/src/unittests/resources/dye/dyepalette.cc b/src/unittests/resources/dye/dyepalette.cc index 47f7266a4..e2632003a 100644 --- a/src/unittests/resources/dye/dyepalette.cc +++ b/src/unittests/resources/dye/dyepalette.cc @@ -67,6 +67,14 @@ TEST_CASE("DyePalette tests", "") mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + ConfigManager::initConfiguration(); + setConfigDefaults2(config); + setBrandingDefaults(branding); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -76,13 +84,6 @@ TEST_CASE("DyePalette tests", "") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 - Dirs::initRootDir(); - Dirs::initHomeDir(); - - ConfigManager::initConfiguration(); - setConfigDefaults2(config); - setBrandingDefaults(branding); - theme = new Theme; Theme::selectSkin(); diff --git a/src/unittests/resources/map/maplayer/drawfringenormal.cc b/src/unittests/resources/map/maplayer/drawfringenormal.cc index 15990d5f6..372f602b0 100644 --- a/src/unittests/resources/map/maplayer/drawfringenormal.cc +++ b/src/unittests/resources/map/maplayer/drawfringenormal.cc @@ -58,6 +58,13 @@ TEST_CASE("MapLayer drawFringe normal", "") VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -67,12 +74,6 @@ 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 e910a5702..8773790c7 100644 --- a/src/unittests/resources/map/maplayer/drawfringesimple.cc +++ b/src/unittests/resources/map/maplayer/drawfringesimple.cc @@ -55,6 +55,13 @@ TEST_CASE("MapLayer drawFringe simple", "") VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -64,12 +71,6 @@ 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 0940e4279..c9dd51f1d 100644 --- a/src/unittests/resources/map/maplayer/drawspeciallayer1.cc +++ b/src/unittests/resources/map/maplayer/drawspeciallayer1.cc @@ -51,6 +51,13 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "") VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -60,12 +67,6 @@ 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 8aa0ccf8b..e4e414a0d 100644 --- a/src/unittests/resources/map/maplayer/drawspeciallayer2.cc +++ b/src/unittests/resources/map/maplayer/drawspeciallayer2.cc @@ -51,6 +51,13 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "") VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -60,12 +67,6 @@ 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 f2de1db43..2e72d6e19 100644 --- a/src/unittests/resources/map/speciallayer.cc +++ b/src/unittests/resources/map/speciallayer.cc @@ -56,6 +56,13 @@ TEST_CASE("SpecialLayer updateCache", "") VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -67,12 +74,6 @@ TEST_CASE("SpecialLayer updateCache", "") userPalette = new UserPalette; - Dirs::initRootDir(); - Dirs::initHomeDir(); - - setBrandingDefaults(branding); - ConfigManager::initConfiguration(); - theme = new Theme; Theme::selectSkin(); diff --git a/src/unittests/resources/resourcemanager/resourcemanager.cc b/src/unittests/resources/resourcemanager/resourcemanager.cc index 9552089fd..4b67af82e 100644 --- a/src/unittests/resources/resourcemanager/resourcemanager.cc +++ b/src/unittests/resources/resourcemanager/resourcemanager.cc @@ -101,6 +101,13 @@ TEST_CASE("resourcemanager", "resourcemanager") VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper(); + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -112,12 +119,6 @@ TEST_CASE("resourcemanager", "resourcemanager") userPalette = new UserPalette; - Dirs::initRootDir(); - Dirs::initHomeDir(); - - setBrandingDefaults(branding); - ConfigManager::initConfiguration(); - theme = new Theme; Theme::selectSkin(); diff --git a/src/unittests/resources/sdlimagehelper.cc b/src/unittests/resources/sdlimagehelper.cc index 1208a5ef2..931acbb88 100644 --- a/src/unittests/resources/sdlimagehelper.cc +++ b/src/unittests/resources/sdlimagehelper.cc @@ -80,6 +80,13 @@ TEST_CASE("sdlimagehelper combineSurface", "") mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper; + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + setBrandingDefaults(branding); + ConfigManager::initConfiguration(); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -91,12 +98,6 @@ TEST_CASE("sdlimagehelper combineSurface", "") userPalette = new UserPalette; - Dirs::initRootDir(); - Dirs::initHomeDir(); - - setBrandingDefaults(branding); - ConfigManager::initConfiguration(); - theme = new Theme; Theme::selectSkin(); diff --git a/src/unittests/resources/sprite/animatedsprite.cc b/src/unittests/resources/sprite/animatedsprite.cc index 3d778b403..c97afeeda 100644 --- a/src/unittests/resources/sprite/animatedsprite.cc +++ b/src/unittests/resources/sprite/animatedsprite.cc @@ -68,6 +68,14 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); + + Dirs::initRootDir(); + Dirs::initHomeDir(); + + ConfigManager::initConfiguration(); + setConfigDefaults2(config); + setBrandingDefaults(branding); + #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, @@ -77,13 +85,6 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 - Dirs::initRootDir(); - Dirs::initHomeDir(); - - ConfigManager::initConfiguration(); - setConfigDefaults2(config); - setBrandingDefaults(branding); - theme = new Theme; Theme::selectSkin(); -- cgit v1.2.3-70-g09d2