diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-10-31 11:47:13 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-31 04:29:03 +0100 |
commit | f32e5f51dd00a0ff6d5864e150d5daa894fe8404 (patch) | |
tree | af1df471ecd4363e35302572340e19439c40b037 /tests/auto/particles | |
parent | f0e6418fc1c237c1c1d71834c26a396f0b8ab28e (diff) |
Stabilize Particles tests some more
Odd timings can lead to slight variances in the particle groups size,
this is allowable in autotests. Also fixes incorrect use of
extremelyFuzzyCompare in tst_qquickage.
Change-Id: Ibea3a2b2a3a31ab1fe6d908c1676d865db9ba968
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/particles')
20 files changed, 32 insertions, 32 deletions
diff --git a/tests/auto/particles/qquickage/tst_qquickage.cpp b/tests/auto/particles/qquickage/tst_qquickage.cpp index 73db409de3..74cd29729d 100644 --- a/tests/auto/particles/qquickage/tst_qquickage.cpp +++ b/tests/auto/particles/qquickage/tst_qquickage.cpp @@ -68,7 +68,7 @@ void tst_qquickage::test_kill() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -92,14 +92,14 @@ void tst_qquickage::test_jump() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused - //Allow for a small variance because jump is trying to simulate off wall time - extremelyFuzzyCompare(d->x, -100.f, 5.0f); - extremelyFuzzyCompare(d->y, -100.f, 5.0f); + //Allow for variance because jump is trying to simulate off wall time and things have emitted 'continuously' before first affect + QVERIFY(d->x <= -50.f); + QVERIFY(d->y <= -50.f); QCOMPARE(d->vx, 500.f); QCOMPARE(d->vy, 500.f); QCOMPARE(d->ax, 0.f); @@ -117,7 +117,7 @@ void tst_qquickage::test_onceOff() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -142,7 +142,7 @@ void tst_qquickage::test_sustained() ensureAnimTime(600, system->m_animation); //TODO: Ensure some particles have lived to 0.4s point despite unified timer - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp index d21753e8a0..5310d14a36 100644 --- a/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp +++ b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp @@ -66,7 +66,7 @@ void tst_qquickangleddirection::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp index 052578f3a8..eeecbe4d3d 100644 --- a/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp +++ b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp @@ -65,7 +65,7 @@ void tst_qquickcumulativedirection::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp index 77b1d09763..4fd23db238 100644 --- a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp +++ b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp @@ -66,7 +66,7 @@ void tst_qquickcustomaffector::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -90,7 +90,7 @@ void tst_qquickcustomaffector::test_move() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp b/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp index 3c73fad3f3..9333ac4f2d 100644 --- a/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp +++ b/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp @@ -67,7 +67,7 @@ void tst_qquickcustomparticle::test_basic() ensureAnimTime(600, system->m_animation); bool oneNonZero = false; - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp index 7f412c8521..ea2139c16a 100644 --- a/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp +++ b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp @@ -82,7 +82,7 @@ void tst_qquickellipseextruder::test_basic() ensureAnimTime(600, system->m_animation); //Filled - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp index aca4ea2330..c9070cf107 100644 --- a/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp +++ b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp @@ -67,7 +67,7 @@ void tst_qquickfriction::test_basic() ensureAnimTime(600, system->m_animation); //Default is just slowed a little - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -110,7 +110,7 @@ void tst_qquickfriction::test_threshold() ensureAnimTime(600, system->m_animation); //Speed capped at 50, but it might take a frame or two to get there - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1.0f) continue; //Particle data unused diff --git a/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp index 5613591171..41c63ded42 100644 --- a/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp +++ b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp @@ -65,7 +65,7 @@ void tst_qquickgravity::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp index e56de35137..45f7123985 100644 --- a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp +++ b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp @@ -71,7 +71,7 @@ void tst_qquickimageparticle::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -114,7 +114,7 @@ void tst_qquickimageparticle::test_colored() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -157,7 +157,7 @@ void tst_qquickimageparticle::test_deformed() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -200,7 +200,7 @@ void tst_qquickimageparticle::test_tabled() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused @@ -244,7 +244,7 @@ void tst_qquickimageparticle::test_sprite() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp index 40197ec619..c681e2ce9f 100644 --- a/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp +++ b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp @@ -66,7 +66,7 @@ void tst_qquickitemparticle::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp index ff45a9e92c..4929d02f1e 100644 --- a/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp +++ b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp @@ -65,7 +65,7 @@ void tst_qquicklineextruder::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp index b2a178fa1c..5d154d73d8 100644 --- a/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp +++ b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp @@ -65,7 +65,7 @@ void tst_qquickmaskextruder::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp index b85c57da0b..d0e4727f06 100644 --- a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp +++ b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp @@ -65,7 +65,7 @@ void tst_qquickparticlesystem::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); int stillAlive = 0; foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) diff --git a/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp index 6a64f919c0..a0c1b6598d 100644 --- a/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp +++ b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp @@ -65,7 +65,7 @@ void tst_qquickpointattractor::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp index 19cc471126..0b83a41f23 100644 --- a/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp +++ b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp @@ -65,7 +65,7 @@ void tst_qquickpointdirection::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp index 6fb2e9cae8..8e92e8ed4d 100644 --- a/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp +++ b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp @@ -65,7 +65,7 @@ void tst_qquickrectangleextruder::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp index 7d83ae8830..6e21aef164 100644 --- a/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp +++ b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp @@ -65,7 +65,7 @@ void tst_qquicktargetdirection::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp index 6325ca6efe..d5e01a6f71 100644 --- a/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp +++ b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp @@ -65,7 +65,7 @@ void tst_qquicktrailemitter::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp index 29faec2381..519307ebf2 100644 --- a/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp +++ b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp @@ -67,7 +67,7 @@ void tst_qquickturbulence::test_basic() //Note that the noise image built-in provides the 'randomness', so this test should be stable so long as it and the size //of the Turbulence item remain the same - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); foreach (QQuickParticleData *d, system->groupData[0]->data) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickwander/tst_qquickwander.cpp b/tests/auto/particles/qquickwander/tst_qquickwander.cpp index 41f09d4993..54aded8fdc 100644 --- a/tests/auto/particles/qquickwander/tst_qquickwander.cpp +++ b/tests/auto/particles/qquickwander/tst_qquickwander.cpp @@ -65,7 +65,7 @@ void tst_qquickwander::test_basic() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(600, system->m_animation); - QCOMPARE(system->groupData[0]->size(), 500); + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); //Since Wander is random perturbations, the compromise between stability and actual testing is to hope that one of //the 500 was randomly changed from 0.0 in velocity bool vxChanged = false; |