diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-04-21 11:06:50 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-04-21 11:06:50 (GMT) |
commit | 1d150321ab0137b926ec226fcb868f3b38c36bfd (patch) | |
tree | 85b60d9295ef49c3971aa7a7ec93ac0369e71c7f /tests/auto | |
parent | 9ac25b0286f99e5c4d996a9e5b850cfe3eb8a5dd (diff) | |
parent | a5248cd47a6d210c8faec20a8d962c88bbeb7846 (diff) | |
download | Qt-1d150321ab0137b926ec226fcb868f3b38c36bfd.zip Qt-1d150321ab0137b926ec226fcb868f3b38c36bfd.tar.gz Qt-1d150321ab0137b926ec226fcb868f3b38c36bfd.tar.bz2 |
Merge branch 'kinetic-animations' into kinetic-statemachine
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qanimationgroup/tst_qanimationgroup.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp index a7d616a..3cf5631 100644 --- a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp @@ -68,6 +68,7 @@ private slots: void statesAndSignals(); void setParentAutoAdd(); void beginNestedGroup(); + void addChildTwice(); }; tst_QAnimationGroup::tst_QAnimationGroup() @@ -343,5 +344,38 @@ void tst_QAnimationGroup::beginNestedGroup() } } +void tst_QAnimationGroup::addChildTwice() +{ + QPropertyAnimation *subGroup; + QPropertyAnimation *subGroup2; + QAnimationGroup *parent = new QSequentialAnimationGroup(); + + subGroup = new QPropertyAnimation(); + subGroup->setParent(parent); + parent->addAnimation(subGroup); + QCOMPARE(parent->animationCount(), 1); + + parent->clearAnimations(); + + QCOMPARE(parent->animationCount(), 0); + + // adding the same item twice to a group will remove the item from its current position + // and append it to the end + subGroup = new QPropertyAnimation(parent); + subGroup2 = new QPropertyAnimation(parent); + + QCOMPARE(parent->animationCount(), 2); + QCOMPARE(parent->animationAt(0), subGroup); + QCOMPARE(parent->animationAt(1), subGroup2); + + parent->addAnimation(subGroup); + + QCOMPARE(parent->animationCount(), 2); + QCOMPARE(parent->animationAt(0), subGroup2); + QCOMPARE(parent->animationAt(1), subGroup); + + delete parent; +} + QTEST_MAIN(tst_QAnimationGroup) #include "tst_qanimationgroup.moc" |