From: Alan Alpert Date: Mon, 31 Oct 2011 01:47:13 +0000 (+1000) Subject: Stabilize Particles tests some more X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=f32e5f51dd00a0ff6d5864e150d5daa894fe8404;p=konrad%2Fqtdeclarative.git 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 --- diff --git a/tests/auto/particles/qquickage/tst_qquickage.cpp b/tests/auto/particles/qquickage/tst_qquickage.cpp index 73db409..74cd297 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("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("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("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 d21753e..5310d14 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("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 052578f..eeecbe4 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("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 77b1d09..4fd23db 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("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("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 3c73fad..9333ac4 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 7f412c8..ea2139c 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 aca4ea2..c9070cf 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 5613591..41c63de 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("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 e56de35..45f7123 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("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("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("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("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("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 40197ec..c681e2c 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("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 ff45a9e..4929d02 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("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 b2a178f..5d154d7 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("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 b85c57d..d0e4727 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("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 6a64f91..a0c1b65 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("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 19cc471..0b83a41 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("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 6fb2e9c..8e92e8e 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("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 7d83ae8..6e21aef 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("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 6325ca6..d5e01a6 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("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 29faec2..519307e 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 41f09d4..54aded8 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("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;