summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-01 03:22:59 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-01 03:22:59 +0300
commit950c3109bcd8a69d77d22c316cfc6ab34abf5f22 (patch)
treeaa2cd2cf37f34a3b80b063d4db2785453e832785
parent8c53c9e09c2a5b3f5e320b87f62d61bbd7d16043 (diff)
downloadManaVerse-950c3109bcd8a69d77d22c316cfc6ab34abf5f22.tar.gz
ManaVerse-950c3109bcd8a69d77d22c316cfc6ab34abf5f22.tar.bz2
ManaVerse-950c3109bcd8a69d77d22c316cfc6ab34abf5f22.tar.xz
ManaVerse-950c3109bcd8a69d77d22c316cfc6ab34abf5f22.zip
Extend windows unit tests with drawing.
-rw-r--r--src/client.cpp2
-rw-r--r--src/gui/windowmanager_unittest.cc14
-rw-r--r--src/input/touch/touchmanager.cpp4
3 files changed, 12 insertions, 8 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 1fec49b29..04a58ad55 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -301,6 +301,8 @@ void Client::gameInit()
logger->setDebugLog(config.getBoolValue("debugLog"));
logger->setReportUnimplimented(config.getBoolValue("unimplimentedLog"));
+ touchManager.init();
+
config.incValue("runcount");
#ifndef ANDROID
diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc
index 3793a76c6..ccd027f98 100644
--- a/src/gui/windowmanager_unittest.cc
+++ b/src/gui/windowmanager_unittest.cc
@@ -47,6 +47,8 @@
#include "gui/windows/setupwindow.h"
#include "gui/windows/serverdialog.h"
+#include "input/touch/touchmanager.h"
+
#include "render/sdlgraphics.h"
#include "resources/sdlimagehelper.h"
@@ -81,14 +83,9 @@ TEST_CASE("Windows tests", "windowmanager")
ActorSprite::load();
gui = new Gui();
gui->postInit(mainGraphics);
+ touchManager.init();
-#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
+ mainGraphics->setVideoMode(640, 480, 1, 8, false, false, false, false);
SECTION("setupWindow")
{
@@ -175,6 +172,9 @@ TEST_CASE("Windows tests", "windowmanager")
delete2(connectionDialog);
}
+ gui->draw();
+ mainGraphics->updateScreen();
+
delete2(userPalette);
delete2(client);
windowContainer = nullptr;
diff --git a/src/input/touch/touchmanager.cpp b/src/input/touch/touchmanager.cpp
index 29e2b3cf5..be6dd072d 100644
--- a/src/input/touch/touchmanager.cpp
+++ b/src/input/touch/touchmanager.cpp
@@ -53,7 +53,7 @@ TouchManager::TouchManager() :
mKeyboard(nullptr),
mPad(nullptr),
mObjects(),
- mVertexes(new ImageCollection),
+ mVertexes(nullptr),
mRedraw(true),
mShowJoystick(false),
mShowButtons(false),
@@ -86,6 +86,8 @@ void TouchManager::shutdown() restrict2
void TouchManager::init() restrict2
{
+ mVertexes = new ImageCollection;
+
config.addListener("showScreenJoystick", this);
config.addListener("showScreenButtons", this);
config.addListener("showScreenKeyboard", this);