Home | History | Annotate | Download | only in functional
      1 #ifndef _ES31FNEGATIVETESTSHARED_HPP
      2 #define _ES31FNEGATIVETESTSHARED_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program OpenGL ES 3.1 Module
      5  * -------------------------------------------------
      6  *
      7  * Copyright 2014 The Android Open Source Project
      8  *
      9  * Licensed under the Apache License, Version 2.0 (the "License");
     10  * you may not use this file except in compliance with the License.
     11  * You may obtain a copy of the License at
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     15  * Unless required by applicable law or agreed to in writing, software
     16  * distributed under the License is distributed on an "AS IS" BASIS,
     17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18  * See the License for the specific language governing permissions and
     19  * limitations under the License.
     20  *
     21  *//*!
     22  * \file
     23  * \brief Shared structures for ES 3.1 negative API tests
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "tcuDefs.hpp"
     27 #include "glwDefs.hpp"
     28 #include "gluCallLogWrapper.hpp"
     29 #include "tes31TestCase.hpp"
     30 
     31 namespace deqp
     32 {
     33 namespace gles31
     34 {
     35 namespace Functional
     36 {
     37 namespace NegativeTestShared
     38 {
     39 
     40 class ErrorCase : public TestCase
     41 {
     42 public:
     43 								ErrorCase		(Context& ctx, const char* name, const char* desc);
     44 	virtual 					~ErrorCase		(void) {}
     45 
     46 	virtual void				expectMessage	(glw::GLenum source, glw::GLenum type) = 0;
     47 	virtual void				expectError		(glw::GLenum error0, glw::GLenum error1) = 0;
     48 };
     49 
     50 class NegativeTestContext : public glu::CallLogWrapper
     51 {
     52 public:
     53 								NegativeTestContext		(ErrorCase& host, glu::RenderContext& renderCtx, const glu::ContextInfo& ctxInfo, tcu::TestLog& log, tcu::ResultCollector& results, bool enableLog);
     54 								~NegativeTestContext	();
     55 
     56 	const tcu::ResultCollector&	getResults				(void) const;
     57 
     58 	void						fail					(const std::string& msg);
     59 	int							getInteger				(glw::GLenum pname) const;
     60 	const glu::RenderContext&	getRenderContext		(void) const { return m_renderCtx; }
     61 	const glu::ContextInfo& 	getContextInfo			(void) const { return m_ctxInfo; }
     62 	void						beginSection			(const std::string& desc);
     63 	void						endSection				(void);
     64 
     65 	void						expectMessage			(glw::GLenum source, glw::GLenum type);
     66 	void						expectError				(glw::GLenum error);
     67 	void						expectError				(glw::GLenum error0, glw::GLenum error1);
     68 
     69 private:
     70 	glu::RenderContext&			m_renderCtx;
     71 	const glu::ContextInfo& 	m_ctxInfo;
     72 	ErrorCase&					m_host;
     73 	tcu::ResultCollector&		m_results;
     74 	int							m_openSections;
     75 };
     76 
     77 typedef void (*TestFunc)(NegativeTestContext& ctx);
     78 
     79 struct FunctionContainer
     80 {
     81 	TestFunc	function;
     82 	const char* name;
     83 	const char* desc;
     84 };
     85 
     86 } // NegativeTestShared
     87 } // Functional
     88 } // gles31
     89 } // deqp
     90 
     91 #endif // _ES31FNEGATIVETESTSHARED_HPP
     92