summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/animation/qparallelanimationgroup
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-12-22 17:16:48 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-28 04:48:11 +0100
commitea415e20607016651f3cef02dff109235d84eb4d (patch)
tree8c954afe7d078b0ca742a1f2249ccc5a9ddf1b82 /tests/auto/corelib/animation/qparallelanimationgroup
parent1e7296f3f2e7346f52e8f70d4e531405a248aa8b (diff)
Cleanup corelib autotests.
When using QSignalSpy, always verify that the signal spy is valid. This will cause the test to give a meaningful failure when spying on a non-existant signal. Without this change, tests that spy on a signal to ensure that it is not emitted (i.e. by comparing the spy count to zero) could pass erroneously if something went wrong when creating the signal spy, as an invalid QSignalSpy will always return a count of zero. Change-Id: I41f4a63d9f0de9190a86de237662dc96be802446 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/animation/qparallelanimationgroup')
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index e091666c2a..3f65d079ca 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -261,6 +261,11 @@ void tst_QParallelAnimationGroup::stateChanged()
QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(spy1.isValid());
+ QVERIFY(spy2.isValid());
+ QVERIFY(spy3.isValid());
+ QVERIFY(spy4.isValid());
+
//first; let's start forward
group.start();
//all the animations should be started
@@ -432,6 +437,9 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(groupStateChangedSpy.isValid());
+ QVERIFY(childStateChangedSpy.isValid());
+
QCOMPARE(groupStateChangedSpy.count(), 0);
QCOMPARE(childStateChangedSpy.count(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
@@ -596,6 +604,9 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(stateChangedSpy1.isValid());
+ QVERIFY(stateChangedSpy2.isValid());
+
QCOMPARE(stateChangedSpy1.count(), 0);
QCOMPARE(stateChangedSpy2.count(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
@@ -661,12 +672,21 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation()
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy1(&anim1, SIGNAL(finished()));
+ QVERIFY(stateChangedSpy1.isValid());
+ QVERIFY(finishedSpy1.isValid());
+
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy2(&anim2, SIGNAL(finished()));
+ QVERIFY(stateChangedSpy2.isValid());
+ QVERIFY(finishedSpy2.isValid());
+
QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy3(&anim3, SIGNAL(finished()));
+ QVERIFY(stateChangedSpy3.isValid());
+ QVERIFY(finishedSpy3.isValid());
+
group.addAnimation(&anim1);
group.addAnimation(&anim2);
group.addAnimation(&anim3);
@@ -741,6 +761,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations()
loopsForever.setLoopCount(-1);
QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(stateChangedSpy.isValid());
group.addAnimation(&anim1);
group.addAnimation(&notTimeDriven);
@@ -948,6 +969,7 @@ void tst_QParallelAnimationGroup::pauseResume()
QParallelAnimationGroup group;
TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250;
QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(spy.isValid());
QCOMPARE(group.duration(), 250);
group.start();
QTest::qWait(100);