summaryrefslogtreecommitdiff
path: root/src/integrity_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-23 16:31:25 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-23 22:24:54 +0300
commitbb738bb468b1aafb9c6291b9d9e87e3711fa2ef7 (patch)
tree7c25e6541dd52b38ff08e86ac524f86d2956e655 /src/integrity_unittest.cc
parent03b3dd1a41fa3984ce794b1811ba929c975cfff0 (diff)
downloadplus-bb738bb468b1aafb9c6291b9d9e87e3711fa2ef7.tar.gz
plus-bb738bb468b1aafb9c6291b9d9e87e3711fa2ef7.tar.bz2
plus-bb738bb468b1aafb9c6291b9d9e87e3711fa2ef7.tar.xz
plus-bb738bb468b1aafb9c6291b9d9e87e3711fa2ef7.zip
Fix unit tests issues.
Diffstat (limited to 'src/integrity_unittest.cc')
-rw-r--r--src/integrity_unittest.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc
index 572cc29e6..e3e2a29cb 100644
--- a/src/integrity_unittest.cc
+++ b/src/integrity_unittest.cc
@@ -32,14 +32,15 @@
#include "resources/loaders/imageloader.h"
#include "resources/sdlimagehelper.h"
+#ifdef USE_SDL2
+#include "resources/surfaceimagehelper.h"
+#endif // USE_SDL2
#include "resources/resourcemanager/resourcemanager.h"
#include "utils/env.h"
#include "utils/physfsrwops.h"
-#include "utils/physfstools.h"
-#include <physfs.h>
#include <SDL_image.h>
#include "debug.h"
@@ -108,13 +109,16 @@ TEST_CASE("integrity tests", "integrity")
resourceManager->addToSearchPath("data", Append_false);
resourceManager->addToSearchPath("../data", Append_false);
- imageHelper = new SDLImageHelper();
#ifdef USE_SDL2
+ imageHelper = new SurfaceImageHelper;
+
SDLImageHelper::setRenderer(graphicsManager.createRenderer(
graphicsManager.createWindow(640, 480, 0,
SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE));
#else // USE_SDL2
+ imageHelper = new SDLImageHelper();
+
graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
#endif // USE_SDL2
@@ -207,8 +211,12 @@ TEST_CASE("integrity tests", "integrity")
SECTION("integrity Loader::getImage test 2")
{
+ resourceManager->addToSearchPath("data/test/test.zip", Append_false);
+ resourceManager->addToSearchPath("../data/test/test.zip", Append_false);
Image *const image = Loader::getImage(
"hide.png");
+ resourceManager->removeFromSearchPath("data/test/test.zip");
+ resourceManager->removeFromSearchPath("../data/test/test.zip");
REQUIRE(image != nullptr);
REQUIRE(image->getSDLSurface() != nullptr);
image->decRef();
@@ -290,7 +298,7 @@ TEST_CASE("integrity tests", "integrity")
CAST_U32(size1));
if (rc != static_cast<PHYSFS_sint64>(size1))
{
- logger->log("PHYSFS_read %d bytes", rc);
+ logger->log("PHYSFS_read %d bytes", static_cast<int>(rc));
if (!PHYSFS_eof(handle))
{
logger->log("PhysicsFS read error: %s",