1 // Copyright (C) 2017 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #pragma once 15 16 #include "OpenGLESDispatch/OpenGLDispatchLoader.h" 17 18 // gtest has its own definitions for None and Bool 19 #ifdef None 20 #undef None 21 #endif 22 #ifdef Bool 23 #undef Bool 24 #endif 25 #include <gtest/gtest.h> 26 27 #include <EGL/egl.h> 28 #include <GLES2/gl2.h> 29 #include <GLES3/gl31.h> 30 31 namespace emugl { 32 33 // Dimensions for test surface 34 static const int kTestSurfaceSize[] = {32, 32}; 35 36 EGLDisplay getDisplay(); 37 EGLConfig createConfig(EGLDisplay dpy, EGLint r, EGLint g, EGLint b, EGLint a, EGLint d, EGLint s, EGLint ms); 38 EGLSurface pbufferSurface(EGLDisplay dpy, ::EGLConfig config, EGLint w, EGLint h); 39 EGLContext createContext(EGLDisplay dpy, EGLConfig config, EGLint maj, EGLint min); 40 void destroyContext(EGLDisplay dpy, EGLContext cxt); 41 void destroySurface(EGLDisplay dpy, EGLSurface surface); 42 void destroyDisplay(EGLDisplay dpy); 43 44 class GLTest : public ::testing::Test { 45 protected: 46 virtual void SetUp(); 47 virtual void TearDown(); 48 49 const GLESv2Dispatch* gl; 50 EGLDisplay m_display; 51 EGLConfig m_config; 52 EGLSurface m_surface; 53 EGLContext m_context; 54 }; 55 56 } // namespace emugl 57