summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/gui/windowmanager_unittest.cc11
-rw-r--r--src/integrity_unittest.cc11
-rw-r--r--src/render/graphics.cpp4
-rw-r--r--src/resources/dye/dyepalette_unittest.cc11
-rw-r--r--src/resources/sprite/animatedsprite_unittest.cc11
6 files changed, 47 insertions, 5 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e9121652e..502ba1b3b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1726,6 +1726,10 @@ TESTS = manaplustests
check_PROGRAMS = manaplustests
manaplustests_CXXFLAGS = ${manaplus_CXXFLAGS} \
-DUNITTESTS
+if USE_SDL2
+manaplustests_CXXFLAGS += -DUSE_SDL2
+endif
+
manaplustests_SOURCES = ${manaplus_SOURCES} \
enums/enums_unittest.cc \
utils/xml_unittest.cc \
diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc
index 9f8e51ffe..7d18c4b9a 100644
--- a/src/gui/windowmanager_unittest.cc
+++ b/src/gui/windowmanager_unittest.cc
@@ -20,6 +20,9 @@
#include "catch.hpp"
#include "client.h"
+#ifdef USE_SDL2
+#include "graphicsmanager.h"
+#endif
#include "settings.h"
#include "gui/gui.h"
@@ -78,7 +81,13 @@ TEST_CASE("Windows tests", "windowmanager")
gui = new Gui();
gui->postInit(mainGraphics);
- 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("setupWindow")
{
diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc
index 0fbc14efb..c24452ae2 100644
--- a/src/integrity_unittest.cc
+++ b/src/integrity_unittest.cc
@@ -23,6 +23,9 @@
#include "catch.hpp"
#include "client.h"
#include "logger.h"
+#ifdef USE_SDL2
+#include "graphicsmanager.h"
+#endif
#include "input/inputactionmap.h"
#include "input/inputmanager.h"
@@ -73,7 +76,13 @@ TEST_CASE("integrity tests", "integrity")
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("integrity test 1")
{
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 383ce96fd..e589058c5 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -320,7 +320,9 @@ bool Graphics::setOpenGLMode() restrict2
GLint texSize;
bool rectTex = graphicsManager.supportExtension(
- "GL_ARB_texture_rectangle");
+ "GL_ARB_texture_rectangle") ||
+ graphicsManager.supportExtension("GL_EXT_texture_rectangle");
+
if (rectTex
&& OpenGLImageHelper::getInternalTextureType() == 4
&& getOpenGL() != RENDER_GLES_OPENGL
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")
{