src/third_party/angle/src/tests/gl_tests/PixmapTest.cpp
// Test clearing a Pixmap and checking the color is correct
Test clearing a Pixmap and checking the color is correct
Test clearing a Pixmap and checking the color is correct
TEST_P(PixmapTest, Clearing)
{
    ANGLE_SKIP_TEST_IF(!mSupportsPixmaps);
    EGLWindow *window = getEGLWindow();
    window->makeCurrent();
    ASSERT_EGL_SUCCESS();
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    ASSERT_GL_NO_ERROR();
    EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 255, 255);
    eglMakeCurrent(window->getDisplay(), mPixmap, mPixmap, window->getContext());
    ASSERT_EGL_SUCCESS();
    glViewport(0, 0, static_cast<GLsizei>(mPixmapSize), static_cast<GLsizei>(mPixmapSize));
    glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    ASSERT_GL_NO_ERROR();
    EXPECT_PIXEL_EQ(static_cast<GLint>(mPixmapSize) / 2, static_cast<GLint>(mPixmapSize) / 2, 255,
                    0, 255, 255);
    window->makeCurrent();
    ASSERT_EGL_SUCCESS();
    EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 255, 255);
}
TEST_P ( PixmapTest , Clearing ) { ANGLE_SKIP_TEST_IF ( ! mSupportsPixmaps ) ; EGLWindow * window = getEGLWindow ( ) ; window -> makeCurrent ( ) ; ASSERT_EGL_SUCCESS ( ) ; glClearColor ( 0.0f , 0.0f , 1.0f , 1.0f ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_PIXEL_EQ ( getWindowWidth ( ) / 2 , getWindowHeight ( ) / 2 , 0 , 0 , 255 , 255 ) ; eglMakeCurrent ( window -> getDisplay ( ) , mPixmap , mPixmap , window -> getContext ( ) ) ; ASSERT_EGL_SUCCESS ( ) ; glViewport ( 0 , 0 , static_cast < GLsizei > ( mPixmapSize ) , static_cast < GLsizei > ( mPixmapSize ) ) ; glClearColor ( 1.0f , 0.0f , 1.0f , 1.0f ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_PIXEL_EQ ( static_cast < GLint > ( mPixmapSize ) / 2 , static_cast < GLint > ( mPixmapSize ) / 2 , 255 , 0 , 255 , 255 ) ; window -> makeCurrent ( ) ; ASSERT_EGL_SUCCESS ( ) ; EXPECT_PIXEL_EQ ( getWindowWidth ( ) / 2 , getWindowHeight ( ) / 2 , 0 , 0 , 255 , 255 ) ; }
Test clearing a Pixmap and checking the color is correct
Test clearing a Pixmap and checking the color is correct
// Clear the window surface to blue and verify // Apply the Pixmap and clear it to purple and verify // Rebind the window surface and verify that it is still blue