]> git.sesse.net Git - movit/blobdiff - gtest_sdl_main.cpp
Explicitly declare use of round() as an #extension.
[movit] / gtest_sdl_main.cpp
index 01eedf2a09bf5e326d931821eeb65d2f7a716589..39027e6be3246f75fae37a09d333859920ff539b 100644 (file)
@@ -1,15 +1,27 @@
+#define GTEST_HAS_EXCEPTIONS 0
+
 #include <SDL/SDL.h>
+#include <SDL/SDL_error.h>
+#include <SDL/SDL_video.h>
+#include <stdio.h>
+#include <stdlib.h>
+
 #include "gtest/gtest.h"
 
 int main(int argc, char **argv) {
        // Set up an OpenGL context using SDL.
-       SDL_Init(SDL_INIT_VIDEO);
+       if (SDL_Init(SDL_INIT_VIDEO) == -1) {
+               fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
+               exit(1);
+       }
        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
        SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
        SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-       SDL_SetVideoMode(1280, 720, 0, SDL_OPENGL);
+       SDL_SetVideoMode(32, 32, 0, SDL_OPENGL);
        SDL_WM_SetCaption("OpenGL window for unit test", NULL);
 
        testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
+       int err = RUN_ALL_TESTS();
+       SDL_Quit();
+       exit(err);
 }