Skip OpenGL tests on platforms that don't support OpenGL

Change-Id: Iff38950a940d602fbfcc35595624e56399aab53a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Sami Nurmenniemi 2017-03-31 16:18:12 +03:00
parent 5377f4ec0e
commit 6d6a826038
3 changed files with 21 additions and 0 deletions

View File

@ -31,12 +31,15 @@
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLContext>
#include <QtGui/QPainter>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
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;

View File

@ -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<int>("surfaceClass");

View File

@ -56,6 +56,8 @@
#include <private/qgraphicsview_p.h>
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
#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");