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