diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-04-21 13:39:37 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-04-21 15:29:44 (GMT) |
commit | ce482e1495c12e531781eb5ad0a20a0c0292f853 (patch) | |
tree | 3b2d54d68ed9d6d5753f1971cb11363a7f7d1d53 /tests/auto/qanimationgroup/tst_qanimationgroup.cpp | |
parent | 04ce953e61acf5a73826b6207cf8bf2cdfce8f92 (diff) | |
download | Qt-ce482e1495c12e531781eb5ad0a20a0c0292f853.zip Qt-ce482e1495c12e531781eb5ad0a20a0c0292f853.tar.gz Qt-ce482e1495c12e531781eb5ad0a20a0c0292f853.tar.bz2 |
QPropertyAnimation reevaluates the default start value after each run
When the start value is not explicitly defined, the property animation
will set the default start to be the current property value when updating
the animation's state to Running.
Reviewed-by: Jan-Arve
Diffstat (limited to 'tests/auto/qanimationgroup/tst_qanimationgroup.cpp')
-rw-r--r-- | tests/auto/qanimationgroup/tst_qanimationgroup.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp index 3cf5631..2952a39 100644 --- a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp @@ -69,6 +69,7 @@ private slots: void setParentAutoAdd(); void beginNestedGroup(); void addChildTwice(); + void loopWithoutStartValue(); }; tst_QAnimationGroup::tst_QAnimationGroup() @@ -377,5 +378,36 @@ void tst_QAnimationGroup::addChildTwice() delete parent; } +void tst_QAnimationGroup::loopWithoutStartValue() +{ + QAnimationGroup *parent = new QSequentialAnimationGroup(); + QObject o; + o.setProperty("ole", 0); + QCOMPARE(o.property("ole").toInt(), 0); + + QPropertyAnimation anim1(&o, "ole"); + anim1.setEndValue(-50); + anim1.setDuration(100); + + QPropertyAnimation anim2(&o, "ole"); + anim2.setEndValue(50); + anim2.setDuration(100); + + parent->addAnimation(&anim1); + parent->addAnimation(&anim2); + + parent->setLoopCount(-1); + parent->start(); + + QVERIFY(anim1.startValue().isNull()); + QCOMPARE(anim1.currentValue().toInt(), 0); + QCOMPARE(parent->currentLoop(), 0); + + parent->setCurrentTime(200); + QCOMPARE(parent->currentLoop(), 1); + QCOMPARE(anim1.currentValue().toInt(), 50); + parent->stop(); +} + QTEST_MAIN(tst_QAnimationGroup) #include "tst_qanimationgroup.moc" |