summaryrefslogtreecommitdiff
path: root/src/maingui.cpp
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/maingui.cpp
parent9fefb2942865846ccb7dbdac4ebd4515b8c851a2 (diff)
downloadmanaplus-855387d2d795c9471587cc7ddf2c66bb676d698e.tar.gz
manaplus-855387d2d795c9471587cc7ddf2c66bb676d698e.tar.bz2
manaplus-855387d2d795c9471587cc7ddf2c66bb676d698e.tar.xz
manaplus-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/maingui.cpp')
-rw-r--r--src/maingui.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/maingui.cpp b/src/maingui.cpp
index e3e7012fd..7f4e1950f 100644
--- a/src/maingui.cpp
+++ b/src/maingui.cpp
@@ -49,6 +49,12 @@
#error missing <SDL_version.h>
#endif // SDL_VERSIONNUM
+#ifdef UNITTESTS
+//#define CATCH_CONFIG_MAIN
+#define CATCH_CONFIG_RUNNER
+#include "catch.hpp"
+#endif // UNITTESTS
+
#define SDL_IMAGE_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, \
SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL)
@@ -135,4 +141,12 @@ int mainGui(int argc, char *argv[])
return ret;
}
+#else // UNITTESTS
+
+int main(int argc, char *argv[])
+{
+ PhysFs::init(argv[0]);
+ return Catch::Session().run(argc, argv);
+}
+
#endif // UNITTESTS