summaryrefslogtreecommitdiff
path: root/test/testMainWindow.cpp
blob: 4a76044b8e3ca24d9ee3d4807b63a769e1bfc671 (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
26
#include "testMainWindow.h"
#include <boost/test/test_tools.hpp>
#include <format>

TestMainWindow::TestMainWindow() : MainWindow {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 = std::format("GL CALLBACK: {} type = 0x{:x}, severity = 0x{:x}, message = {}",
						(type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), type, severity, message);
				switch (type) {
					case GL_DEBUG_TYPE_ERROR:
					case GL_DEBUG_TYPE_PORTABILITY:
					case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
					case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
						BOOST_TEST_ERROR(msg);
					case GL_DEBUG_TYPE_PERFORMANCE:
						BOOST_TEST_WARN(msg.c_str());
					default:
						BOOST_TEST_MESSAGE(msg);
				}
			},
			nullptr);
}