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 "egluConfigFilter.hpp" 30 #include "eglwEnums.hpp" 31 32 #include <vector> 33 34 namespace deqp 35 { 36 namespace egl 37 { 38 39 class ApiCase : public TestCase, protected eglu::CallLogWrapper 40 { 41 public: 42 ApiCase (EglTestContext& eglTestCtx, const char* name, const char* description); 43 virtual ~ApiCase (void); 44 45 void init (void); 46 void deinit (void); 47 48 IterateResult iterate (void); 49 50 protected: 51 virtual void test (void) = DE_NULL; 52 53 void expectError (eglw::EGLenum error); 54 void expectEitherError (eglw::EGLenum errorA, eglw::EGLenum errorB); 55 void expectBoolean (eglw::EGLBoolean expected, eglw::EGLBoolean got); 56 57 void expectNoContext (eglw::EGLContext got); 58 void expectNoSurface (eglw::EGLSurface got); 59 void expectNoDisplay (eglw::EGLDisplay got); 60 void expectNull (const void* got); 61 expectTrue(eglw::EGLBoolean got)62 inline void expectTrue (eglw::EGLBoolean got) { expectBoolean(EGL_TRUE, got); } expectFalse(eglw::EGLBoolean got)63 inline void expectFalse (eglw::EGLBoolean got) { expectBoolean(EGL_FALSE, got); } 64 getDisplay(void)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); 68 69 private: 70 eglw::EGLDisplay m_display; 71 std::vector<eglw::EGLenum> m_supportedClientAPIs; 72 }; 73 74 } // egl 75 } // deqp 76 77 // Helper macro for declaring ApiCases. 78 #define TEGL_ADD_API_CASE(NAME, DESCRIPTION, TEST_FUNC_BODY) \ 79 do { \ 80 class ApiCase_##NAME : public deqp::egl::ApiCase { \ 81 public: \ 82 ApiCase_##NAME (EglTestContext& context) : ApiCase(context, #NAME, DESCRIPTION) {} \ 83 protected: \ 84 void test (void) TEST_FUNC_BODY /* NOLINT(TEST_FUNC_BODY) */ \ 85 }; \ 86 addChild(new ApiCase_##NAME(m_eglTestCtx)); \ 87 } while (deGetFalse()) 88 89 #endif // _TEGLAPICASE_HPP 90