aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-04-20 23:37:31 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-04-20 23:37:32 +0200
commitcdc6c2164a80311979a6c247d6fb77d436612e5f (patch)
treec0f15469440d862f0ff8e775d7804278811d0133 /tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
parentac9046b074a60ab73d7e76a48b8c69f00db9cbd2 (diff)
parent7dc0de374300d66ed72f15820a4ebb78849ae0e7 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'tests/auto/quick/qquickanimations/tst_qquickanimations.cpp')
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index e62d49ed6b..b4eb33eb7a 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -114,6 +114,7 @@ private slots:
void replacingTransitions();
void animationJobSelfDestruction();
void fastFlickingBug();
+ void opacityAnimationFromZero();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -1858,6 +1859,42 @@ void tst_qquickanimations::fastFlickingBug()
}
}
+void tst_qquickanimations::opacityAnimationFromZero()
+{
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms");
+
+ // not easy to verify this in threaded render loop
+ // since it's difficult to capture the first frame when scene graph
+ // is renderred in another thread
+ qputenv("QSG_RENDER_LOOP", "basic");
+ auto cleanup = qScopeGuard([]() { qputenv("QSG_RENDER_LOOP", ""); });
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("opacityAnimationFromZero.qml"));
+ QScopedPointer<QQuickWindow> win(qobject_cast<QQuickWindow*>(c.create()));
+ if (!c.errors().isEmpty())
+ qDebug() << c.errorString();
+ QVERIFY(win);
+ win->setTitle(QTest::currentTestFunction());
+ win->show();
+ QVERIFY(QTest::qWaitForWindowExposed(win.data()));
+
+ QImage img;
+ bool firstFrameSwapped = false;
+ QObject::connect(win.get(), &QQuickWindow::frameSwapped, win.get(), [&win, &img, &firstFrameSwapped]() {
+ if (firstFrameSwapped)
+ return;
+ else
+ firstFrameSwapped = true;
+ img = win->grabWindow();
+ if (img.width() < win->width())
+ QSKIP("Skipping due to grabWindow not functional");
+ });
+ QTRY_VERIFY(!img.isNull() && img.pixel(100, 100) > qRgb(10, 10, 10));
+}
+
QTEST_MAIN(tst_qquickanimations)
#include "tst_qquickanimations.moc"