From 15a19da0d33b9f2abfd8eb9ea21f2397db5cadcb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mika=20Isoj=C3=A4rvi?= Date: Mon, 1 Feb 2016 16:08:58 -0800 Subject: [PATCH] Remove tests cases and checks assuming native handles to be invalid. Bug: 25850892 Change-Id: I8de0ce317bfd1bd9ddd609f0d47c71cf1084472f --- android/cts/master/com.drawelements.deqp.egl.xml | 3 - android/cts/master/egl-master.txt | 1 - modules/egl/teglNegativeApiTests.cpp | 93 +++++++++++------------- 3 files changed, 44 insertions(+), 53 deletions(-) diff --git a/android/cts/master/com.drawelements.deqp.egl.xml b/android/cts/master/com.drawelements.deqp.egl.xml index 2a50d43..2d57fae 100644 --- a/android/cts/master/com.drawelements.deqp.egl.xml +++ b/android/cts/master/com.drawelements.deqp.egl.xml @@ -7430,9 +7430,6 @@ - - - diff --git a/android/cts/master/egl-master.txt b/android/cts/master/egl-master.txt index 04fb6d4..87398d9 100644 --- a/android/cts/master/egl-master.txt +++ b/android/cts/master/egl-master.txt @@ -2347,7 +2347,6 @@ dEQP-EGL.functional.negative_api.destroy_context dEQP-EGL.functional.negative_api.destroy_surface dEQP-EGL.functional.negative_api.get_config_attrib dEQP-EGL.functional.negative_api.get_configs -dEQP-EGL.functional.negative_api.get_display dEQP-EGL.functional.negative_api.initialize dEQP-EGL.functional.negative_api.make_current dEQP-EGL.functional.negative_api.get_current_context diff --git a/modules/egl/teglNegativeApiTests.cpp b/modules/egl/teglNegativeApiTests.cpp index 6eac350..9a80ff9 100644 --- a/modules/egl/teglNegativeApiTests.cpp +++ b/modules/egl/teglNegativeApiTests.cpp @@ -27,8 +27,11 @@ #include "egluNativeDisplay.hpp" #include "egluNativeWindow.hpp" #include "egluUtil.hpp" +#include "egluUtil.hpp" #include "egluUnique.hpp" +#include "eglwLibrary.hpp" + #include using tcu::TestLog; @@ -181,27 +184,40 @@ void NegativeApiTests::init (void) log << TestLog::EndSection; }); + static const EGLint s_validGenericPbufferAttrib[] = { EGL_WIDTH, 64, EGL_HEIGHT, 64, EGL_NONE }; + TEGL_ADD_API_CASE(copy_buffers, "eglCopyBuffers() negative tests", { - TestLog& log = m_testCtx.getLog(); - EGLDisplay display = getDisplay(); + TestLog& log = m_testCtx.getLog(); + const eglw::Library& egl = m_eglTestCtx.getLibrary(); + EGLDisplay display = getDisplay(); + const eglu::NativePixmapFactory& factory = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); + de::UniquePtr pixmap (factory.createPixmap(&m_eglTestCtx.getNativeDisplay(), 64, 64)); + EGLConfig config; - log << TestLog::Section("Test1", "EGL_BAD_DISPLAY is generated if display is not an EGL display connection"); + { + if (getConfig(&config, FilterList() << surfaceBits)) + { + eglu::UniqueSurface surface (egl, display, egl.createPbufferSurface(display, config, s_validGenericPbufferAttrib)); - expectFalse(eglCopyBuffers(EGL_NO_DISPLAY, EGL_NO_SURFACE, (EGLNativePixmapType)0)); - expectError(EGL_BAD_DISPLAY); + log << TestLog::Section("Test1", "EGL_BAD_DISPLAY is generated if display is not an EGL display connection"); - expectFalse(eglCopyBuffers((EGLDisplay)-1, EGL_NO_SURFACE, (EGLNativePixmapType)0)); - expectError(EGL_BAD_DISPLAY); + expectFalse(eglCopyBuffers(EGL_NO_DISPLAY, EGL_NO_SURFACE, pixmap->getLegacyNative())); + expectError(EGL_BAD_DISPLAY); - log << TestLog::EndSection; + expectFalse(eglCopyBuffers((EGLDisplay)-1, EGL_NO_SURFACE, pixmap->getLegacyNative())); + expectError(EGL_BAD_DISPLAY); + + log << TestLog::EndSection; + } + } log << TestLog::Section("Test2", "EGL_BAD_SURFACE is generated if surface is not an EGL surface"); - expectFalse(eglCopyBuffers(display, EGL_NO_SURFACE, (EGLNativePixmapType)0)); + expectFalse(eglCopyBuffers(display, EGL_NO_SURFACE, pixmap->getLegacyNative())); expectError(EGL_BAD_SURFACE); - expectFalse(eglCopyBuffers(display, (EGLSurface)-1, (EGLNativePixmapType)0)); + expectFalse(eglCopyBuffers(display, (EGLSurface)-1, pixmap->getLegacyNative())); expectError(EGL_BAD_SURFACE); log << TestLog::EndSection; @@ -212,9 +228,8 @@ void NegativeApiTests::init (void) static const EGLint s_invalidChooseConfigAttribList2[] = { EGL_BIND_TO_TEXTURE_RGB, 4, EGL_NONE }; static const EGLint s_invalidChooseConfigAttribList3[] = { EGL_BIND_TO_TEXTURE_RGBA, 5, EGL_NONE }; static const EGLint s_invalidChooseConfigAttribList4[] = { EGL_COLOR_BUFFER_TYPE, 0, EGL_NONE }; - static const EGLint s_invalidChooseConfigAttribList5[] = { EGL_MATCH_NATIVE_PIXMAP, -1, EGL_NONE }; - static const EGLint s_invalidChooseConfigAttribList6[] = { EGL_NATIVE_RENDERABLE, 6, EGL_NONE }; - static const EGLint s_invalidChooseConfigAttribList7[] = { EGL_TRANSPARENT_TYPE, 6, EGL_NONE }; + static const EGLint s_invalidChooseConfigAttribList5[] = { EGL_NATIVE_RENDERABLE, 6, EGL_NONE }; + static const EGLint s_invalidChooseConfigAttribList6[] = { EGL_TRANSPARENT_TYPE, 6, EGL_NONE }; static const EGLint* s_invalidChooseConfigAttribLists[] = { &s_invalidChooseConfigAttribList0[0], @@ -223,8 +238,7 @@ void NegativeApiTests::init (void) &s_invalidChooseConfigAttribList3[0], &s_invalidChooseConfigAttribList4[0], &s_invalidChooseConfigAttribList5[0], - &s_invalidChooseConfigAttribList6[0], - &s_invalidChooseConfigAttribList7[0] + &s_invalidChooseConfigAttribList6[0] }; TEGL_ADD_API_CASE(choose_config, "eglChooseConfig() negative tests", @@ -479,8 +493,6 @@ void NegativeApiTests::init (void) } }); - static const EGLint s_validGenericPbufferAttrib[] = { EGL_WIDTH, 64, EGL_HEIGHT, 64, EGL_NONE }; - static const EGLint s_invalidGenericPbufferAttrib0[] = { 0, EGL_NONE }; static const EGLint s_invalidGenericPbufferAttrib1[] = { (EGLint)0xffffffff }; static const EGLint s_negativeWidthPbufferAttrib[] = { EGL_WIDTH, -1, EGL_HEIGHT, 64, EGL_NONE }; @@ -649,41 +661,30 @@ void NegativeApiTests::init (void) expectError(EGL_BAD_CONFIG); log << TestLog::EndSection; - - log << TestLog::Section("Test3", "EGL_BAD_NATIVE_PIXMAP may be generated if native_pixmap is not a valid native pixmap"); - - // Any pixmap-capable config. - EGLConfig pixmapConfig; - if (getConfig(&pixmapConfig, FilterList() << surfaceBits)) - { - expectNoSurface(eglCreatePixmapSurface(display, pixmapConfig, DE_NULL, s_emptyAttribList)); - expectError(EGL_BAD_NATIVE_PIXMAP); - } - - log << TestLog::EndSection; }); TEGL_ADD_API_CASE(create_window_surface, "eglCreateWindowSurface() negative tests", { - TestLog& log = m_testCtx.getLog(); - EGLDisplay display = getDisplay(); - - log << TestLog::Section("Test1", "EGL_BAD_DISPLAY is generated if display is not an EGL display connection"); - - expectNoSurface(eglCreateWindowSurface(EGL_NO_DISPLAY, DE_NULL, DE_NULL, s_emptyAttribList)); - expectError(EGL_BAD_DISPLAY); + EGLConfig config = DE_NULL; + bool gotConfig = getConfig(&config, FilterList() << renderable << surfaceBits); - expectNoSurface(eglCreateWindowSurface((EGLDisplay)-1, DE_NULL, DE_NULL, s_emptyAttribList)); - expectError(EGL_BAD_DISPLAY); + if (gotConfig) + { + TestLog& log = m_testCtx.getLog(); + EGLDisplay display = getDisplay(); + const eglu::NativeWindowFactory& factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); + de::UniquePtr window (factory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(256, 256, eglu::parseWindowVisibility(m_testCtx.getCommandLine())))); - log << TestLog::EndSection; + log << TestLog::Section("Test1", "EGL_BAD_DISPLAY is generated if display is not an EGL display connection"); - log << TestLog::Section("Test2", "EGL_BAD_CONFIG is generated if config is not an EGL frame buffer configuration"); + expectNoSurface(eglCreateWindowSurface(EGL_NO_DISPLAY, config, window->getLegacyNative(), s_emptyAttribList)); + expectError(EGL_BAD_DISPLAY); - expectNoSurface(eglCreateWindowSurface(display, (EGLConfig)-1, DE_NULL, s_emptyAttribList)); - expectError(EGL_BAD_CONFIG); + expectNoSurface(eglCreateWindowSurface((EGLDisplay)-1, config, window->getLegacyNative(), s_emptyAttribList)); + expectError(EGL_BAD_DISPLAY); - log << TestLog::EndSection; + log << TestLog::EndSection; + } }); TEGL_ADD_API_CASE(destroy_context, "eglDestroyContext() negative tests", @@ -804,12 +805,6 @@ void NegativeApiTests::init (void) log << TestLog::EndSection; }); - TEGL_ADD_API_CASE(get_display, "eglGetDisplay() negative tests", - { - expectNoDisplay(eglGetDisplay((EGLNativeDisplayType)-1)); - expectError(EGL_SUCCESS); - }); - TEGL_ADD_API_CASE(initialize, "eglInitialize() negative tests", { TestLog& log = m_testCtx.getLog(); -- 2.7.4