From 855387d2d795c9471587cc7ddf2c66bb676d698e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 Jan 2017 17:00:02 +0300 Subject: 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. --- src/maingui.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/maingui.cpp') 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 #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 -- cgit v1.2.3-60-g2f50