aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/animation
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/animation')
-rw-r--r--tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp3
-rw-r--r--tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp30
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp19
3 files changed, 29 insertions, 23 deletions
diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
index a8bcadbc84..8c4c461813 100644
--- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
@@ -432,8 +432,7 @@ void tst_QParallelAnimationGroupJob::deleteChildrenWithRunningGroup()
QCOMPARE(group.state(), QAnimationGroupJob::Running);
QCOMPARE(anim1->state(), QAnimationGroupJob::Running);
- QTest::qWait(80);
- QVERIFY(group.currentLoopTime() > 0);
+ QTRY_VERIFY(group.currentLoopTime() > 0);
delete anim1;
QVERIFY(!group.firstChild());
diff --git a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
index 8f6b6a2ab7..1d644bf9b5 100644
--- a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
+++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
@@ -32,8 +32,8 @@
#include <QtQml/private/qsequentialanimationgroupjob_p.h>
#include <QtQml/private/qparallelanimationgroupjob_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_MACOS)
+static const char timerError[] = "On some platforms, consistent timing is not working properly due to bad timer resolution";
#endif
class TestablePauseAnimation : public QPauseAnimationJob
@@ -144,7 +144,7 @@ void tst_QPauseAnimationJob::noTimerUpdates()
#ifdef Q_OS_WIN
if (animation.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(animation.state(), QAbstractAnimationJob::Stopped);
@@ -152,7 +152,7 @@ void tst_QPauseAnimationJob::noTimerUpdates()
#ifdef Q_OS_WIN
if (animation.m_updateCurrentTimeCount != expectedLoopCount)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(animation.m_updateCurrentTimeCount, expectedLoopCount);
}
@@ -173,25 +173,25 @@ void tst_QPauseAnimationJob::multiplePauseAnimations()
#ifdef Q_OS_WIN
if (animation.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(animation.state(), QAbstractAnimationJob::Stopped);
#ifdef Q_OS_WIN
if (animation2.state() != QAbstractAnimationJob::Running)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(animation2.state(), QAbstractAnimationJob::Running);
#ifdef Q_OS_WIN
if (animation.m_updateCurrentTimeCount != 2)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(animation.m_updateCurrentTimeCount, 2);
#ifdef Q_OS_WIN
if (animation2.m_updateCurrentTimeCount != 2)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(animation2.m_updateCurrentTimeCount, 2);
@@ -388,7 +388,7 @@ void tst_QPauseAnimationJob::multipleSequentialGroups()
#ifdef Q_OS_WIN
if (group.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
QCOMPARE(group.state(), QAbstractAnimationJob::Stopped);
#else
QTRY_COMPARE(group.state(), QAbstractAnimationJob::Stopped);
@@ -396,31 +396,31 @@ void tst_QPauseAnimationJob::multipleSequentialGroups()
#ifdef Q_OS_WIN
if (subgroup1.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(subgroup1.state(), QAbstractAnimationJob::Stopped);
#ifdef Q_OS_WIN
if (subgroup2.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(subgroup2.state(), QAbstractAnimationJob::Stopped);
#ifdef Q_OS_WIN
if (subgroup3.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(subgroup3.state(), QAbstractAnimationJob::Stopped);
#ifdef Q_OS_WIN
if (subgroup4.state() != QAbstractAnimationJob::Stopped)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(subgroup4.state(), QAbstractAnimationJob::Stopped);
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
if (pause5.m_updateCurrentTimeCount != 4)
- QEXPECT_FAIL("", winTimerError, Abort);
+ QEXPECT_FAIL("", timerError, Abort);
#endif
QCOMPARE(pause5.m_updateCurrentTimeCount, 4);
}
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
index 57b0905a8a..add19273d9 100644
--- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
@@ -1332,6 +1332,8 @@ void tst_QSequentialAnimationGroupJob::stopUncontrolledAnimations()
void tst_QSequentialAnimationGroupJob::finishWithUncontrolledAnimation()
{
+ const int targetDuration = 300;
+
//1st case:
//first we test a group with one uncontrolled animation
QSequentialAnimationGroupJob group;
@@ -1346,7 +1348,7 @@ void tst_QSequentialAnimationGroupJob::finishWithUncontrolledAnimation()
QCOMPARE(group.currentLoopTime(), 0);
QCOMPARE(notTimeDriven.currentLoopTime(), 0);
- QTest::qWait(300); //wait for the end of notTimeDriven
+ QTest::qWait(targetDuration); //wait for the end of notTimeDriven
QTRY_COMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
const int actualDuration = notTimeDriven.currentLoopTime();
QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
@@ -1361,10 +1363,15 @@ void tst_QSequentialAnimationGroupJob::finishWithUncontrolledAnimation()
StateChangeListener animStateChangedSpy;
anim.addAnimationChangeListener(&animStateChangedSpy, QAbstractAnimationJob::StateChange);
- group.setCurrentTime(300);
+ group.setCurrentTime(targetDuration);
QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
- QCOMPARE(notTimeDriven.currentLoopTime(), actualDuration);
- QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&anim));
+ if (actualDuration > targetDuration) {
+ QCOMPARE(notTimeDriven.currentLoopTime(), targetDuration);
+ QCOMPARE(group.currentAnimation(), &notTimeDriven);
+ } else {
+ QCOMPARE(notTimeDriven.currentLoopTime(), actualDuration);
+ QCOMPARE(group.currentAnimation(), &anim);
+ }
//3rd case:
//now let's add a perfectly defined animation at the end
@@ -1377,13 +1384,13 @@ void tst_QSequentialAnimationGroupJob::finishWithUncontrolledAnimation()
QCOMPARE(animStateChangedSpy.count(), 0);
- QTest::qWait(300); //wait for the end of notTimeDriven
+ QTest::qWait(targetDuration); //wait for the end of notTimeDriven
QTRY_COMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
QCOMPARE(group.state(), QAnimationGroupJob::Running);
QCOMPARE(anim.state(), QAnimationGroupJob::Running);
QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&anim));
QCOMPARE(animStateChangedSpy.count(), 1);
- QTest::qWait(300); //wait for the end of anim
+ QTest::qWait(targetDuration); //wait for the end of anim
QTRY_COMPARE(anim.state(), QAnimationGroupJob::Stopped);
QCOMPARE(anim.currentLoopTime(), anim.duration());