Added a test that checks the error behavior of ConsumerBase::abandon
We check that calling eglSwapBuffers() on an abandonned BufferQueue return EGL_BAD_ALLOC -- this is to ensure consistancy between drivers. Change-Id: If84b082bc6bdea21673b16e5e717658c78edf405
This commit is contained in:
parent
f5c7cb316c
commit
871d6f2dfd
@ -61,6 +61,7 @@ protected:
|
|||||||
&myConfig, 1, &numConfigs));
|
&myConfig, 1, &numConfigs));
|
||||||
ASSERT_EQ(EGL_SUCCESS, eglGetError());
|
ASSERT_EQ(EGL_SUCCESS, eglGetError());
|
||||||
|
|
||||||
|
mEglConfig = myConfig;
|
||||||
EGLint pbufferAttribs[] = {
|
EGLint pbufferAttribs[] = {
|
||||||
EGL_WIDTH, 16,
|
EGL_WIDTH, 16,
|
||||||
EGL_HEIGHT, 16,
|
EGL_HEIGHT, 16,
|
||||||
@ -95,7 +96,7 @@ protected:
|
|||||||
|
|
||||||
virtual EGLint const* getConfigAttribs() {
|
virtual EGLint const* getConfigAttribs() {
|
||||||
static EGLint sDefaultConfigAttribs[] = {
|
static EGLint sDefaultConfigAttribs[] = {
|
||||||
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
|
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT | EGL_WINDOW_BIT,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -109,6 +110,7 @@ protected:
|
|||||||
EGLDisplay mEglDisplay;
|
EGLDisplay mEglDisplay;
|
||||||
EGLSurface mEglSurface;
|
EGLSurface mEglSurface;
|
||||||
EGLContext mEglContext;
|
EGLContext mEglContext;
|
||||||
|
EGLConfig mEglConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) {
|
TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) {
|
||||||
@ -169,6 +171,34 @@ TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceSucceeds) {
|
|||||||
eglTerminate(dpy);
|
eglTerminate(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(SurfaceTextureClientTest, EglSwapBuffersAbandonErrorIsEglBadSurface) {
|
||||||
|
|
||||||
|
EGLSurface eglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig, mANW.get(), NULL);
|
||||||
|
EXPECT_NE(EGL_NO_SURFACE, eglSurface);
|
||||||
|
EXPECT_EQ(EGL_SUCCESS, eglGetError());
|
||||||
|
|
||||||
|
EGLBoolean success = eglMakeCurrent(mEglDisplay, eglSurface, eglSurface, mEglContext);
|
||||||
|
EXPECT_EQ(EGL_TRUE, success);
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
success = eglSwapBuffers(mEglDisplay, eglSurface);
|
||||||
|
EXPECT_EQ(EGL_TRUE, success);
|
||||||
|
|
||||||
|
mST->abandon();
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
success = eglSwapBuffers(mEglDisplay, eglSurface);
|
||||||
|
EXPECT_EQ(EGL_FALSE, success);
|
||||||
|
EXPECT_EQ(EGL_BAD_SURFACE, eglGetError());
|
||||||
|
|
||||||
|
success = eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
|
||||||
|
ASSERT_EQ(EGL_TRUE, success);
|
||||||
|
|
||||||
|
if (eglSurface != EGL_NO_SURFACE) {
|
||||||
|
eglDestroySurface(mEglDisplay, eglSurface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) {
|
TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) {
|
||||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, 0, 0));
|
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, 0, 0));
|
||||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, -1, 0));
|
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, -1, 0));
|
||||||
|
Loading…
Reference in New Issue
Block a user