aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/particles
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/particles')
-rw-r--r--tests/auto/particles/qsgage/tst_qsgage.cpp14
-rw-r--r--tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp3
-rw-r--r--tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp3
-rw-r--r--tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp5
-rw-r--r--tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp3
-rw-r--r--tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp6
-rw-r--r--tests/auto/particles/qsgfriction/tst_qsgfriction.cpp6
-rw-r--r--tests/auto/particles/qsggravity/tst_qsggravity.cpp3
-rw-r--r--tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp3
-rw-r--r--tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp3
-rw-r--r--tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp6
-rw-r--r--tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp3
-rw-r--r--tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp3
-rw-r--r--tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp7
-rw-r--r--tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp3
-rw-r--r--tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp3
-rw-r--r--tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp6
-rw-r--r--tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp3
-rw-r--r--tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp6
-rw-r--r--tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp3
-rw-r--r--tests/auto/particles/qsgwander/tst_qsgwander.cpp3
21 files changed, 89 insertions, 6 deletions
diff --git a/tests/auto/particles/qsgage/tst_qsgage.cpp b/tests/auto/particles/qsgage/tst_qsgage.cpp
index 45267e5046..b58d4558a3 100644
--- a/tests/auto/particles/qsgage/tst_qsgage.cpp
+++ b/tests/auto/particles/qsgage/tst_qsgage.cpp
@@ -67,8 +67,9 @@ void tst_qsgage::test_kill()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
- if (d->t == -1) //Recycler out-smarted me and never needed to init this datum
- continue;
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 1000.f);
@@ -89,6 +90,9 @@ void tst_qsgage::test_jump()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *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);
@@ -111,7 +115,8 @@ void tst_qsgage::test_onceOff()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
- continue; //Recycling process means not all initialized/used
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 500.f);
@@ -133,7 +138,8 @@ void tst_qsgage::test_sustained()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
- continue; //Recycling process means not all initialized/used
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 500.f);
diff --git a/tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp b/tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp
index 4e65fa4a2f..ea1d4ee6cf 100644
--- a/tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp
+++ b/tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp
@@ -65,6 +65,9 @@ void tst_qsgangleddirection::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QVERIFY(qFuzzyCompare(d->vx, 353.55339f));
diff --git a/tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp b/tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp
index 1c4e98cb9a..678b7493b8 100644
--- a/tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp
+++ b/tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp
@@ -64,6 +64,9 @@ void tst_qsgcumulativedirection::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(myFuzzyCompare(d->x, 0.0f));
QVERIFY(myFuzzyCompare(d->y, 0.0f));
QVERIFY(myFuzzyCompare(d->vx, 0.0f));
diff --git a/tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp b/tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp
index 2a7e978b8b..d5ae596ce5 100644
--- a/tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp
+++ b/tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp
@@ -64,8 +64,9 @@ void tst_qsgcustomaffector::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
- if (d->t == -1) //Recycler out-smarted me and never needed to init this datum
- continue;
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 100.f);
QCOMPARE(d->y, 100.f);
QCOMPARE(d->vx, 100.f);
diff --git a/tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp b/tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp
index 01d557de57..239a135ad3 100644
--- a/tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp
+++ b/tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp
@@ -66,6 +66,9 @@ void tst_qsgcustomparticle::test_basic()
bool oneNonZero = false;
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 0.f);
diff --git a/tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp b/tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp
index a5aa91b500..02b217329b 100644
--- a/tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp
+++ b/tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp
@@ -81,6 +81,9 @@ void tst_qsgellipseextruder::test_basic()
//Filled
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(inCircle(d->x, d->y, 160, false));
QCOMPARE(d->vx, 0.f);
QCOMPARE(d->vy, 0.f);
@@ -94,6 +97,9 @@ void tst_qsgellipseextruder::test_basic()
//Just border
QCOMPARE(system->groupData[1]->size(), 500);
foreach (QSGParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(inCircle(d->x, d->y, 160, true));
QCOMPARE(d->vx, 0.f);
QCOMPARE(d->vy, 0.f);
diff --git a/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp b/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
index c56e004732..2d835de45a 100644
--- a/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
+++ b/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
@@ -65,6 +65,9 @@ void tst_qsgfriction::test_basic()
//Default is just slowed a little
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(d->vx < 100.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vy, 0.f);
@@ -79,6 +82,9 @@ void tst_qsgfriction::test_basic()
//Nondefault comes to a complete stop within the first half of its life
QCOMPARE(system->groupData[1]->size(), 500);
foreach (QSGParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
if (d->t > ((qreal)system->timeInt/1000.0) - 0.25)
continue;
QVERIFY(myFuzzyCompare(d->vx, 0.f));
diff --git a/tests/auto/particles/qsggravity/tst_qsggravity.cpp b/tests/auto/particles/qsggravity/tst_qsggravity.cpp
index e99aa1e3c9..e30d261e18 100644
--- a/tests/auto/particles/qsggravity/tst_qsggravity.cpp
+++ b/tests/auto/particles/qsggravity/tst_qsggravity.cpp
@@ -64,6 +64,9 @@ void tst_qsggravity::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->ax, 707.10678f);
QCOMPARE(d->ay, 707.10678f);
QCOMPARE(d->lifeSpan, 0.5f);
diff --git a/tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp b/tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp
index 423e842dc5..e46dc4ada3 100644
--- a/tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp
+++ b/tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp
@@ -64,6 +64,9 @@ void tst_qsgimageparticle::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 0.f);
diff --git a/tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp b/tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp
index 2d1876465c..f2307ed153 100644
--- a/tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp
+++ b/tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp
@@ -65,6 +65,9 @@ void tst_qsgitemparticle::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 0.f);
diff --git a/tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp b/tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp
index 602985b003..2d43f7b585 100644
--- a/tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp
+++ b/tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp
@@ -64,6 +64,9 @@ void tst_qsglineextruder::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, d->y);
QCOMPARE(d->vx, 0.f);
QCOMPARE(d->vy, 0.f);
@@ -77,6 +80,9 @@ void tst_qsglineextruder::test_basic()
QCOMPARE(system->groupData[1]->size(), 500);
foreach (QSGParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x + d->y, 320.0f);
QCOMPARE(d->vx, 0.f);
QCOMPARE(d->vy, 0.f);
diff --git a/tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp b/tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp
index 483ad9370f..cdd5808cc8 100644
--- a/tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp
+++ b/tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp
@@ -64,6 +64,9 @@ void tst_qsgmaskextruder::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(d->x >= 100.0f && d->x <= 200.0f);
QVERIFY(d->y >= 100.0f && d->y <= 200.0f);
QCOMPARE(d->vx, 0.f);
diff --git a/tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp b/tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp
index 5cf170c851..fd1709ba4a 100644
--- a/tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp
+++ b/tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp
@@ -65,6 +65,9 @@ void tst_qsgparticlegroup::test_instantTransition()
//A frame or two worth of particles will be missed, the transition doesn't take effect on the frame it's spawned (QTBUG-21781)
QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 0.f);
diff --git a/tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp b/tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp
index cf00a00f0d..ade9ca929e 100644
--- a/tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp
+++ b/tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp
@@ -63,7 +63,13 @@ void tst_qsgparticlesystem::test_basic()
QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
QCOMPARE(system->groupData[0]->size(), 500);
+ int stillAlive = 0;
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ if (d->stillAlive())
+ stillAlive++;
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 0.f);
@@ -75,6 +81,7 @@ void tst_qsgparticlesystem::test_basic()
QCOMPARE(d->endSize, 32.f);
QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
}
+ QVERIFY(extremelyFuzzyCompare(stillAlive, 500, 5));//Small simulation variance is permissible.
}
QTEST_MAIN(tst_qsgparticlesystem);
diff --git a/tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp b/tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp
index 40877c4aa5..ef3b06a738 100644
--- a/tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp
+++ b/tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp
@@ -64,6 +64,9 @@ void tst_qsgpointattractor::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(d->x != 0.f);
QVERIFY(d->y != 0.f);
QVERIFY(d->x == d->y);
diff --git a/tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp b/tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp
index 56ef9cbc3e..4752f1c98b 100644
--- a/tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp
+++ b/tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp
@@ -64,6 +64,9 @@ void tst_qsgpointdirection::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 100.f);
diff --git a/tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp b/tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp
index 80def8b1a5..b8cda61842 100644
--- a/tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp
+++ b/tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp
@@ -64,6 +64,9 @@ void tst_qsgrectangleextruder::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(d->x >= 0.f);
QVERIFY(d->x <= 100.f);
QVERIFY(d->y >= 0.f);
@@ -80,6 +83,9 @@ void tst_qsgrectangleextruder::test_basic()
QCOMPARE(system->groupData[1]->size(), 500);
foreach (QSGParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
if (!myFuzzyCompare(d->x, 0.f) && !myFuzzyCompare(d->x, 100.f)){
QVERIFY(d->x >= 0.f);
QVERIFY(d->x <= 100.f);
diff --git a/tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp b/tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp
index 642ef28aa6..0f37fc0f72 100644
--- a/tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp
+++ b/tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp
@@ -64,6 +64,9 @@ void tst_qsgtargetdirection::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 160.f);
diff --git a/tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp b/tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp
index e6073efd34..29e9d90499 100644
--- a/tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp
+++ b/tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp
@@ -64,6 +64,9 @@ void tst_qsgtrailemitter::test_basic()
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 4.f);
QCOMPARE(d->y, 4.f);
QCOMPARE(d->vx, 0.f);
@@ -78,6 +81,9 @@ void tst_qsgtrailemitter::test_basic()
QCOMPARE(system->groupData[1]->size(), 500);
foreach (QSGParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->x, 4.f);
QCOMPARE(d->y, 4.f);
QCOMPARE(d->vx, 500.f);
diff --git a/tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp b/tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp
index 202de29340..155b109ff9 100644
--- a/tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp
+++ b/tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp
@@ -66,6 +66,9 @@ void tst_qsgturbulence::test_basic()
//of the Turbulence item remain the same
QCOMPARE(system->groupData[0]->size(), 500);
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QVERIFY(d->vx != 0.f);
QVERIFY(d->vy != 0.f);
QCOMPARE(d->lifeSpan, 0.5f);
diff --git a/tests/auto/particles/qsgwander/tst_qsgwander.cpp b/tests/auto/particles/qsgwander/tst_qsgwander.cpp
index 6e7bc17e17..0a7324862e 100644
--- a/tests/auto/particles/qsgwander/tst_qsgwander.cpp
+++ b/tests/auto/particles/qsgwander/tst_qsgwander.cpp
@@ -68,6 +68,9 @@ void tst_qsgwander::test_basic()
bool vxChanged = false;
bool vyChanged = false;
foreach (QSGParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
QCOMPARE(d->ax, 0.f);
QCOMPARE(d->ay, 0.f);
QCOMPARE(d->lifeSpan, 0.5f);