summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-03-08 01:27:27 +0100
committerJoão Abecasis <joao.abecasis@nokia.com>2012-03-08 01:27:39 +0100
commit12f221410fbe41d0b2efda4cd3289dfcf9044aa8 (patch)
tree897cf6bfb1814b0935982ff5975a6cbfb48d6d9e /tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
parent3d19422ef16a230bb11dbbfe4a8cc9667f39bf15 (diff)
parent6c612c933803ef57ea45e907d0181b40659148ac (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Diffstat (limited to 'tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp')
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
index 534dec8160..05d1569988 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -123,6 +123,7 @@ private slots:
void deletedInUpdateCurrentTime();
void totalDuration();
void zeroLoopCount();
+ void recursiveAnimations();
};
void tst_QPropertyAnimation::initTestCase()
@@ -1237,5 +1238,49 @@ void tst_QPropertyAnimation::zeroLoopCount()
QCOMPARE(finishedSpy.count(), 0);
}
+
+class RecursiveObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+public:
+ RecursiveObject() : m_x(0), m_y(0) {
+ animation.setTargetObject(this);
+ animation.setPropertyName("y");
+ animation.setDuration(30);
+ }
+ qreal x() const { return m_x; }
+ void setX(qreal x) {
+ m_x = x;
+ animation.setEndValue(x);
+ animation.start();
+ }
+ qreal y() const { return m_y; }
+ void setY(qreal y) { m_y = y; }
+
+ qreal m_x;
+ qreal m_y;
+ QPropertyAnimation animation;
+};
+
+
+void tst_QPropertyAnimation::recursiveAnimations()
+{
+ RecursiveObject o;
+ QPropertyAnimation anim;
+ anim.setTargetObject(&o);
+ anim.setPropertyName("x");
+ anim.setDuration(30);
+
+ anim.setEndValue(4000);
+ anim.start();
+ QTest::qWait(anim.duration() + o.animation.duration());
+ QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped);
+ QTRY_COMPARE(o.animation.state(), QAbstractAnimation::Stopped);
+ QCOMPARE(o.y(), qreal(4000));
+}
+
+
QTEST_MAIN(tst_QPropertyAnimation)
#include "tst_qpropertyanimation.moc"