summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-05 17:00:02 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-05 17:00:02 +0300
commit855387d2d795c9471587cc7ddf2c66bb676d698e (patch)
tree3dbb1260c219312f36893dfae52f5cd40760aeb5 /src/gui/widgets/browserbox_unittest.cc
parent9fefb2942865846ccb7dbdac4ebd4515b8c851a2 (diff)
downloadmv-855387d2d795c9471587cc7ddf2c66bb676d698e.tar.gz
mv-855387d2d795c9471587cc7ddf2c66bb676d698e.tar.bz2
mv-855387d2d795c9471587cc7ddf2c66bb676d698e.tar.xz
mv-855387d2d795c9471587cc7ddf2c66bb676d698e.zip
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.
Diffstat (limited to 'src/gui/widgets/browserbox_unittest.cc')
-rw-r--r--src/gui/widgets/browserbox_unittest.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc
index 665d6de3f..c58f274e0 100644
--- a/src/gui/widgets/browserbox_unittest.cc
+++ b/src/gui/widgets/browserbox_unittest.cc
@@ -20,13 +20,20 @@
#include "catch.hpp"
#include "client.h"
+#include "graphicsmanager.h"
#include "being/actorsprite.h"
+#include "gui/gui.h"
+
#include "gui/fonts/font.h"
#include "gui/widgets/browserbox.h"
+#include "render/sdlgraphics.h"
+
+#include "resources/sdlimagehelper.h"
+
#include "resources/resourcemanager/resourcemanager.h"
#include "resources/sdlimagehelper.h"
@@ -41,16 +48,31 @@ extern const char *dirSeparator;
TEST_CASE("BrowserBox tests", "browserbox")
{
- PHYSFS_init("manaplus");
dirSeparator = "/";
client = new Client;
logger = new Logger();
imageHelper = new SDLImageHelper();
- theme = new Theme;
ResourceManager::init();
resourceManager->addToSearchPath("data", Append_false);
resourceManager->addToSearchPath("../data", Append_false);
+
+ 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 // USE_SDL2
+
+ 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);
+
Widget::setGlobalFont(new Font("/usr/share/fonts/truetype/"
"ttf-dejavu/DejaVuSans-Oblique.ttf", 18));
BrowserBox *const box = new BrowserBox(nullptr,