Home | History | Annotate | Download | only in functional
      1 #ifndef _ES2FAPICASE_HPP
      2 #define _ES2FAPICASE_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program OpenGL ES 2.0 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 API test case.
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "tcuDefs.hpp"
     27 #include "tes2TestCase.hpp"
     28 #include "gluCallLogWrapper.hpp"
     29 #include "tcuTestLog.hpp"
     30 
     31 namespace deqp
     32 {
     33 namespace gles2
     34 {
     35 namespace Functional
     36 {
     37 
     38 class ApiCase : public TestCase, protected glu::CallLogWrapper
     39 {
     40 public:
     41 						ApiCase					(Context& context, const char* name, const char* description);
     42 	virtual				~ApiCase				(void);
     43 
     44 	IterateResult		iterate					(void);
     45 
     46 protected:
     47 	virtual void		test					(void) = DE_NULL;
     48 
     49 	void				expectError				(deUint32 error);
     50 	void				expectError				(deUint32 error0, deUint32 error1);
     51 	void				getSupportedExtensions	(const deUint32 numSupportedValues, const deUint32 extension, std::vector<int>& values);
     52 	void				checkBooleans			(deUint8 value, deUint8 expected);
     53 
     54 	tcu::TestLog&		m_log;
     55 };
     56 
     57 // Helper macro for declaring ApiCases.
     58 #define ES2F_ADD_API_CASE(NAME, DESCRIPTION, TEST_FUNC_BODY)							\
     59 	do {																				\
     60 		class ApiCase_##NAME : public ApiCase {											\
     61 		public:																			\
     62 			ApiCase_##NAME (Context& context) : ApiCase(context, #NAME, DESCRIPTION) {}	\
     63 		protected:																		\
     64 			void test (void) TEST_FUNC_BODY												\
     65 		};																				\
     66 		addChild(new ApiCase_##NAME(m_context));										\
     67 	} while (deGetFalse())
     68 
     69 } // Functional
     70 } // gles2
     71 } // deqp
     72 
     73 #endif // _ES2FAPICASE_HPP
     74