From 855387d2d795c9471587cc7ddf2c66bb676d698e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 Jan 2017 17:00:02 +0300 Subject: Fix different issues in unit tests. Fix crash with some compilers flags. Clean window container to null after it was removed. Init and deinit physfs globally. --- src/resources/dye/dye_unittest.cc | 1 - src/resources/dye/dyepalette_unittest.cc | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/resources/dye') diff --git a/src/resources/dye/dye_unittest.cc b/src/resources/dye/dye_unittest.cc index ff79fea52..370800675 100644 --- a/src/resources/dye/dye_unittest.cc +++ b/src/resources/dye/dye_unittest.cc @@ -2354,7 +2354,6 @@ TEST_CASE("Dye real dye") setEnv("SDL_VIDEODRIVER", "dummy"); client = new Client; - PHYSFS_init("manaplus"); dirSeparator = "/"; SDL_Init(SDL_INIT_VIDEO); logger = new Logger(); diff --git a/src/resources/dye/dyepalette_unittest.cc b/src/resources/dye/dyepalette_unittest.cc index 7e652e43f..5296abb33 100644 --- a/src/resources/dye/dyepalette_unittest.cc +++ b/src/resources/dye/dyepalette_unittest.cc @@ -27,6 +27,11 @@ #include "being/actorsprite.h" +#include "gui/gui.h" +#include "gui/theme.h" + +#include "render/sdlgraphics.h" + #include "resources/sdlimagehelper.h" #include "resources/db/palettedb.h" @@ -50,7 +55,6 @@ TEST_CASE("DyePalette tests") setEnv("SDL_VIDEODRIVER", "dummy"); client = new Client; - PHYSFS_init("manaplus"); dirSeparator = "/"; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); @@ -59,6 +63,7 @@ TEST_CASE("DyePalette tests") resourceManager->addToSearchPath("data/test", Append_false); resourceManager->addToSearchPath("../data/test", Append_false); + mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( @@ -69,7 +74,11 @@ TEST_CASE("DyePalette tests") graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif // USE_SDL2 + theme = new Theme; + Theme::selectSkin(); ActorSprite::load(); + gui = new Gui(); + gui->postInit(mainGraphics); paths.setDefaultValues(getPathsDefaults()); PaletteDB::load(); -- cgit v1.2.3-70-g09d2