From 6d6a826038e5a3fae13580e84159b99c928dc006 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Fri, 31 Mar 2017 16:18:12 +0300 Subject: [PATCH] Skip OpenGL tests on platforms that don't support OpenGL Change-Id: Iff38950a940d602fbfcc35595624e56399aab53a Reviewed-by: Simon Hausmann --- .../auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp | 9 +++++++++ tests/auto/gui/qopengl/tst_qopengl.cpp | 7 +++++++ .../graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp index b130210447..58dee6f6ca 100644 --- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp +++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp @@ -31,12 +31,15 @@ #include #include #include +#include +#include class tst_QOpenGLWindow : public QObject { Q_OBJECT private slots: + void initTestCase(); void create(); void basic(); void painter(); @@ -45,6 +48,12 @@ private slots: void underOver(); }; +void tst_QOpenGLWindow::initTestCase() +{ + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) + QSKIP("OpenGL is not supported on this platform."); +} + void tst_QOpenGLWindow::create() { QOpenGLWindow w; diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 7451ef92ee..87d93e0827 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -67,6 +67,7 @@ class tst_QOpenGL : public QObject Q_OBJECT private slots: + void initTestCase(); void sharedResourceCleanup_data(); void sharedResourceCleanup(); void multiGroupSharedResourceCleanup_data(); @@ -205,6 +206,12 @@ static QSurface *createSurface(int surfaceClass) return 0; } +void tst_QOpenGL::initTestCase() +{ + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) + QSKIP("OpenGL is not supported on this platform."); +} + static void common_data() { QTest::addColumn("surfaceClass"); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 5ab24d6878..76b25cdb52 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -56,6 +56,8 @@ #include #include "../../../shared/platforminputcontext.h" #include +#include +#include #include "tst_qgraphicsview.h" @@ -664,6 +666,9 @@ void tst_QGraphicsView::viewport() #ifndef QT_NO_OPENGL void tst_QGraphicsView::openGLViewport() { + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) + QSKIP("QOpenGL is not supported on this platform."); + QGraphicsScene scene; scene.setBackgroundBrush(Qt::white); scene.addText("GraphicsView");