aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickspringanimation
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-13 08:32:12 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-14 16:30:41 +0100
commit23680b185dd6fa4eb1fef76f77b4c9acf0f161fe (patch)
tree9c25e63482ed321804eae0ac6c9174fe0f59b0ee /tests/auto/quick/qquickspringanimation
parent44e204ea9dce4681b74181c6b4bf93fbad485c64 (diff)
Don't dereference a null animationTemplate
If the SpringAnimation gets used inside a Transition, the animationTemplate might get cleared, but updateCurrentTime() still gets called on the SpringAnimation after that. Task-number: QTBUG-34539 Change-Id: I1f27fdbfc594e6ff9a4343e45f7f4001964bb012 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests/auto/quick/qquickspringanimation')
-rw-r--r--tests/auto/quick/qquickspringanimation/data/inTransition.qml22
-rw-r--r--tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp10
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickspringanimation/data/inTransition.qml b/tests/auto/quick/qquickspringanimation/data/inTransition.qml
new file mode 100644
index 0000000000..68d3125e40
--- /dev/null
+++ b/tests/auto/quick/qquickspringanimation/data/inTransition.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 250
+ height: 250
+
+ ListView {
+ anchors.fill: parent
+ model: ListModel {
+ ListElement { text: "A" }
+ ListElement { text: "B" }
+ }
+
+ populate: Transition {
+ SpringAnimation { properties: "x"; from: 0; to: 100; spring: 4; damping: 0.3 }
+ }
+
+ delegate: Text {
+ text: "Test"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
index 78d114c904..137b5c08e4 100644
--- a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
+++ b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
@@ -41,6 +41,7 @@
#include <qtest.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
#include <private/qquickspringanimation_p.h>
#include <private/qqmlvaluetype_p.h>
#include "../../shared/util.h"
@@ -55,6 +56,7 @@ private slots:
void defaultValues();
void values();
void disabled();
+ void inTransition();
private:
QQmlEngine engine;
@@ -128,6 +130,14 @@ void tst_qquickspringanimation::disabled()
delete obj;
}
+void tst_qquickspringanimation::inTransition()
+{
+ QQuickView view(testFileUrl("inTransition.qml"));
+ view.show();
+ // this used to crash after ~1 sec, once the spring animation was done
+ QTest::qWait(2000);
+}
+
QTEST_MAIN(tst_qquickspringanimation)
#include "tst_qquickspringanimation.moc"