1#ifndef _TEGLAPICASE_HPP
2#define _TEGLAPICASE_HPP
3/*-------------------------------------------------------------------------
4 * drawElements Quality Program EGL 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 "teglTestCase.hpp"
28#include "egluCallLogWrapper.hpp"
29#include "tcuTestLog.hpp"
30#include "egluConfigFilter.hpp"
31
32namespace deqp
33{
34namespace egl
35{
36
37class ApiCase : public TestCase, protected eglu::CallLogWrapper
38{
39public:
40						ApiCase					(EglTestContext& eglTestCtx, const char* name, const char* description);
41	virtual				~ApiCase				(void);
42
43	IterateResult		iterate					(void);
44
45protected:
46	virtual void		test					(void) = DE_NULL;
47
48	void				expectError				(EGLenum error);
49	void				expectBoolean			(EGLBoolean expected, EGLBoolean got);
50
51	void				expectNoContext			(EGLContext got);
52	void				expectNoSurface			(EGLSurface got);
53	void				expectNoDisplay			(EGLDisplay got);
54	void				expectNull				(const void* got);
55
56	inline void			expectTrue				(EGLBoolean got) { expectBoolean(EGL_TRUE, got); }
57	inline void			expectFalse				(EGLBoolean got) { expectBoolean(EGL_FALSE, got); }
58
59	bool				isAPISupported			(EGLenum api) const	{ return m_eglTestCtx.isAPISupported(api);			}
60	EGLDisplay			getDisplay				(void)				{ return m_eglTestCtx.getDisplay().getEGLDisplay(); }
61	bool				getConfig				(EGLConfig* cfg, const eglu::FilterList& filters);
62};
63
64} // egl
65} // deqp
66
67// Helper macro for declaring ApiCases.
68#define TEGL_ADD_API_CASE(NAME, DESCRIPTION, TEST_FUNC_BODY)									\
69	do {																						\
70		class ApiCase_##NAME : public deqp::egl::ApiCase {										\
71		public:																					\
72			ApiCase_##NAME (EglTestContext& context) : ApiCase(context, #NAME, DESCRIPTION) {}	\
73		protected:																				\
74			void test (void) TEST_FUNC_BODY														\
75		};																						\
76		addChild(new ApiCase_##NAME(m_eglTestCtx));												\
77	} while (deGetFalse())
78
79#endif // _TEGLAPICASE_HPP
80