From 382defab18bf7e1dc35c243b661e7557b0dca1ac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 28 Aug 2016 22:37:11 +0300 Subject: Fix unit tests with SDL2. --- src/gui/windowmanager_unittest.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc index 84e2b5e2f..37edeb1df 100644 --- a/src/gui/windowmanager_unittest.cc +++ b/src/gui/windowmanager_unittest.cc @@ -21,6 +21,7 @@ #include "catch.hpp" #include "client.h" #include "configuration.h" +#include "graphicsmanager.h" #include "settings.h" #include "units.h" #include "textcommand.h" @@ -141,9 +142,16 @@ TEST_CASE("Windows tests", "windowmanager") branding.setValue("onlineServerFile", "test/serverlistplus.xml"); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper; +#ifdef USE_SDL2 + SDLImageHelper::setRenderer(graphicsManager.createRenderer( + graphicsManager.createWindow(640, 480, 0, + SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE)); +#else + graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); +#endif + ActorSprite::load(); userPalette = new UserPalette; theme = new Theme; - ActorSprite::load(); config.setValue("fontSize", 16); gui = new Gui(); gui->postInit(mainGraphics); @@ -154,6 +162,7 @@ TEST_CASE("Windows tests", "windowmanager") inventoryHandler = new EAthena::InventoryHandler; playerHandler = new EAthena::PlayerHandler; paths.setValue("itemIcons", ""); + TranslationManager::init(); mainGraphics->setVideoMode(640, 480, 1, 8, false, false, false, false); -- cgit v1.2.3-70-g09d2