diff --git a/tests/auto/client/client/client.pro b/tests/auto/client/client/client.pro index e6e607c3..ff99560a 100644 --- a/tests/auto/client/client/client.pro +++ b/tests/auto/client/client/client.pro @@ -2,7 +2,7 @@ CONFIG += testcase link_pkgconfig TARGET = tst_client QT += testlib -QT += core-private gui-private waylandclient-private +QT += core-private gui-private waylandclient-private egl_support-private QMAKE_USE += wayland-client wayland-server diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index aaadaa9c..51345ff5 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -37,10 +37,11 @@ #include #include #include - #include + #include #include +#include static const QSize screenSize(1600, 1200); @@ -117,9 +118,9 @@ public: class TestGlWindow : public QOpenGLWindow { Q_OBJECT - public: TestGlWindow(); + static bool supported(); protected: void paintGL() override; @@ -133,6 +134,18 @@ void TestGlWindow::paintGL() glClear(GL_COLOR_BUFFER_BIT); } +bool TestGlWindow::supported() +{ + if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) { + if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") || + q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") || + q_hasEglExtension(EGL_NO_DISPLAY, "EGL_MESA_platform_wayland")) { + return true; + } + } + return false; +} + class tst_WaylandClient : public QObject { Q_OBJECT @@ -433,6 +446,11 @@ void tst_WaylandClient::hiddenPopupParent() void tst_WaylandClient::glWindow() { + if (!TestGlWindow::supported()) { + QEXPECT_FAIL("", "This platform does not support EGL, skipping GL tests", Abort); + Q_ASSERT(false); + return; + } QScopedPointer testWindow(new TestGlWindow); testWindow->show(); QSharedPointer surface; @@ -454,6 +472,7 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); + // Initializing some client buffer integrations (i.e. eglInitialize) may block while waiting // for a wayland sync. So we call clientBufferIntegration prior to applicationInitialized // (while the compositor processes events without waiting) in order to avoid hanging later.