diff options
-rw-r--r-- | tests/auto/qanimationgroup/tst_qanimationgroup.cpp | 26 | ||||
-rw-r--r-- | tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp | 22 |
2 files changed, 23 insertions, 25 deletions
diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp index 0457f8f..0e98797 100644 --- a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp @@ -206,9 +206,9 @@ void tst_QAnimationGroup::setCurrentTime() // sequence operating on same object/property QSequentialAnimationGroup *sequence = new QSequentialAnimationGroup(); - QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value"); - QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value"); - QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value"); + QAbstractAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value"); + QAbstractAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value"); + QAbstractAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value"); a2_s_o1->setLoopCount(3); sequence->addAnimation(a1_s_o1); sequence->addAnimation(a2_s_o1); @@ -216,25 +216,25 @@ void tst_QAnimationGroup::setCurrentTime() // sequence operating on different object/properties QAnimationGroup *sequence2 = new QSequentialAnimationGroup(); - QVariantAnimation *a1_s_o2 = new QPropertyAnimation(&s_o2, "value"); - QVariantAnimation *a1_s_o3 = new QPropertyAnimation(&s_o3, "value"); + QAbstractAnimation *a1_s_o2 = new QPropertyAnimation(&s_o2, "value"); + QAbstractAnimation *a1_s_o3 = new QPropertyAnimation(&s_o3, "value"); sequence2->addAnimation(a1_s_o2); sequence2->addAnimation(a1_s_o3); // parallel operating on different object/properties QAnimationGroup *parallel = new QParallelAnimationGroup(); - QVariantAnimation *a1_p_o1 = new QPropertyAnimation(&p_o1, "value"); - QVariantAnimation *a1_p_o2 = new QPropertyAnimation(&p_o2, "value"); - QVariantAnimation *a1_p_o3 = new QPropertyAnimation(&p_o3, "value"); + QAbstractAnimation *a1_p_o1 = new QPropertyAnimation(&p_o1, "value"); + QAbstractAnimation *a1_p_o2 = new QPropertyAnimation(&p_o2, "value"); + QAbstractAnimation *a1_p_o3 = new QPropertyAnimation(&p_o3, "value"); a1_p_o2->setLoopCount(3); parallel->addAnimation(a1_p_o1); parallel->addAnimation(a1_p_o2); parallel->addAnimation(a1_p_o3); - UncontrolledAnimation *notTimeDriven = new UncontrolledAnimation(&t_o1, "value"); + QAbstractAnimation *notTimeDriven = new UncontrolledAnimation(&t_o1, "value"); QCOMPARE(notTimeDriven->totalDuration(), -1); - QVariantAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value"); + QAbstractAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value"); loopsForever->setLoopCount(-1); QCOMPARE(loopsForever->totalDuration(), -1); @@ -318,7 +318,7 @@ void tst_QAnimationGroup::setParentAutoAdd() { QParallelAnimationGroup group; QVariantAnimation *animation = new QPropertyAnimation(&group); - QCOMPARE(animation->group(), &group); + QCOMPARE(animation->group(), static_cast<QAnimationGroup*>(&group)); } void tst_QAnimationGroup::beginNestedGroup() @@ -347,8 +347,8 @@ void tst_QAnimationGroup::beginNestedGroup() void tst_QAnimationGroup::addChildTwice() { - QPropertyAnimation *subGroup; - QPropertyAnimation *subGroup2; + QAbstractAnimation *subGroup; + QAbstractAnimation *subGroup2; QAnimationGroup *parent = new QSequentialAnimationGroup(); subGroup = new QPropertyAnimation(); diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 9f66fe0..d7d6b88 100644 --- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -253,16 +253,16 @@ void tst_QParallelAnimationGroup::setCurrentTime() void tst_QParallelAnimationGroup::clearGroup() { QParallelAnimationGroup group; + static const int animationCount = 10; - for (int i = 0; i < 10; ++i) { + for (int i = 0; i < animationCount; ++i) { new QParallelAnimationGroup(&group); } - QCOMPARE(group.animationCount(), 10); + QCOMPARE(group.animationCount(), animationCount); - int count = group.animationCount(); - QPointer<QAbstractAnimation> *children = new QPointer<QAbstractAnimation>[count]; - for (int i = 0; i < count; ++i) { + QPointer<QAbstractAnimation> children[animationCount]; + for (int i = 0; i < animationCount; ++i) { QVERIFY(group.animationAt(i) != 0); children[i] = group.animationAt(i); } @@ -270,10 +270,8 @@ void tst_QParallelAnimationGroup::clearGroup() group.clearAnimations(); QCOMPARE(group.animationCount(), 0); QCOMPARE(group.currentTime(), 0); - for (int i = 0; i < count; ++i) - QCOMPARE(children[i], QPointer<QAbstractAnimation>()); - - delete[] children; + for (int i = 0; i < animationCount; ++i) + QVERIFY(children[i].isNull()); } void tst_QParallelAnimationGroup::propagateGroupUpdateToChildren() @@ -807,15 +805,15 @@ void tst_QParallelAnimationGroup::autoAdd() QParallelAnimationGroup group; QCOMPARE(group.duration(), 0); TestAnimation2 *test = new TestAnimation2(250, &group); // 0, duration = 250; - QCOMPARE(test->group(), &group); + QCOMPARE(test->group(), static_cast<QAnimationGroup*>(&group)); QCOMPARE(test->duration(), 250); QCOMPARE(group.duration(), 250); test = new TestAnimation2(750, &group); // 1 - QCOMPARE(test->group(), &group); + QCOMPARE(test->group(), static_cast<QAnimationGroup*>(&group)); QCOMPARE(group.duration(), 750); test = new TestAnimation2(500, &group); // 2 - QCOMPARE(test->group(), &group); + QCOMPARE(test->group(), static_cast<QAnimationGroup*>(&group)); QCOMPARE(group.duration(), 750); delete group.animationAt(1); // remove the one with duration = 750 |