aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-10-17 12:02:22 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-17 05:46:16 +0200
commitaf3b3cd20060f7a55d64bd7b7533854267d133f7 (patch)
treeabfe6c33f9f44ed948b5f10cedc81923ca3ec3fe /tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
parentcec7b67ec38934560c19a4e4361d684c25143fa8 (diff)
Stabilize Particles Tests
A couple of targeted fixes, plus enabling QUnifiedTimer::consistentTiming. Task-number: QTBUG-21867 Change-Id: I62acf524eb2c6491bc88fd687a0065866d7ce8aa Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/particles/qsgfriction/tst_qsgfriction.cpp')
-rw-r--r--tests/auto/particles/qsgfriction/tst_qsgfriction.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp b/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
index 2d835de45a..bc622e4648 100644
--- a/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
+++ b/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
#include <private/qsgparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
class tst_qsgfriction : public QObject
{
@@ -55,12 +56,14 @@ private slots:
tst_qsgfriction::tst_qsgfriction()
{
+ QUnifiedTimer::instance()->setConsistentTiming(true);
}
void tst_qsgfriction::test_basic()
{
QSGView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
//Default is just slowed a little
QCOMPARE(system->groupData[0]->size(), 500);
@@ -76,7 +79,7 @@ void tst_qsgfriction::test_basic()
QCOMPARE(d->lifeSpan, 0.5f);
QCOMPARE(d->size, 32.f);
QCOMPARE(d->endSize, 32.f);
- QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
}
//Nondefault comes to a complete stop within the first half of its life
@@ -95,7 +98,7 @@ void tst_qsgfriction::test_basic()
QCOMPARE(d->lifeSpan, 0.5f);
QCOMPARE(d->size, 32.f);
QCOMPARE(d->endSize, 32.f);
- QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
}
}