1 #ifndef _TEGLAPICASE_HPP
2 #define _TEGLAPICASE_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program EGL Module
5 * ---------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief API test case.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "teglTestCase.hpp"
28 #include "egluCallLogWrapper.hpp"
29 #include "egluConfigFilter.hpp"
30 #include "eglwEnums.hpp"
39 class ApiCase : public TestCase, protected eglu::CallLogWrapper
42 ApiCase (EglTestContext& eglTestCtx, const char* name, const char* description);
43 virtual ~ApiCase (void);
48 IterateResult iterate (void);
51 virtual void test (void) = DE_NULL;
53 void expectError (eglw::EGLenum error);
54 void expectEitherError (eglw::EGLenum errorA, eglw::EGLenum errorB);
55 void expectBoolean (eglw::EGLBoolean expected, eglw::EGLBoolean got);
57 void expectNoContext (eglw::EGLContext got);
58 void expectNoSurface (eglw::EGLSurface got);
59 void expectNoDisplay (eglw::EGLDisplay got);
60 void expectNull (const void* got);
62 inline void expectTrue (eglw::EGLBoolean got) { expectBoolean(EGL_TRUE, got); }
63 inline void expectFalse (eglw::EGLBoolean got) { expectBoolean(EGL_FALSE, got); }
65 eglw::EGLDisplay getDisplay (void) { return m_display; }
66 bool isAPISupported (eglw::EGLenum api) const;
67 bool getConfig (eglw::EGLConfig* cfg, const eglu::FilterList& filters);
70 eglw::EGLDisplay m_display;
71 std::vector<eglw::EGLenum> m_supportedClientAPIs;
77 // Helper macro for declaring ApiCases.
78 #define TEGL_ADD_API_CASE(NAME, DESCRIPTION, TEST_FUNC_BODY) \
80 class ApiCase_##NAME : public deqp::egl::ApiCase { \
82 ApiCase_##NAME (EglTestContext& context) : ApiCase(context, #NAME, DESCRIPTION) {} \
84 void test (void) TEST_FUNC_BODY /* NOLINT(TEST_FUNC_BODY) */ \
86 addChild(new ApiCase_##NAME(m_eglTestCtx)); \
87 } while (deGetFalse())
89 #endif // _TEGLAPICASE_HPP