aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
diff options
context:
space:
mode:
authorSami Nurmenniemi <sami.nurmenniemi@qt.io>2017-08-30 15:39:28 +0300
committerSimon Hausmann <simon.hausmann@qt.io>2017-09-21 06:56:11 +0000
commitd8d3259b2340baed2e7f8273907bd0bb5598b540 (patch)
treeab378e41ed23907e009e9235b3d6a4c173c555eb /tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
parent4b286a2975d37700c7e500c61516f01b63e04b01 (diff)
Enable tests for boot2qt
Some tests needed fixing - Disabled tests too heavy for qemu - Skipped tests requiring OpenGL without support from the platform - Skipped tests requiring functionality on broken offscreen platform - Skipped tests that take too long on qemu + software renderer - Blacklisted tests for created bugs QTBUG-63049, QTBUG-63053 QTBUG-63055 and QTBUG-63057 Task-number: QTBUG-60268 Change-Id: I0346b0e436cf286d7d9cbc140acf324a4087cfb9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp')
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp79
1 files changed, 52 insertions, 27 deletions
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 5419778cfc..e52370721f 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -36,6 +36,9 @@
#include "../../shared/util.h"
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformintegration.h>
+
class tst_QQuickItemLayer: public QQmlDataTest
{
Q_OBJECT
@@ -102,35 +105,37 @@ void tst_QQuickItemLayer::initTestCase()
{
QQmlDataTest::initTestCase();
#if QT_CONFIG(opengl)
- QWindow window;
- QOpenGLContext context;
- window.setSurfaceType(QWindow::OpenGLSurface);
- window.create();
- QVERIFY(context.create());
- QVERIFY(context.makeCurrent(&window));
- const char *vendor = (const char *)context.functions()->glGetString(GL_VENDOR);
- const char *renderer = (const char *)context.functions()->glGetString(GL_RENDERER);
- m_isMesaSoftwareRasterizer = strcmp(vendor, "Mesa Project") == 0
- && strcmp(renderer, "Software Rasterizer") == 0;
- if (m_isMesaSoftwareRasterizer) {
- // Expects format: <OpenGL version> Mesa <Mesa version>[-devel] [...]
- const char *version = (const char *)context.functions()->glGetString(GL_VERSION);
- QList<QByteArray> list = QByteArray(version).split(' ');
- if (list.size() >= 3) {
- list = list.at(2).split('-').at(0).split('.');
- int major = 0;
- int minor = 0;
- int patch = 0;
- if (list.size() >= 1)
- major = list.at(0).toInt();
- if (list.size() >= 2)
- minor = list.at(1).toInt();
- if (list.size() >= 3)
- patch = list.at(2).toInt();
- m_mesaVersion = QT_VERSION_CHECK(major, minor, patch);
+ if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) {
+ QWindow window;
+ QOpenGLContext context;
+ window.setSurfaceType(QWindow::OpenGLSurface);
+ window.create();
+ QVERIFY(context.create());
+ QVERIFY(context.makeCurrent(&window));
+ const char *vendor = (const char *)context.functions()->glGetString(GL_VENDOR);
+ const char *renderer = (const char *)context.functions()->glGetString(GL_RENDERER);
+ m_isMesaSoftwareRasterizer = strcmp(vendor, "Mesa Project") == 0
+ && strcmp(renderer, "Software Rasterizer") == 0;
+ if (m_isMesaSoftwareRasterizer) {
+ // Expects format: <OpenGL version> Mesa <Mesa version>[-devel] [...]
+ const char *version = (const char *)context.functions()->glGetString(GL_VERSION);
+ QList<QByteArray> list = QByteArray(version).split(' ');
+ if (list.size() >= 3) {
+ list = list.at(2).split('-').at(0).split('.');
+ int major = 0;
+ int minor = 0;
+ int patch = 0;
+ if (list.size() >= 1)
+ major = list.at(0).toInt();
+ if (list.size() >= 2)
+ minor = list.at(1).toInt();
+ if (list.size() >= 3)
+ patch = list.at(2).toInt();
+ m_mesaVersion = QT_VERSION_CHECK(major, minor, patch);
+ }
}
+ window.create();
}
- window.create();
#endif
QQuickView view;
view.showNormal();
@@ -147,6 +152,11 @@ void tst_QQuickItemLayer::layerSmooth()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms");
+
QImage fb = runTest("Smooth.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0, 0xff));
@@ -166,6 +176,11 @@ void tst_QQuickItemLayer::layerEnabled()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms");
+
QImage fb = runTest("Enabled.qml");
// Verify the banding
QCOMPARE(fb.pixel(0, 0), fb.pixel(0, 1));
@@ -181,6 +196,7 @@ void tst_QQuickItemLayer::layerMipmap()
{
if (m_isMesaSoftwareRasterizer)
QSKIP("Mipmapping does not work with the Mesa Software Rasterizer.");
+
QImage fb = runTest("Mipmap.qml");
QVERIFY(fb.pixel(0, 0) != 0xff000000);
QVERIFY(fb.pixel(0, 0) != 0xffffffff);
@@ -195,6 +211,11 @@ void tst_QQuickItemLayer::layerEffect()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms");
+
QImage fb = runTest("Effect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0));
@@ -451,6 +472,10 @@ void tst_QQuickItemLayer::itemEffect()
void tst_QQuickItemLayer::rectangleEffect()
{
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms");
+
QImage fb = runTest("RectangleEffect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0, 0xff, 0));
QCOMPARE(fb.pixel(199, 0), qRgb(0, 0xff, 0));