1 // Copyright (C) 2018 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
15 #include "OpenGLTestContext.h"
16
17 #include <gtest/gtest.h>
18
19 namespace emugl {
20
TEST_F(GLTest,InitDestroy)21 TEST_F(GLTest, InitDestroy) {}
22
TEST_F(GLTest,SetUpMulticontext)23 TEST_F(GLTest, SetUpMulticontext) {
24 const EGLDispatch* egl = LazyLoadedEGLDispatch::get();
25 EXPECT_TRUE(egl != nullptr);
26 EXPECT_TRUE(gl != nullptr);
27
28 egl->eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
29 EGL_NO_CONTEXT);
30 EGLSurface duoSurface = pbufferSurface(
31 m_display, m_config, kTestSurfaceSize[0], kTestSurfaceSize[1]);
32 EGLContext duoContext = createContext(m_display, m_config, 3, 0);
33
34 egl->eglMakeCurrent(m_display, duoSurface, duoSurface, duoContext);
35 EXPECT_EQ(EGL_SUCCESS, egl->eglGetError());
36
37 destroyContext(m_display, duoContext);
38 destroySurface(m_display, duoSurface);
39
40 egl->eglMakeCurrent(m_display, m_surface, m_surface, m_context);
41 EXPECT_EQ(EGL_SUCCESS, egl->eglGetError());
42 }
43
44 } // namespace emugl
45