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 API test case.
22 *//*--------------------------------------------------------------------*/
24 #include "es2fApiCase.hpp"
25 #include "gluStrUtil.hpp"
26 #include "gluRenderContext.hpp"
40 ApiCase::ApiCase (Context& context, const char* name, const char* description)
41 : TestCase (context, name, description)
42 , CallLogWrapper(context.getRenderContext().getFunctions(), context.getTestContext().getLog())
43 , m_log (context.getTestContext().getLog())
47 ApiCase::~ApiCase (void)
51 ApiCase::IterateResult ApiCase::iterate (void)
53 // Initialize result to pass.
54 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
56 // Enable call logging.
65 void ApiCase::expectError (deUint32 expected)
67 deUint32 err = glGetError();
70 m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: expected " << glu::getErrorStr(expected) << tcu::TestLog::EndMessage;
71 if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
72 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid error");
76 void ApiCase::expectError (deUint32 expected0, deUint32 expected1)
78 deUint32 err = glGetError();
79 if (err != expected0 && err != expected1)
81 m_log << tcu::TestLog::Message << "// ERROR: expected " << glu::getErrorStr(expected0) << " or " << glu::getErrorStr(expected1) << tcu::TestLog::EndMessage;
82 if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
83 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid error");
87 void ApiCase::checkBooleans (deUint8 value, deUint8 expected)
89 checkBooleans((deInt32)value, expected);
92 void ApiCase::checkBooleans (deInt32 value, deUint8 expected)
94 if (value != (deInt32)expected)
96 m_log << tcu::TestLog::Message << "// ERROR: expected " << (expected ? "GL_TRUE" : "GL_FALSE") << tcu::TestLog::EndMessage;
97 if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
98 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
102 void ApiCase::getSupportedExtensions (const deUint32 numSupportedValues, const deUint32 extension, std::vector<int>& values)
105 GLU_CHECK_CALL(glGetIntegerv(numSupportedValues, &numFormats));
108 m_testCtx.getLog() << tcu::TestLog::Message << "// No supported extensions available." << tcu::TestLog::EndMessage;
111 values.resize(numFormats);
112 GLU_CHECK_CALL(glGetIntegerv(extension, &values[0]));