#include "egluNativeDisplay.hpp"
#include "egluNativeWindow.hpp"
#include "egluUtil.hpp"
+#include "egluUtil.hpp"
#include "egluUnique.hpp"
+#include "eglwLibrary.hpp"
+
#include <memory>
using tcu::TestLog;
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<eglu::NativePixmap> 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<EGL_PBUFFER_BIT>))
+ {
+ 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;
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],
&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",
}
});
- 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 };
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<EGL_PIXMAP_BIT>))
- {
- 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<EGL_OPENGL_ES2_BIT> << surfaceBits<EGL_WINDOW_BIT>);
- 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<eglu::NativeWindow> 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",
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();