1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 2.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Negative Fragment Pipe API tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es2fNegativeFragmentApiTests.hpp"
25 #include "es2fApiCase.hpp"
27 #include "glwEnums.hpp"
28 #include "glwDefs.hpp"
30 using namespace glw; // GL types
41 NegativeFragmentApiTests::NegativeFragmentApiTests (Context& context)
42 : TestCaseGroup(context, "fragment", "Negative Fragment API Cases")
46 NegativeFragmentApiTests::~NegativeFragmentApiTests (void)
50 void NegativeFragmentApiTests::init (void)
52 ES2F_ADD_API_CASE(scissor, "Invalid glScissor() usage",
54 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either width or height is negative.");
55 glScissor(0, 0, -1, 0);
56 expectError(GL_INVALID_VALUE);
57 glScissor(0, 0, 0, -1);
58 expectError(GL_INVALID_VALUE);
59 glScissor(0, 0, -1, -1);
60 expectError(GL_INVALID_VALUE);
61 m_log << TestLog::EndSection;
63 ES2F_ADD_API_CASE(depth_func, "Invalid glDepthFunc() usage",
65 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not an accepted value.");
67 expectError(GL_INVALID_ENUM);
68 m_log << TestLog::EndSection;
70 ES2F_ADD_API_CASE(viewport, "Invalid glViewport() usage",
72 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either width or height is negative.");
73 glViewport(0, 0, -1, 1);
74 expectError(GL_INVALID_VALUE);
75 glViewport(0, 0, 1, -1);
76 expectError(GL_INVALID_VALUE);
77 glViewport(0, 0, -1, -1);
78 expectError(GL_INVALID_VALUE);
79 m_log << TestLog::EndSection;
84 ES2F_ADD_API_CASE(stencil_func, "Invalid glStencilFunc() usage",
86 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
87 glStencilFunc(-1, 0, 1);
88 expectError(GL_INVALID_ENUM);
89 m_log << TestLog::EndSection;
91 ES2F_ADD_API_CASE(stencil_func_separate, "Invalid glStencilFuncSeparate() usage",
93 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
94 glStencilFuncSeparate(-1, GL_NEVER, 0, 1);
95 expectError(GL_INVALID_ENUM);
96 m_log << TestLog::EndSection;
98 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
99 glStencilFuncSeparate(GL_FRONT, -1, 0, 1);
100 expectError(GL_INVALID_ENUM);
101 m_log << TestLog::EndSection;
103 ES2F_ADD_API_CASE(stencil_op, "Invalid glStencilOp() usage",
105 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other than the eight defined symbolic constant values.");
106 glStencilOp(-1, GL_ZERO, GL_REPLACE);
107 expectError(GL_INVALID_ENUM);
108 glStencilOp(GL_KEEP, -1, GL_REPLACE);
109 expectError(GL_INVALID_ENUM);
110 glStencilOp(GL_KEEP, GL_ZERO, -1);
111 expectError(GL_INVALID_ENUM);
112 m_log << TestLog::EndSection;
114 ES2F_ADD_API_CASE(stencil_op_separate, "Invalid glStencilOpSeparate() usage",
116 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if face is any value other than GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
117 glStencilOpSeparate(-1, GL_KEEP, GL_ZERO, GL_REPLACE);
118 expectError(GL_INVALID_ENUM);
119 m_log << TestLog::EndSection;
121 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other than the eight defined symbolic constant values.");
122 glStencilOpSeparate(GL_FRONT, -1, GL_ZERO, GL_REPLACE);
123 expectError(GL_INVALID_ENUM);
124 glStencilOpSeparate(GL_FRONT, GL_KEEP, -1, GL_REPLACE);
125 expectError(GL_INVALID_ENUM);
126 glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_ZERO, -1);
127 expectError(GL_INVALID_ENUM);
128 m_log << TestLog::EndSection;
130 ES2F_ADD_API_CASE(stencil_mask_separate, "Invalid glStencilMaskSeparate() usage",
132 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
133 glStencilMaskSeparate(-1, 0);
134 expectError(GL_INVALID_ENUM);
135 m_log << TestLog::EndSection;
140 ES2F_ADD_API_CASE(blend_equation, "Invalid glBlendEquation() usage",
142 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not one of GL_FUNC_ADD, GL_FUNC_SUBTRACT, or GL_FUNC_REVERSE_SUBTRACT.");
144 expectError(GL_INVALID_ENUM);
145 m_log << TestLog::EndSection;
147 ES2F_ADD_API_CASE(blend_equation_separate, "Invalid glBlendEquationSeparate() usage",
149 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if either modeRGB or modeAlpha is not one of GL_FUNC_ADD, GL_FUNC_SUBTRACT, or GL_FUNC_REVERSE_SUBTRACT.");
150 glBlendEquationSeparate(-1, GL_FUNC_ADD);
151 expectError(GL_INVALID_ENUM);
152 glBlendEquationSeparate(GL_FUNC_ADD, -1);
153 expectError(GL_INVALID_ENUM);
154 m_log << TestLog::EndSection;
156 ES2F_ADD_API_CASE(blend_func_separate, "Invalid glBlendFuncSeparate() usage",
158 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
159 glBlendFuncSeparate(-1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
160 expectError(GL_INVALID_ENUM);
161 glBlendFuncSeparate(GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
162 expectError(GL_INVALID_ENUM);
163 glBlendFuncSeparate(GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
164 expectError(GL_INVALID_ENUM);
165 glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
166 expectError(GL_INVALID_ENUM);
167 m_log << TestLog::EndSection;
169 ES2F_ADD_API_CASE(blend_func, "Invalid glBlendFunc() usage",
171 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
172 glBlendFunc(-1, GL_ONE);
173 expectError(GL_INVALID_ENUM);
174 glBlendFunc(GL_ONE, -1);
175 expectError(GL_INVALID_ENUM);
176 m_log << TestLog::EndSection;
179 // Rasterization API functions
181 ES2F_ADD_API_CASE(cull_face, "Invalid glCullFace() usage",
183 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
185 expectError(GL_INVALID_ENUM);
186 m_log << TestLog::EndSection;
189 ES2F_ADD_API_CASE(front_face, "Invalid glFrontFace() usage",
191 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
193 expectError(GL_INVALID_ENUM);
194 m_log << TestLog::EndSection;
197 ES2F_ADD_API_CASE(line_width, "Invalid glLineWidth() usage",
199 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width is less than or equal to 0.");
201 expectError(GL_INVALID_VALUE);
203 expectError(GL_INVALID_VALUE);
204 m_log << TestLog::EndSection;