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 OpenGL ES 2.0 Test Case Wrapper.
22 *//*--------------------------------------------------------------------*/
24 #include "tes2TestCaseWrapper.hpp"
25 #include "tcuTestLog.hpp"
26 #include "gluDefs.hpp"
27 #include "gluStateReset.hpp"
28 #include "glwEnums.hpp"
29 #include "glwFunctions.hpp"
38 TestCaseWrapper::TestCaseWrapper (tcu::TestContext& testCtx, glu::RenderContext& renderCtx)
39 : tcu::TestCaseWrapper (testCtx)
40 , m_renderCtx (renderCtx)
42 TCU_CHECK(contextSupports(renderCtx.getType(), glu::ApiType::es(2,0)));
45 TestCaseWrapper::~TestCaseWrapper (void)
49 bool TestCaseWrapper::initTestCase (tcu::TestCase* testCase)
51 return tcu::TestCaseWrapper::initTestCase(testCase);
54 bool TestCaseWrapper::deinitTestCase (tcu::TestCase* testCase)
56 TestLog& log = m_testCtx.getLog();
58 if (!tcu::TestCaseWrapper::deinitTestCase(testCase))
64 glu::resetState(m_renderCtx);
66 catch (const std::exception& e)
69 log << TestLog::Message << "Error in state reset, test program will terminate." << TestLog::EndMessage;
76 tcu::TestNode::IterateResult TestCaseWrapper::iterateTestCase (tcu::TestCase* testCase)
78 TestLog& log = m_testCtx.getLog();
79 const glw::Functions& gl = m_renderCtx.getFunctions();
80 tcu::TestCase::IterateResult result = tcu::TestNode::STOP;
82 // Clear to surrender-blue
83 gl.clearColor(0.125f, 0.25f, 0.5f, 1.f);
84 gl.clear(GL_COLOR_BUFFER_BIT);
86 result = tcu::TestCaseWrapper::iterateTestCase(testCase);
88 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
91 m_renderCtx.postIterate();
94 catch (const tcu::ResourceError& e)
96 m_testCtx.getLog() << e;
97 m_testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
98 m_testCtx.setTerminateAfter(true);
99 return tcu::TestNode::STOP;
101 catch (const std::exception& e)
104 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
105 return tcu::TestNode::STOP;