aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-29 10:11:24 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-29 10:11:25 +0200
commit5f2249f4dcce7523d8dc88b425b43834c4c3cab9 (patch)
tree5ddbd03806a0f940cca2d4de966c2a00d761717b /tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
parentd5cb1bf4a9e19a0a4471ba5c935f441463a73414 (diff)
parent1b897195a14b63a553b139983736d8dfdd419ffd (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp')
-rw-r--r--tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
index 27ce46d163..820c804065 100644
--- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
+++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
@@ -35,6 +35,7 @@
#include <QtGui/qopenglcontext.h>
#include <QtGui/qopenglfunctions.h>
#include <QtGui/qoffscreensurface.h>
+#include <QtQml/qqmlproperty.h>
class tst_qquickanimatedsprite : public QQmlDataTest
{
@@ -50,6 +51,7 @@ private slots:
void test_largeAnimation_data();
void test_largeAnimation();
void test_reparenting();
+ void test_changeSourceToSmallerImgKeepingBigFrameSize();
};
void tst_qquickanimatedsprite::initTestCase()
@@ -286,6 +288,43 @@ void tst_qquickanimatedsprite::test_reparenting()
QTRY_COMPARE(QQuickItemPrivate::get(sprite)->polishScheduled, false);
}
+class KillerThread : public QThread
+{
+ Q_OBJECT
+protected:
+ void run() Q_DECL_OVERRIDE {
+ sleep(3);
+ qFatal("Either the GUI or the render thread is stuck in an infinite loop.");
+ }
+};
+
+// Regression test for QTBUG-53937
+void tst_qquickanimatedsprite::test_changeSourceToSmallerImgKeepingBigFrameSize()
+{
+ QQuickView window;
+ window.setSource(testFileUrl("sourceSwitch.qml"));
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ QVERIFY(window.rootObject());
+ QQuickAnimatedSprite* sprite = qobject_cast<QQuickAnimatedSprite*>(window.rootObject());
+ QVERIFY(sprite);
+
+ QQmlProperty big(sprite, "big");
+ big.write(QVariant::fromValue(false));
+
+ KillerThread *killer = new KillerThread;
+ killer->start(); // will kill us in case the GUI or render thread enters an infinite loop
+
+ QTest::qWait(50); // let it draw with the new source.
+
+ // If we reach this point it's because we didn't hit QTBUG-53937
+
+ killer->terminate();
+ killer->wait();
+ delete killer;
+}
+
QTEST_MAIN(tst_qquickanimatedsprite)
#include "tst_qquickanimatedsprite.moc"