aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-03-08 14:02:53 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-03-08 14:02:53 +0000
commite2b2be90f26e232e36943b4d4bed5afee362ebc8 (patch)
treebae69c8cfd6a1c73c1ab1b0384f5120e7aabdd9e /tests
parent6c923498cd89e3fb1b4d92f27a9d7c840cee5971 (diff)
parentb8fd0ed3a47558b4ace480526cddffa51d6f0580 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
index c1998ae44e..27ce46d163 100644
--- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
+++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
@@ -30,6 +30,7 @@
#include <QtQuick/qquickview.h>
#include <private/qabstractanimation_p.h>
#include <private/qquickanimatedsprite_p.h>
+#include <private/qquickitem_p.h>
#include <QtGui/qpainter.h>
#include <QtGui/qopenglcontext.h>
#include <QtGui/qopenglfunctions.h>
@@ -48,6 +49,7 @@ private slots:
void test_frameChangedSignal();
void test_largeAnimation_data();
void test_largeAnimation();
+ void test_reparenting();
};
void tst_qquickanimatedsprite::initTestCase()
@@ -263,6 +265,26 @@ void tst_qquickanimatedsprite::test_largeAnimation()
delete window;
}
+void tst_qquickanimatedsprite::test_reparenting()
+{
+ QQuickView window;
+ window.setSource(testFileUrl("basic.qml"));
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ QVERIFY(window.rootObject());
+ QQuickAnimatedSprite* sprite = window.rootObject()->findChild<QQuickAnimatedSprite*>("sprite");
+ QVERIFY(sprite);
+
+ QTRY_VERIFY(sprite->running());
+ sprite->setParentItem(0);
+
+ sprite->setParentItem(window.rootObject());
+ // don't crash (QTBUG-51162)
+ sprite->polish();
+ QTRY_COMPARE(QQuickItemPrivate::get(sprite)->polishScheduled, true);
+ QTRY_COMPARE(QQuickItemPrivate::get(sprite)->polishScheduled, false);
+}
QTEST_MAIN(tst_qquickanimatedsprite)