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 	void				checkBooleans			(deInt32 value, deUint8 expected);
54 
55 	tcu::TestLog&		m_log;
56 };
57 
58 // Helper macro for declaring ApiCases.
59 #define ES2F_ADD_API_CASE(NAME, DESCRIPTION, TEST_FUNC_BODY)							\
60 	do {																				\
61 		class ApiCase_##NAME : public ApiCase {											\
62 		public:																			\
63 			ApiCase_##NAME (Context& context) : ApiCase(context, #NAME, DESCRIPTION) {}	\
64 		protected:																		\
65 			void test (void) TEST_FUNC_BODY												\
66 		};																				\
67 		addChild(new ApiCase_##NAME(m_context));										\
68 	} while (deGetFalse())
69 
70 } // Functional
71 } // gles2
72 } // deqp
73 
74 #endif // _ES2FAPICASE_HPP
75