summaryrefslogtreecommitdiff
path: root/test/test-glContextBhvr.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-01-08 16:34:43 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-01-08 16:34:43 +0000
commit8cd0977a3688fa705c83867c57505a47b9269369 (patch)
treeb7b48711051299607077ed31fdf3b3f6dd6cc41f /test/test-glContextBhvr.cpp
parentTidy shadow map creation (diff)
downloadilt-8cd0977a3688fa705c83867c57505a47b9269369.tar.bz2
ilt-8cd0977a3688fa705c83867c57505a47b9269369.tar.xz
ilt-8cd0977a3688fa705c83867c57505a47b9269369.zip
Fix up all the static analyzer warnings
Diffstat (limited to 'test/test-glContextBhvr.cpp')
-rw-r--r--test/test-glContextBhvr.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/test-glContextBhvr.cpp b/test/test-glContextBhvr.cpp
index b37a072..9716f54 100644
--- a/test/test-glContextBhvr.cpp
+++ b/test/test-glContextBhvr.cpp
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE test_glcontextbehaviour
-#include "test-helpers.hpp"
+#include "testHelpers.h"
#include <boost/test/unit_test.hpp>
#include <gfx/gl/sceneRenderer.h>
@@ -10,23 +10,23 @@
BOOST_GLOBAL_FIXTURE(ApplicationBase);
-#define TEST_WINDOW_PARAMS __FILE__, 0, 0, 640, 480, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN
+#define TEST_WINDOW_PARAMS __FILE__, 0, 0, 640, 480, static_cast<Uint32>(SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN)
static void
CreateProgramTest()
{
- ProgramRef p;
+ const ProgramRef p;
BOOST_REQUIRE(p);
}
BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour1)
{
BOOST_REQUIRE(!glCreateProgram); // Init not called yet
{
- SDL_WindowPtr window {TEST_WINDOW_PARAMS};
+ const SDL_WindowPtr window {TEST_WINDOW_PARAMS};
BOOST_REQUIRE(window);
BOOST_REQUIRE(!glCreateProgram);
BOOST_REQUIRE_NE(glewInit(), GLEW_OK); // No context yet
{
- SDL_GLContextPtr context {window};
+ const SDL_GLContextPtr context {window};
BOOST_REQUIRE(context);
BOOST_REQUIRE(!glCreateProgram);
BOOST_REQUIRE_EQUAL(glewInit(), GLEW_OK);
@@ -34,17 +34,17 @@ BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour1)
CreateProgramTest();
} // Context destroyed
BOOST_REQUIRE(glCreateProgram); // Functions still set
- BOOST_REQUIRE_THROW({ ProgramRef p; }, std::exception); // Get fails with no context
+ BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get fails with no context
{
- SDL_GLContextPtr context {window};
+ const SDL_GLContextPtr context {window};
BOOST_REQUIRE(context);
CreateProgramTest();
}
}
{
- SDL_WindowPtr window {TEST_WINDOW_PARAMS};
+ const SDL_WindowPtr window {TEST_WINDOW_PARAMS};
BOOST_REQUIRE(window);
- SDL_GLContextPtr context {window};
+ const SDL_GLContextPtr context {window};
BOOST_REQUIRE(context);
CreateProgramTest();
}
@@ -52,31 +52,31 @@ BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour1)
BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour2)
{
- SDL_WindowPtr window1 {TEST_WINDOW_PARAMS};
+ const SDL_WindowPtr window1 {TEST_WINDOW_PARAMS};
BOOST_REQUIRE(window1);
{
- SDL_WindowPtr window2 {TEST_WINDOW_PARAMS};
+ const SDL_WindowPtr window2 {TEST_WINDOW_PARAMS};
BOOST_REQUIRE(window2);
- SDL_GLContextPtr context {window2};
+ const SDL_GLContextPtr context {window2};
BOOST_REQUIRE(context);
CreateProgramTest();
}
- BOOST_REQUIRE_THROW({ ProgramRef p; }, std::exception); // Get fails with no context
+ BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get fails with no context
}
BOOST_AUTO_TEST_CASE(windowContextThingsBehaviour3)
{
std::optional<SDL_WindowPtr> window1 {std::in_place, TEST_WINDOW_PARAMS};
- std::optional<SDL_WindowPtr> window2 {std::in_place, TEST_WINDOW_PARAMS};
+ const std::optional<SDL_WindowPtr> window2 {std::in_place, TEST_WINDOW_PARAMS};
BOOST_REQUIRE(window1);
BOOST_REQUIRE(window1.value());
- SDL_GLContextPtr context {window1.value()};
+ const SDL_GLContextPtr context {window1.value()};
BOOST_REQUIRE(context);
CreateProgramTest();
window1.reset();
- BOOST_REQUIRE_THROW({ ProgramRef p; }, std::exception); // Get fails with context's window gone
+ BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get fails with context's window gone
window1.emplace(TEST_WINDOW_PARAMS);
BOOST_REQUIRE(window1);
BOOST_REQUIRE(window1.value());
- BOOST_REQUIRE_THROW({ ProgramRef p; }, std::exception); // Get still fails with context's window gone
+ BOOST_REQUIRE_THROW({ const ProgramRef p; }, std::exception); // Get still fails with context's window gone
}