Accepth different errors from eglCreatePbufferFromClientBuffer.
authorMika Isojärvi <misojarvi@google.com>
Fri, 20 Mar 2015 21:11:51 +0000 (14:11 -0700)
committerMika Isojärvi <misojarvi@google.com>
Mon, 23 Mar 2015 16:56:50 +0000 (09:56 -0700)
Accept both EGL_BAD_CONFIG and EGL_BAD_PARAMETER from
eglCreatePbufferFromClientBuffer when passing in both invalid config
and invalid client buffer.

Bug: 18290284
Change-Id: Ic3ccf69de650e48ffd0b847014790ef1bf44ed56

modules/egl/teglApiCase.cpp
modules/egl/teglApiCase.hpp
modules/egl/teglNegativeApiTests.cpp

index e0710bc..906f7a1 100644 (file)
@@ -93,6 +93,17 @@ void ApiCase::expectError (EGLenum expected)
        }
 }
 
+void ApiCase::expectEitherError (EGLenum expectedA, EGLenum expectedB)
+{
+       EGLenum err = m_eglTestCtx.getLibrary().getError();
+       if (err != expectedA && err != expectedB)
+       {
+               m_testCtx.getLog() << TestLog::Message << "// ERROR expected: " << eglu::getErrorStr(expectedA) << " or " << eglu::getErrorStr(expectedB) << ", Got: " << eglu::getErrorStr(err) << TestLog::EndMessage;
+               if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid error");
+       }
+}
+
 void ApiCase::expectBoolean (EGLBoolean expected, EGLBoolean got)
 {
        if (expected != got)
index 445a0c0..9bc1176 100644 (file)
@@ -51,6 +51,7 @@ protected:
        virtual void            test                                    (void) = DE_NULL;
 
        void                            expectError                             (eglw::EGLenum error);
+       void                            expectEitherError               (eglw::EGLenum errorA, eglw::EGLenum errorB);
        void                            expectBoolean                   (eglw::EGLBoolean expected, eglw::EGLBoolean got);
 
        void                            expectNoContext                 (eglw::EGLContext got);
index d6eb267..607fa7c 100755 (executable)
@@ -456,10 +456,10 @@ void NegativeApiTests::init (void)
 
                        log << TestLog::EndSection;
 
-                       log << TestLog::Section("Test2", "EGL_BAD_CONFIG is generated if config is not an EGL frame buffer configuration");
+                       log << TestLog::Section("Test2", "EGL_BAD_CONFIG or EGL_BAD_PARAMETER is generated if config is not an EGL frame buffer configuration and if buffer is not valid OpenVG image");
 
-                       expectNoSurface(eglCreatePbufferFromClientBuffer(display, EGL_OPENVG_IMAGE, 0, (EGLConfig)-1, DE_NULL));
-                       expectError(EGL_BAD_CONFIG);
+                       expectNoSurface(eglCreatePbufferFromClientBuffer(display, EGL_OPENVG_IMAGE, (EGLClientBuffer)-1, (EGLConfig)-1, DE_NULL));
+                       expectEitherError(EGL_BAD_CONFIG, EGL_BAD_PARAMETER);
 
                        log << TestLog::EndSection;