diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2014-12-18 10:20:03 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2014-12-22 09:26:38 +0100 |
commit | 999321fecb9223bcadc702674ca83d8f84bd3886 (patch) | |
tree | 535aa9b5cc4dcb4ca8b6f0ca9e5622d55e4339ad /tests/auto/corelib/animation | |
parent | 49517ac1dc450b3fe85a2522a191fe5bb2e902d0 (diff) |
Android: Stabilize QPauseAnimation test
This will arbitrarily fail at certain points. Adjusting the
timeouts helps, but it's very unpredictable, so it's better
to do what we do on Windows and just expect-fail the results
that we get.
Change-Id: Ie6033c73539c2dd69115b06096919e173f097367
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'tests/auto/corelib/animation')
-rw-r--r-- | tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp index a966f557f5..1b7f28bbfa 100644 --- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp @@ -39,8 +39,12 @@ #include <private/qabstractanimation_p.h> -#ifdef Q_OS_WIN -static const char winTimerError[] = "On windows, consistent timing is not working properly due to bad timer resolution"; +#if defined(Q_OS_WIN) || defined(Q_OS_ANDROID) +# define BAD_TIMER_RESOLUTION +#endif + +#ifdef BAD_TIMER_RESOLUTION +static const char timerError[] = "On this platform, consistent timing is not working properly due to bad timer resolution"; #endif class TestablePauseAnimation : public QPauseAnimation @@ -140,17 +144,17 @@ void tst_QPauseAnimation::noTimerUpdates() animation.start(); QTest::qWait(animation.totalDuration() + 100); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(animation.state() == QAbstractAnimation::Stopped); const int expectedLoopCount = 1 + loopCount; -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation.m_updateCurrentTimeCount != expectedLoopCount) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QCOMPARE(animation.m_updateCurrentTimeCount, expectedLoopCount); } @@ -169,41 +173,41 @@ void tst_QPauseAnimation::multiplePauseAnimations() animation2.start(); QTest::qWait(animation.totalDuration() + 100); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(animation.state() == QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation2.state() != QAbstractAnimation::Running) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(animation2.state() == QAbstractAnimation::Running); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation.m_updateCurrentTimeCount != 2) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QCOMPARE(animation.m_updateCurrentTimeCount, 2); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation2.m_updateCurrentTimeCount != 2) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QCOMPARE(animation2.m_updateCurrentTimeCount, 2); QTest::qWait(550); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation2.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(animation2.state() == QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation2.m_updateCurrentTimeCount != 3) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QCOMPARE(animation2.m_updateCurrentTimeCount, 3); } @@ -232,9 +236,9 @@ void tst_QPauseAnimation::pauseAndPropertyAnimations() QTest::qWait(animation.totalDuration() + 100); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(animation.state() == QAbstractAnimation::Stopped); QVERIFY(pause.state() == QAbstractAnimation::Stopped); @@ -253,9 +257,9 @@ void tst_QPauseAnimation::pauseResume() animation.start(); QTRY_COMPARE(animation.state(), QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (animation.m_updateCurrentTimeCount < 3) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY2(animation.m_updateCurrentTimeCount >= 3, qPrintable( QString::fromLatin1("animation.m_updateCurrentTimeCount = %1").arg(animation.m_updateCurrentTimeCount))); @@ -408,39 +412,39 @@ void tst_QPauseAnimation::multipleSequentialGroups() // measure... QTest::qWait(group.totalDuration() + 500); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (group.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(group.state() == QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (subgroup1.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(subgroup1.state() == QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (subgroup2.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(subgroup2.state() == QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (subgroup3.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(subgroup3.state() == QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (subgroup4.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QVERIFY(subgroup4.state() == QAbstractAnimation::Stopped); -#ifdef Q_OS_WIN +#ifdef BAD_TIMER_RESOLUTION if (pause5.m_updateCurrentTimeCount != 4) - QEXPECT_FAIL("", winTimerError, Abort); + QEXPECT_FAIL("", timerError, Abort); #endif QCOMPARE(pause5.m_updateCurrentTimeCount, 4); } |