diff options
author | Andy Nichols <andy.nichols@qt.io> | 2016-04-26 11:49:52 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-05-06 19:17:28 +0000 |
commit | 928915cabe4b8efacf9766962b60f895f51b6b98 (patch) | |
tree | 708242f045390621702d3c94251cfdea7ab36ab7 | |
parent | 11e788c9a555694f3ec5c4839eb98c4048801bf2 (diff) |
Fix some test failures with QT_NO_OPENGL builds
Change-Id: I4154084b4a0e0709ee8cb39a856a37a611e2d537
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
11 files changed, 68 insertions, 22 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp index ef0378fe04..bfcc99c4c2 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QSGSoftwareRenderLoop::QSGSoftwareRenderLoop() { - sg = QSGContext::createDefaultContext(); + sg = new QSGSoftwareContext(); rc = sg->createRenderContext(); } @@ -104,11 +104,15 @@ void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window) void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window) { QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window); - if (!cd->isRenderable() || !m_windows.contains(window)) + if (!m_windows.contains(window)) return; WindowData &data = const_cast<WindowData &>(m_windows[window]); + //If were not in grabOnly mode, dont render a non-renderable window + if (!data.grabOnly && !cd->isRenderable()) + return; + //Resize the backing store if necessary if (m_backingStores[window]->size() != window->size()) { m_backingStores[window]->resize(window->size()); @@ -163,10 +167,7 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window) Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); if (data.grabOnly) { -#ifndef QT_NO_OPENGL - // QPlatformBackingStore::toImage() only with OpenGL for some reason grabContent = m_backingStores[window]->handle()->toImage(); -#endif data.grabOnly = false; } @@ -209,8 +210,19 @@ void QSGSoftwareRenderLoop::exposureChanged(QQuickWindow *window) QImage QSGSoftwareRenderLoop::grab(QQuickWindow *window) { - if (!m_windows.contains(window)) - return QImage(); + //If the window was never shown, create a new backing store + if (!m_backingStores.contains(window)) { + m_backingStores[window] = new QBackingStore(window); + // Call create on window to make sure platform window is created + window->create(); + } + + //If there is no WindowData, add one + if (!m_windows.contains(window)) { + WindowData data; + data.updatePending = false; + m_windows[window] = data; + } m_windows[window].grabOnly = true; diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 042f24c1d5..2187383a31 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -588,6 +588,7 @@ void tst_QQmlProfilerService::scenegraphData() checkTraceReceived(); checkJsHeap(); + // check that at least one frame was rendered // there should be a SGPolishAndSync + SGRendererFrame + SGRenderLoopFrame sequence // (though we can't be sure to get the SGRenderLoopFrame in the threaded renderer) @@ -597,7 +598,7 @@ void tst_QQmlProfilerService::scenegraphData() // if the clocks are acting up. qint64 contextFrameTime = -1; qint64 renderFrameTime = -1; - +#ifndef QT_NO_OPENGL //Software renderer doesn't have context frames foreach (const QQmlProfilerData &msg, m_client->asynchronousMessages) { if (msg.messageType == QQmlProfilerDefinitions::SceneGraphFrame) { if (msg.detailType == QQmlProfilerDefinitions::SceneGraphContextFrame) { @@ -608,7 +609,7 @@ void tst_QQmlProfilerService::scenegraphData() } QVERIFY(contextFrameTime != -1); - +#endif foreach (const QQmlProfilerData &msg, m_client->asynchronousMessages) { if (msg.detailType == QQmlProfilerDefinitions::SceneGraphRendererFrame) { QVERIFY(msg.time >= contextFrameTime); diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp index ee417bb480..838966e2a0 100644 --- a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp +++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp @@ -108,6 +108,7 @@ void tst_qmlplugindump::singleton() dumper.waitForFinished(); const QString &result = dumper.readAllStandardOutput(); + qDebug() << "result: " << result; QVERIFY(result.contains(QLatin1String("exports: [\"Singleton 1.0\"]"))); QVERIFY(result.contains(QLatin1String("exportMetaObjectRevisions: [0]"))); } diff --git a/tests/auto/qml/qqmlenginecleanup/data/types.qml b/tests/auto/qml/qqmlenginecleanup/data/types.qml index 3d27900744..7282c7dbfb 100644 --- a/tests/auto/qml/qqmlenginecleanup/data/types.qml +++ b/tests/auto/qml/qqmlenginecleanup/data/types.qml @@ -29,7 +29,7 @@ import QtQml 2.0 import QtQuick 2.0 import QtQuick.Window 2.0 -import QtQuick.Particles 2.0 + import Test 2.0 import "." @@ -37,7 +37,6 @@ QtObject { //Doesn't create items, just checks that the types are accessible property TestType tt property TestTypeCpp ttc - property ParticleSystem ps property Window wi property Item it } diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 548b20a80a..3087cfbd9d 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -104,6 +104,18 @@ tst_examples::tst_examples() excludedFiles << "views/visualdatamodel/slideshow.qml"; #endif +#ifdef QT_NO_OPENGL + //No support for Particles + excludedFiles << "examples/qml/dynamicscene/dynamicscene.qml"; + excludedFiles << "examples/quick/animation/basics/color-animation.qml"; + excludedFiles << "examples/quick/particles/affectors/content/age.qml"; + excludedFiles << "examples/quick/touchinteraction/multipointtouch/bearwhack.qml"; + excludedFiles << "examples/quick/touchinteraction/multipointtouch/multiflame.qml"; + excludedDirs << "examples/quick/particles"; + // No Support for ShaderEffect + excludedFiles << "src/quick/doc/snippets/qml/animators.qml"; +#endif + } tst_examples::~tst_examples() diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 006c55542a..2742f5c1e2 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -1137,7 +1137,9 @@ void tst_qquickflickable::flickOnRelease() QTRY_VERIFY(!flickable->isMoving()); #ifdef Q_OS_MAC +# ifndef QT_NO_OPENGL QEXPECT_FAIL("", "QTBUG-26094 stopping on a full pixel doesn't work on OS X", Continue); +# endif #endif // Stop on a full pixel after user interaction QCOMPARE(flickable->contentY(), (qreal)qRound(flickable->contentY())); diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index 9274a1ac9e..d345163db5 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -306,6 +306,7 @@ void tst_qquickimage::mirror() qreal width = 300; qreal height = 250; + qreal devicePixelRatio = 1.0; foreach (QQuickImage::FillMode fillMode, fillModes) { #if defined(Q_OS_BLACKBERRY) @@ -325,13 +326,15 @@ void tst_qquickimage::mirror() QImage screenshot = window->grabWindow(); screenshots[fillMode] = screenshot; + devicePixelRatio = window->devicePixelRatio(); } foreach (QQuickImage::FillMode fillMode, fillModes) { QPixmap srcPixmap; QVERIFY(srcPixmap.load(testFile("pattern.png"))); - QPixmap expected(width, height); + QPixmap expected(width * (int)devicePixelRatio, height * (int)devicePixelRatio); + expected.setDevicePixelRatio(devicePixelRatio); expected.fill(); QPainter p_e(&expected); QTransform transform; diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp index 6cfe43fd9f..d991f189fc 100644 --- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp +++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp @@ -60,9 +60,10 @@ private slots: void initTestCase() Q_DECL_OVERRIDE; void layerEnabled(); void layerSmooth(); +#ifndef QT_NO_OPENGL void layerMipmap(); void layerEffect(); - +#endif void layerVisibility_data(); void layerVisibility(); @@ -169,8 +170,7 @@ void tst_QQuickItemLayer::layerEnabled() QVERIFY(fb.pixel(0, 0) != fb.pixel(0, fb.height() - 1)); } - - +#ifndef QT_NO_OPENGL // The test draws a one pixel wide line and scales it down by more than a a factor 2 // If mipmpping works, the pixels should be gray, not white or black @@ -196,8 +196,7 @@ void tst_QQuickItemLayer::layerEffect() QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0)); QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0)); } - - +#endif // The test draws a rectangle and verifies that there is padding on each side // as the source rect spans outside the item. The padding is verified using diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp index 1a04526f61..44d7b40ed9 100644 --- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp +++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp @@ -32,8 +32,11 @@ #include <QtQuick/qquickview.h> #include <private/qquickitem_p.h> +#ifndef QT_NO_OPENGL #include <private/qsgdefaultpainternode_p.h> - +#else +#include <private/qsgsoftwarepainternode_p.h> +#endif class tst_QQuickPaintedItem: public QObject { Q_OBJECT @@ -70,7 +73,7 @@ public: ++paintRequests; clipRect = painter->clipBoundingRect(); } - +#ifndef QT_NO_OPENGL QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) { paintNode = static_cast<QSGDefaultPainterNode *>(QQuickPaintedItem::updatePaintNode(oldNode, data)); @@ -78,6 +81,15 @@ public: } QSGDefaultPainterNode *paintNode; +#else + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) + { + paintNode = static_cast<QSGSoftwarePainterNode *>(QQuickPaintedItem::updatePaintNode(oldNode, data)); + return paintNode; + } + + QSGSoftwarePainterNode *paintNode; +#endif int paintRequests; QRectF clipRect; }; diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index eed81389f6..0e4ad86260 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -1240,9 +1240,10 @@ void tst_qquickwindow::headless() QSignalSpy initialized(window, SIGNAL(sceneGraphInitialized())); QSignalSpy invalidated(window, SIGNAL(sceneGraphInvalidated())); +#ifndef QT_NO_OPENGL // Verify that the window is alive and kicking QVERIFY(window->openglContext() != 0); - +#endif // Store the visual result QImage originalContent = window->grabWindow(); @@ -1270,7 +1271,9 @@ void tst_qquickwindow::headless() if (threaded) QTRY_COMPARE(initialized.size(), 1); +#ifndef QT_NO_OPENGL QVERIFY(window->openglContext() != 0); +#endif // Verify that the visual output is the same QImage newContent = window->grabWindow(); @@ -1643,7 +1646,9 @@ void tst_qquickwindow::hideThenDelete() } QVERIFY(sgInvalidated->size() > 0); +#ifndef QT_NO_OPENGL QVERIFY(openglDestroyed->size() > 0); +#endif } void tst_qquickwindow::showHideAnimate() diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index e1ed4418f1..a528810cae 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -13,7 +13,8 @@ contains(QT_CONFIG, opengl(es1|es2)?) { qquickanimatedsprite \ qquickframebufferobject \ qquickopenglinfo \ - qquickspritesequence + qquickspritesequence \ + qquickshadereffect } !cross_compile: PRIVATETESTS += examples @@ -72,7 +73,6 @@ QUICKTESTS = \ qquickrectangle \ qquickrendererinfo \ qquickrepeater \ - qquickshadereffect \ qquickshortcut \ qquicktext \ qquicktextdocument \ |