summaryrefslogtreecommitdiff
path: root/Tests/LibGL/TestAPI.cpp
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-06-04 00:19:15 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-04 22:25:16 +0100
commit971d6ce16f7ee87c1fdaf8a8cdeee286b4567aa1 (patch)
tree14eaf94795db97498af01fc564a933983d0bf802 /Tests/LibGL/TestAPI.cpp
parent2a171dfc384cde5d08871652ba11763fc90c7059 (diff)
downloadserenity-971d6ce16f7ee87c1fdaf8a8cdeee286b4567aa1.zip
LibGL: Reject GL_LEFT and GL_RIGHT in glCullFace
glCullFace only accepts GL_FRONT, GL_BACK and GL_FRONT_AND_BACK. We checked if the mode was valid by performing ``` cull_mode < GL_FRONT || cull_mode > GL_FRONT_AND_BACK ``` However, this range also contains GL_LEFT and GL_RIGHT, which we would accept when we should return a GL_INVALID_ENUM error.
Diffstat (limited to 'Tests/LibGL/TestAPI.cpp')
-rw-r--r--Tests/LibGL/TestAPI.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/LibGL/TestAPI.cpp b/Tests/LibGL/TestAPI.cpp
index c33ecf108f..7f717db686 100644
--- a/Tests/LibGL/TestAPI.cpp
+++ b/Tests/LibGL/TestAPI.cpp
@@ -40,3 +40,16 @@ TEST_CASE(0001_gl_gen_textures_does_not_return_the_same_texture_name_twice_unles
EXPECT_NE(texture1, texture2);
}
+
+TEST_CASE(0002_gl_cull_face_does_not_accept_left_and_right)
+{
+ auto context = create_testing_context();
+
+ // glCullFace only accepts GL_FRONT, GL_BACK and GL_FRONT_AND_BACK. We checked if the mode was valid by performing cull_mode < GL_FRONT || cull_mode > GL_FRONT_AND_BACK.
+ // However, this range also contains GL_LEFT and GL_RIGHT, which we would accept when we should return a GL_INVALID_ENUM error.
+ glCullFace(GL_LEFT);
+ EXPECT_EQ(glGetError(), static_cast<GLenum>(GL_INVALID_ENUM));
+
+ glCullFace(GL_RIGHT);
+ EXPECT_EQ(glGetError(), static_cast<GLenum>(GL_INVALID_ENUM));
+}