From 1ae4692b96de13b1bdcfe20d67d4edc226091169 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mika=20Isoj=C3=A4rvi?= Date: Fri, 20 Mar 2015 14:11:51 -0700 Subject: [PATCH] Accepth different errors from eglCreatePbufferFromClientBuffer. 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 | 11 +++++++++++ modules/egl/teglApiCase.hpp | 1 + modules/egl/teglNegativeApiTests.cpp | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/egl/teglApiCase.cpp b/modules/egl/teglApiCase.cpp index e0710bc..906f7a1 100644 --- a/modules/egl/teglApiCase.cpp +++ b/modules/egl/teglApiCase.cpp @@ -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) diff --git a/modules/egl/teglApiCase.hpp b/modules/egl/teglApiCase.hpp index 445a0c0..9bc1176 100644 --- a/modules/egl/teglApiCase.hpp +++ b/modules/egl/teglApiCase.hpp @@ -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); diff --git a/modules/egl/teglNegativeApiTests.cpp b/modules/egl/teglNegativeApiTests.cpp index d6eb267..607fa7c 100755 --- a/modules/egl/teglNegativeApiTests.cpp +++ b/modules/egl/teglNegativeApiTests.cpp @@ -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; -- 2.7.4