1e5c31af7Sopenharmony_ci#ifndef _TEGLAPICASE_HPP
2e5c31af7Sopenharmony_ci#define _TEGLAPICASE_HPP
3e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
4e5c31af7Sopenharmony_ci * drawElements Quality Program EGL Module
5e5c31af7Sopenharmony_ci * ---------------------------------------
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
8e5c31af7Sopenharmony_ci *
9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
14e5c31af7Sopenharmony_ci *
15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
19e5c31af7Sopenharmony_ci * limitations under the License.
20e5c31af7Sopenharmony_ci *
21e5c31af7Sopenharmony_ci *//*!
22e5c31af7Sopenharmony_ci * \file
23e5c31af7Sopenharmony_ci * \brief API test case.
24e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "tcuDefs.hpp"
27e5c31af7Sopenharmony_ci#include "teglTestCase.hpp"
28e5c31af7Sopenharmony_ci#include "egluCallLogWrapper.hpp"
29e5c31af7Sopenharmony_ci#include "egluConfigFilter.hpp"
30e5c31af7Sopenharmony_ci#include "eglwEnums.hpp"
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_ci#include <vector>
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_cinamespace deqp
35e5c31af7Sopenharmony_ci{
36e5c31af7Sopenharmony_cinamespace egl
37e5c31af7Sopenharmony_ci{
38e5c31af7Sopenharmony_ci
39e5c31af7Sopenharmony_ciclass ApiCase : public TestCase, protected eglu::CallLogWrapper
40e5c31af7Sopenharmony_ci{
41e5c31af7Sopenharmony_cipublic:
42e5c31af7Sopenharmony_ci						ApiCase					(EglTestContext& eglTestCtx, const char* name, const char* description);
43e5c31af7Sopenharmony_ci	virtual				~ApiCase				(void);
44e5c31af7Sopenharmony_ci
45e5c31af7Sopenharmony_ci	void				init					(void);
46e5c31af7Sopenharmony_ci	void				deinit					(void);
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_ci	IterateResult		iterate					(void);
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ciprotected:
51e5c31af7Sopenharmony_ci	virtual void		test					(void) = DE_NULL;
52e5c31af7Sopenharmony_ci
53e5c31af7Sopenharmony_ci	void				expectError				(eglw::EGLenum error);
54e5c31af7Sopenharmony_ci	void				expectEitherError		(eglw::EGLenum errorA, eglw::EGLenum errorB);
55e5c31af7Sopenharmony_ci	void				expectBoolean			(eglw::EGLBoolean expected, eglw::EGLBoolean got);
56e5c31af7Sopenharmony_ci
57e5c31af7Sopenharmony_ci	void				expectNoContext			(eglw::EGLContext got);
58e5c31af7Sopenharmony_ci	void				expectNoSurface			(eglw::EGLSurface got);
59e5c31af7Sopenharmony_ci	void				expectNoDisplay			(eglw::EGLDisplay got);
60e5c31af7Sopenharmony_ci	void				expectNull				(const void* got);
61e5c31af7Sopenharmony_ci
62e5c31af7Sopenharmony_ci	inline void			expectTrue				(eglw::EGLBoolean got) { expectBoolean(EGL_TRUE, got); }
63e5c31af7Sopenharmony_ci	inline void			expectFalse				(eglw::EGLBoolean got) { expectBoolean(EGL_FALSE, got); }
64e5c31af7Sopenharmony_ci
65e5c31af7Sopenharmony_ci	eglw::EGLDisplay	getDisplay				(void)						{ return m_display;							}
66e5c31af7Sopenharmony_ci	bool				isAPISupported			(eglw::EGLenum api) const;
67e5c31af7Sopenharmony_ci	bool				getConfig				(eglw::EGLConfig* cfg, const eglu::FilterList& filters);
68e5c31af7Sopenharmony_ci
69e5c31af7Sopenharmony_ciprivate:
70e5c31af7Sopenharmony_ci	eglw::EGLDisplay							m_display;
71e5c31af7Sopenharmony_ci	std::vector<eglw::EGLenum>					m_supportedClientAPIs;
72e5c31af7Sopenharmony_ci};
73e5c31af7Sopenharmony_ci
74e5c31af7Sopenharmony_ci} // egl
75e5c31af7Sopenharmony_ci} // deqp
76e5c31af7Sopenharmony_ci
77e5c31af7Sopenharmony_ci// Helper macro for declaring ApiCases.
78e5c31af7Sopenharmony_ci#define TEGL_ADD_API_CASE(NAME, DESCRIPTION, TEST_FUNC_BODY)									\
79e5c31af7Sopenharmony_ci	do {																						\
80e5c31af7Sopenharmony_ci		class ApiCase_##NAME : public deqp::egl::ApiCase {										\
81e5c31af7Sopenharmony_ci		public:																					\
82e5c31af7Sopenharmony_ci			ApiCase_##NAME (EglTestContext& context) : ApiCase(context, #NAME, DESCRIPTION) {}	\
83e5c31af7Sopenharmony_ci		protected:																				\
84e5c31af7Sopenharmony_ci			void test (void) TEST_FUNC_BODY	 /* NOLINT(TEST_FUNC_BODY) */						\
85e5c31af7Sopenharmony_ci		};																						\
86e5c31af7Sopenharmony_ci		addChild(new ApiCase_##NAME(m_eglTestCtx));												\
87e5c31af7Sopenharmony_ci	} while (deGetFalse())
88e5c31af7Sopenharmony_ci
89e5c31af7Sopenharmony_ci#endif // _TEGLAPICASE_HPP
90