summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox_unittest.cc
diff options
context:
space:
mode:
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,