summaryrefslogtreecommitdiff
path: root/test/test-glContextBhvr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-glContextBhvr.cpp')
-rw-r--r--test/test-glContextBhvr.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/test/test-glContextBhvr.cpp b/test/test-glContextBhvr.cpp
index ec5cc21..e4b20e1 100644
--- a/test/test-glContextBhvr.cpp
+++ b/test/test-glContextBhvr.cpp
@@ -11,35 +11,39 @@ BOOST_GLOBAL_FIXTURE(ApplicationBase);
#define TEST_WINDOW_PARAMS __FILE__, 0, 0, 640, 480, static_cast<Uint32>(SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN)
-static void
-CreateProgramTest()
-{
- const ProgramRef p;
- BOOST_REQUIRE(p);
+namespace {
+ void
+ createProgramTest()
+ {
+ const ProgramRef prog;
+ BOOST_REQUIRE(prog);
+ }
}
-BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour1)
+BOOST_AUTO_TEST_CASE(WindowContextThingsBehaviour1)
{
BOOST_REQUIRE(!glCreateProgram); // Init not called yet
{
const SDL_WindowPtr window {TEST_WINDOW_PARAMS};
BOOST_REQUIRE(window);
BOOST_REQUIRE(!glCreateProgram);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
BOOST_REQUIRE_EQUAL(gladLoadGL(reinterpret_cast<GLADloadfunc>(SDL_GL_GetProcAddress)), 0); // No context yet
{
const SDL_GLContextPtr context {window};
BOOST_REQUIRE(context);
BOOST_REQUIRE(!glCreateProgram);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
BOOST_REQUIRE_GT(gladLoadGL(reinterpret_cast<GLADloadfunc>(SDL_GL_GetProcAddress)), 0);
BOOST_REQUIRE(glCreateProgram);
- CreateProgramTest();
+ createProgramTest();
} // Context destroyed
BOOST_REQUIRE(glCreateProgram); // Functions still set
- BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get fails with no context
+ BOOST_REQUIRE_THROW({ const ProgramRef prog; }, std::exception); // Get fails with no context
{
const SDL_GLContextPtr context {window};
BOOST_REQUIRE(context);
- CreateProgramTest();
+ createProgramTest();
}
}
{
@@ -47,11 +51,11 @@ BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour1)
BOOST_REQUIRE(window);
const SDL_GLContextPtr context {window};
BOOST_REQUIRE(context);
- CreateProgramTest();
+ createProgramTest();
}
}
-BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour2)
+BOOST_AUTO_TEST_CASE(WindowContextThingsBehaviour2)
{
const SDL_WindowPtr window1 {TEST_WINDOW_PARAMS};
BOOST_REQUIRE(window1);
@@ -60,12 +64,12 @@ BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour2)
BOOST_REQUIRE(window2);
const SDL_GLContextPtr context {window2};
BOOST_REQUIRE(context);
- CreateProgramTest();
+ createProgramTest();
}
- BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get fails with no context
+ BOOST_REQUIRE_THROW({ const ProgramRef prog; }, std::exception); // Get fails with no context
}
-BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour3)
+BOOST_AUTO_TEST_CASE(WindowContextThingsBehaviour3)
{
std::optional<SDL_WindowPtr> window1 {std::in_place, TEST_WINDOW_PARAMS};
const std::optional<SDL_WindowPtr> window2 {std::in_place, TEST_WINDOW_PARAMS};
@@ -73,11 +77,11 @@ BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour3)
BOOST_REQUIRE(window1.value());
const SDL_GLContextPtr context {window1.value()};
BOOST_REQUIRE(context);
- CreateProgramTest();
+ createProgramTest();
window1.reset();
- BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get fails with context's window gone
+ BOOST_REQUIRE_THROW({ const ProgramRef prog; }, std::exception); // Get fails with context's window gone
window1.emplace(TEST_WINDOW_PARAMS);
BOOST_REQUIRE(window1);
BOOST_REQUIRE(window1.value());
- BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get still fails with context's window gone
+ BOOST_REQUIRE_THROW({ const ProgramRef prog; }, std::exception); // Get still fails with context's window gone
}