1 #define GTEST_HAS_EXCEPTIONS 0
5 #include <SDL2/SDL_error.h>
6 #include <SDL2/SDL_video.h>
9 #include <SDL/SDL_error.h>
10 #include <SDL/SDL_video.h>
15 #include "gtest/gtest.h"
17 int main(int argc, char **argv) {
18 // Set up an OpenGL context using SDL.
19 if (SDL_Init(SDL_INIT_VIDEO) == -1) {
20 fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
23 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
24 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
25 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
28 // You can uncomment this if you want to try a core context.
29 // For Mesa, you can get the same effect by doing
31 // export MESA_GL_VERSION_OVERRIDE=3.1FC
33 // before running tests.
34 // SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
35 // SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
36 // SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
38 // See also init.cpp for how to enable debugging.
39 // SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
41 SDL_Window *window = SDL_CreateWindow("OpenGL window for unit test",
42 SDL_WINDOWPOS_UNDEFINED,
43 SDL_WINDOWPOS_UNDEFINED,
46 SDL_GLContext context = SDL_GL_CreateContext(window);
47 assert(context != NULL);
49 SDL_SetVideoMode(32, 32, 0, SDL_OPENGL);
50 SDL_WM_SetCaption("OpenGL window for unit test", NULL);
53 testing::InitGoogleTest(&argc, argv);
54 int err = RUN_ALL_TESTS();