summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-17 02:48:17 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-17 02:48:17 +0300
commit8d32becc5b0fe645d1b8dc4245310ff35ebd8777 (patch)
tree26b25e949a6a787c8d85e452545e3a8bfa70de06 /src/resources
parent23f8cc7c1db313710180c0b1864a93cc76d2492d (diff)
downloadmanaplus-8d32becc5b0fe645d1b8dc4245310ff35ebd8777.tar.gz
manaplus-8d32becc5b0fe645d1b8dc4245310ff35ebd8777.tar.bz2
manaplus-8d32becc5b0fe645d1b8dc4245310ff35ebd8777.tar.xz
manaplus-8d32becc5b0fe645d1b8dc4245310ff35ebd8777.zip
Fix unit tests if build with SDL2 support.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/dye/dyepalette_unittest.cc11
-rw-r--r--src/resources/sprite/animatedsprite_unittest.cc11
2 files changed, 20 insertions, 2 deletions
diff --git a/src/resources/dye/dyepalette_unittest.cc b/src/resources/dye/dyepalette_unittest.cc
index 1393070ea..d250acb39 100644
--- a/src/resources/dye/dyepalette_unittest.cc
+++ b/src/resources/dye/dyepalette_unittest.cc
@@ -23,6 +23,9 @@
#include "client.h"
#include "configuration.h"
#include "logger.h"
+#ifdef USE_SDL2
+#include "graphicsmanager.h"
+#endif
#include "resources/resourcemanager.h"
#include "resources/sdlimagehelper.h"
@@ -52,7 +55,13 @@ TEST_CASE("DyePalette tests")
resourceManager->addToSearchPath("../data/test", Append_false);
imageHelper = new SDLImageHelper();
- SDL_SetVideoMode(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
+#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
paths.setDefaultValues(getPathsDefaults());
PaletteDB::load();
diff --git a/src/resources/sprite/animatedsprite_unittest.cc b/src/resources/sprite/animatedsprite_unittest.cc
index c1735d803..e87586466 100644
--- a/src/resources/sprite/animatedsprite_unittest.cc
+++ b/src/resources/sprite/animatedsprite_unittest.cc
@@ -22,6 +22,9 @@
#include "catch.hpp"
#include "client.h"
+#ifdef USE_SDL2
+#include "graphicsmanager.h"
+#endif
#include "const/resources/spriteaction.h"
@@ -52,7 +55,13 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite")
resourceManager->addToSearchPath("../data", Append_false);
imageHelper = new SDLImageHelper();
- SDL_SetVideoMode(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
+#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
SECTION("basic test 1")
{