summaryrefslogtreecommitdiff
path: root/test/testMainWindow.cpp
blob: 49e18f12dd6fef2abb12d9c1f90c425ca5ccf0a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "testMainWindow.h"
#include "testHelpers.h"
#include <boost/test/test_tools.hpp>

TestMainWindow::TestMainWindow() : Window {1, 1, __FILE__, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN}
{
	glEnable(GL_DEBUG_OUTPUT);
	glDebugMessageCallback(
			[](GLenum /*source*/, GLenum type, GLuint /*id*/, GLenum severity, GLsizei /*length*/,
					const GLchar * message, const void *) {
				const auto msg = uasprintf("GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s",
						(type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), type, severity, message);
				switch (type) {
					case GL_DEBUG_TYPE_ERROR:
					case GL_DEBUG_TYPE_PERFORMANCE:
					case GL_DEBUG_TYPE_PORTABILITY:
					case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
					case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
						BOOST_TEST_ERROR(msg.get());
					default:
						BOOST_TEST_MESSAGE(msg.get());
				}
			},
			nullptr);
}