1 #include "GLTraitsTest.hpp"
3 #include "graphics/gl_traits.hpp"
5 CPPUNIT_TEST_SUITE_REGISTRATION(gong::graphics::test::GLTraitsTest);
12 void GLTraitsTest::setUp() {
16 void GLTraitsTest::tearDown() {
21 void GLTraitsTest::testSize() {
22 CPPUNIT_ASSERT_EQUAL_MESSAGE(
23 "bad number of components for byte",
24 1, gl_traits<signed char>::size
26 CPPUNIT_ASSERT_EQUAL_MESSAGE(
27 "bad number of components for ubyte",
28 1, gl_traits<unsigned char>::size
30 CPPUNIT_ASSERT_EQUAL_MESSAGE(
31 "bad number of components for short",
32 1, gl_traits<short>::size
34 CPPUNIT_ASSERT_EQUAL_MESSAGE(
35 "bad number of components for ushort",
36 1, gl_traits<unsigned short>::size
38 CPPUNIT_ASSERT_EQUAL_MESSAGE(
39 "bad number of components for int",
40 1, gl_traits<int>::size
42 CPPUNIT_ASSERT_EQUAL_MESSAGE(
43 "bad number of components for uint",
44 1, gl_traits<unsigned int>::size
46 CPPUNIT_ASSERT_EQUAL_MESSAGE(
47 "bad number of components for float",
48 1, gl_traits<float>::size
50 CPPUNIT_ASSERT_EQUAL_MESSAGE(
51 "bad number of components for double",
52 1, gl_traits<double>::size
55 CPPUNIT_ASSERT_EQUAL_MESSAGE(
56 "bad number of components for vec2",
57 2, gl_traits<glm::vec2>::size
59 CPPUNIT_ASSERT_EQUAL_MESSAGE(
60 "bad number of components for vec3",
61 3, gl_traits<glm::vec3>::size
63 CPPUNIT_ASSERT_EQUAL_MESSAGE(
64 "bad number of components for vec4",
65 4, gl_traits<glm::vec4>::size
68 CPPUNIT_ASSERT_EQUAL_MESSAGE(
69 "bad number of components for vec2i",
70 2, gl_traits<glm::ivec2>::size
72 CPPUNIT_ASSERT_EQUAL_MESSAGE(
73 "bad number of components for vec3i",
74 3, gl_traits<glm::ivec3>::size
76 CPPUNIT_ASSERT_EQUAL_MESSAGE(
77 "bad number of components for vec4i",
78 4, gl_traits<glm::ivec4>::size
82 void GLTraitsTest::testType() {
83 CPPUNIT_ASSERT_EQUAL_MESSAGE(
84 "bad component type for byte",
85 GLenum(GL_BYTE), gl_traits<signed char>::type
87 CPPUNIT_ASSERT_EQUAL_MESSAGE(
88 "bad component type for ubyte",
89 GLenum(GL_UNSIGNED_BYTE), gl_traits<unsigned char>::type
91 CPPUNIT_ASSERT_EQUAL_MESSAGE(
92 "bad component type for short",
93 GLenum(GL_SHORT), gl_traits<short>::type
95 CPPUNIT_ASSERT_EQUAL_MESSAGE(
96 "bad component type for ushort",
97 GLenum(GL_UNSIGNED_SHORT), gl_traits<unsigned short>::type
99 CPPUNIT_ASSERT_EQUAL_MESSAGE(
100 "bad component type for int",
101 GLenum(GL_INT), gl_traits<int>::type
103 CPPUNIT_ASSERT_EQUAL_MESSAGE(
104 "bad component type for uint",
105 GLenum(GL_UNSIGNED_INT), gl_traits<unsigned int>::type
107 CPPUNIT_ASSERT_EQUAL_MESSAGE(
108 "bad component type for float",
109 GLenum(GL_FLOAT), gl_traits<float>::type
111 CPPUNIT_ASSERT_EQUAL_MESSAGE(
112 "bad component type for double",
113 GLenum(GL_DOUBLE), gl_traits<double>::type
116 CPPUNIT_ASSERT_EQUAL_MESSAGE(
117 "bad component type for vec2",
118 GLenum(GL_FLOAT), gl_traits<glm::vec2>::type
120 CPPUNIT_ASSERT_EQUAL_MESSAGE(
121 "bad component type for vec3",
122 GLenum(GL_FLOAT), gl_traits<glm::vec3>::type
124 CPPUNIT_ASSERT_EQUAL_MESSAGE(
125 "bad component type for vec4",
126 GLenum(GL_FLOAT), gl_traits<glm::vec4>::type
129 CPPUNIT_ASSERT_EQUAL_MESSAGE(
130 "bad component type for vec2i",
131 GLenum(GL_INT), gl_traits<glm::ivec2>::type
133 CPPUNIT_ASSERT_EQUAL_MESSAGE(
134 "bad component type for vec3i",
135 GLenum(GL_INT), gl_traits<glm::ivec3>::type
137 CPPUNIT_ASSERT_EQUAL_MESSAGE(
138 "bad component type for vec4i",
139 GLenum(GL_INT), gl_traits<glm::ivec4>::type