summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-12-01 12:01:02 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-02 08:24:57 +0100
commitb0b22e8d496e753642fa8ddb05f167a722c65c00 (patch)
tree7284e46a754eddc7942f7dfd108fd1fdb76cc82c /tests/auto
parent2a3738265a873307077067ab02bc1a31a9ddc49a (diff)
Windows: Stabilize qpauseanimation test.
Change-Id: I93b470d89009d4573cbe3ec5018cddc40f4a4623 Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp73
1 files changed, 65 insertions, 8 deletions
diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
index ae68827516..b01cfcccce 100644
--- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
@@ -50,6 +50,10 @@
//TESTED_CLASS=QPauseAnimation
//TESTED_FILES=
+#ifdef Q_OS_WIN
+static const char winTimerError[] = "On windows, consistent timing is not working properly due to bad timer resolution";
+#endif
+
class TestablePauseAnimation : public QPauseAnimation
{
Q_OBJECT
@@ -149,11 +153,17 @@ void tst_QPauseAnimation::noTimerUpdates()
#ifdef Q_OS_WIN
if (animation.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort);
+ QEXPECT_FAIL("", winTimerError, Abort);
#endif
QVERIFY(animation.state() == QAbstractAnimation::Stopped);
- QCOMPARE(animation.m_updateCurrentTimeCount, 1 + loopCount);
+ const int expectedLoopCount = 1 + loopCount;
+
+#ifdef Q_OS_WIN
+ if (animation.m_updateCurrentTimeCount != expectedLoopCount)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QCOMPARE(animation.m_updateCurrentTimeCount, expectedLoopCount);
}
void tst_QPauseAnimation::multiplePauseAnimations()
@@ -172,22 +182,40 @@ void tst_QPauseAnimation::multiplePauseAnimations()
#ifdef Q_OS_WIN
if (animation.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort);
+ QEXPECT_FAIL("", winTimerError, Abort);
#endif
-
QVERIFY(animation.state() == QAbstractAnimation::Stopped);
+
+#ifdef Q_OS_WIN
+ if (animation2.state() != QAbstractAnimation::Running)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QVERIFY(animation2.state() == QAbstractAnimation::Running);
+
+#ifdef Q_OS_WIN
+ if (animation.m_updateCurrentTimeCount != 2)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QCOMPARE(animation.m_updateCurrentTimeCount, 2);
+
+#ifdef Q_OS_WIN
+ if (animation2.m_updateCurrentTimeCount != 2)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QCOMPARE(animation2.m_updateCurrentTimeCount, 2);
QTest::qWait(550);
#ifdef Q_OS_WIN
if (animation2.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort);
+ QEXPECT_FAIL("", winTimerError, Abort);
#endif
-
QVERIFY(animation2.state() == QAbstractAnimation::Stopped);
+
+#ifdef Q_OS_WIN
+ if (animation2.m_updateCurrentTimeCount != 3)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QCOMPARE(animation2.m_updateCurrentTimeCount, 3);
}
@@ -217,7 +245,7 @@ void tst_QPauseAnimation::pauseAndPropertyAnimations()
#ifdef Q_OS_WIN
if (animation.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort);
+ QEXPECT_FAIL("", winTimerError, Abort);
#endif
QVERIFY(animation.state() == QAbstractAnimation::Stopped);
QVERIFY(pause.state() == QAbstractAnimation::Stopped);
@@ -236,6 +264,11 @@ void tst_QPauseAnimation::pauseResume()
animation.start();
QTest::qWait(300);
QVERIFY(animation.state() == QAbstractAnimation::Stopped);
+
+#ifdef Q_OS_WIN
+ if (animation.m_updateCurrentTimeCount != 3)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QCOMPARE(animation.m_updateCurrentTimeCount, 3);
}
@@ -388,14 +421,38 @@ void tst_QPauseAnimation::multipleSequentialGroups()
#ifdef Q_OS_WIN
if (group.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort);
+ QEXPECT_FAIL("", winTimerError, Abort);
#endif
QVERIFY(group.state() == QAbstractAnimation::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup1.state() != QAbstractAnimation::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QVERIFY(subgroup1.state() == QAbstractAnimation::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup2.state() != QAbstractAnimation::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QVERIFY(subgroup2.state() == QAbstractAnimation::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup3.state() != QAbstractAnimation::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QVERIFY(subgroup3.state() == QAbstractAnimation::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup4.state() != QAbstractAnimation::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QVERIFY(subgroup4.state() == QAbstractAnimation::Stopped);
+#ifdef Q_OS_WIN
+ if (pause5.m_updateCurrentTimeCount != 4)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
QCOMPARE(pause5.m_updateCurrentTimeCount, 4);
}