void tst_QPauseAnimationJob::pauseAndPropertyAnimations() { EnableConsistentTiming enabled; TestablePauseAnimation pause; pause.setDuration(200); TestableGenericAnimation animation; pause.start(); QTest::qWait(100); animation.start(); QCOMPARE(animation.state(), QAbstractAnimationJob::Running); QTRY_COMPARE(animation.state(), QAbstractAnimationJob::Running); QVERIFY(pause.state() == QAbstractAnimationJob::Running); QVERIFY2(pause.m_updateCurrentTimeCount >= 2, QByteArrayLiteral("pause.m_updateCurrentTimeCount=") + QByteArray::number(pause.m_updateCurrentTimeCount)); QTRY_COMPARE(animation.state(), QAbstractAnimationJob::Stopped); QCOMPARE(pause.state(), QAbstractAnimationJob::Stopped); QVERIFY2(pause.m_updateCurrentTimeCount > 3, QByteArrayLiteral("pause.m_updateCurrentTimeCount=") + QByteArray::number(pause.m_updateCurrentTimeCount)); }
void tst_QPauseAnimationJob::sequentialGroupWithPause() { QSequentialAnimationGroupJob group; TestableGenericAnimation animation; group.appendAnimation(&animation); TestablePauseAnimation pause; pause.setDuration(250); group.appendAnimation(&pause); group.start(); QVERIFY(group.state() == QAbstractAnimationJob::Running); QVERIFY(animation.state() == QAbstractAnimationJob::Running); QVERIFY(pause.state() == QAbstractAnimationJob::Stopped); group.setCurrentTime(300); QVERIFY(group.state() == QAbstractAnimationJob::Running); QVERIFY(animation.state() == QAbstractAnimationJob::Stopped); QCOMPARE((QAbstractAnimationJob*)&pause, group.currentAnimation()); QVERIFY(pause.state() == QAbstractAnimationJob::Running); group.setCurrentTime(600); QVERIFY(group.state() == QAbstractAnimationJob::Stopped); QVERIFY(animation.state() == QAbstractAnimationJob::Stopped); QVERIFY(pause.state() == QAbstractAnimationJob::Stopped); QCOMPARE(pause.m_updateCurrentTimeCount, 2); }
void tst_QPauseAnimationJob::pauseAndPropertyAnimations() { EnableConsistentTiming enabled; TestablePauseAnimation pause; pause.setDuration(200); TestableGenericAnimation animation; pause.start(); QTest::qWait(100); animation.start(); QVERIFY(animation.state() == QAbstractAnimationJob::Running); QVERIFY(pause.state() == QAbstractAnimationJob::Running); QCOMPARE(pause.m_updateCurrentTimeCount, 2); QTest::qWait(animation.totalDuration() + 100); #ifdef Q_OS_WIN if (animation.state() != QAbstractAnimationJob::Stopped) QEXPECT_FAIL("", winTimerError, Abort); #endif QVERIFY(animation.state() == QAbstractAnimationJob::Stopped); QVERIFY(pause.state() == QAbstractAnimationJob::Stopped); QVERIFY(pause.m_updateCurrentTimeCount > 3); }