1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.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 "es3fApiCase.hpp"
25 #include "gluStrUtil.hpp"
26 #include "gluRenderContext.hpp"
42 ApiCase::ApiCase (Context& context, const char* name, const char* description)
43 : TestCase (context, name, description)
44 , CallLogWrapper(context.getRenderContext().getFunctions(), context.getTestContext().getLog())
49 ApiCase::~ApiCase (void)
53 ApiCase::IterateResult ApiCase::iterate (void)
55 // Initialize result to pass.
56 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
58 // Enable call logging.
67 void ApiCase::expectError (deUint32 expected)
69 deUint32 err = glGetError();
72 m_log << TestLog::Message << "// ERROR: expected " << glu::getErrorStr(expected) << TestLog::EndMessage;
73 if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
74 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid error");
78 void ApiCase::expectError (deUint32 expected0, deUint32 expected1)
80 deUint32 err = glGetError();
81 if (err != expected0 && err != expected1)
83 m_log << TestLog::Message << "// ERROR: expected " << glu::getErrorStr(expected0) << " or " << glu::getErrorStr(expected1) << TestLog::EndMessage;
84 if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
85 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid error");
89 void ApiCase::checkBooleans (deUint8 value, deUint8 expected)
91 checkBooleans((deInt32)value, expected);
94 void ApiCase::checkBooleans (deInt32 value, deUint8 expected)
96 if (value != (deInt32)expected)
98 m_log << TestLog::Message << "// ERROR: expected " << (expected ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
99 if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
100 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
104 void ApiCase::getSupportedExtensions (const deUint32 numSupportedValues, const deUint32 extension, std::vector<int>& values)
107 GLU_CHECK_CALL(glGetIntegerv(numSupportedValues, &numFormats));
110 m_log << TestLog::Message << "// No supported extensions available." << TestLog::EndMessage;
113 values.resize(numFormats);
114 GLU_CHECK_CALL(glGetIntegerv(extension, &values[0]));