Initial commit of particle system autotests
authorAlan Alpert <alan.alpert@nokia.com>
Fri, 30 Sep 2011 08:25:17 +0000 (18:25 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 3 Oct 2011 02:53:54 +0000 (04:53 +0200)
Just some basic autotests for most of the elements.

Change-Id: I2d289f38f362a38c69e03ff92154c98db3c4c486
Reviewed-on: http://codereview.qt-project.org/5844
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
74 files changed:
src/declarative/particles/qsgcustomparticle.cpp
src/declarative/particles/qsgfriction.cpp
src/declarative/particles/qsgparticlesystem_p.h
src/declarative/particles/qsgrectangleextruder.cpp
src/declarative/particles/qsgrectangleextruder_p.h
tests/auto/particles/qsgage/data/jump.qml [new file with mode: 0644]
tests/auto/particles/qsgage/data/kill.qml [new file with mode: 0644]
tests/auto/particles/qsgage/data/onceoff.qml [new file with mode: 0644]
tests/auto/particles/qsgage/data/sustained.qml [new file with mode: 0644]
tests/auto/particles/qsgage/qsgage.pro [new file with mode: 0644]
tests/auto/particles/qsgage/tst_qsgage.cpp [new file with mode: 0644]
tests/auto/particles/qsgangleddirection/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgangleddirection/qsgangleddirection.pro [new file with mode: 0644]
tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp [new file with mode: 0644]
tests/auto/particles/qsgcumulativedirection/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgcumulativedirection/qsgcumulativedirection.pro [new file with mode: 0644]
tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp [new file with mode: 0644]
tests/auto/particles/qsgcustomaffector/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgcustomaffector/qsgcustomaffector.pro [new file with mode: 0644]
tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp [new file with mode: 0644]
tests/auto/particles/qsgcustomparticle/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgcustomparticle/qsgcustomparticle.pro [new file with mode: 0644]
tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp [new file with mode: 0644]
tests/auto/particles/qsgellipseextruder/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgellipseextruder/qsgellipseextruder.pro [new file with mode: 0644]
tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp [new file with mode: 0644]
tests/auto/particles/qsgfriction/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgfriction/qsgfriction.pro [new file with mode: 0644]
tests/auto/particles/qsgfriction/tst_qsgfriction.cpp [new file with mode: 0644]
tests/auto/particles/qsggravity/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsggravity/qsggravity.pro [new file with mode: 0644]
tests/auto/particles/qsggravity/tst_qsggravity.cpp [new file with mode: 0644]
tests/auto/particles/qsgimageparticle/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgimageparticle/qsgimageparticle.pro [new file with mode: 0644]
tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp [new file with mode: 0644]
tests/auto/particles/qsgitemparticle/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgitemparticle/qsgitemparticle.pro [new file with mode: 0644]
tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp [new file with mode: 0644]
tests/auto/particles/qsglineextruder/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsglineextruder/qsglineextruder.pro [new file with mode: 0644]
tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp [new file with mode: 0644]
tests/auto/particles/qsgmaskextruder/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgmaskextruder/data/smallmask.png [new file with mode: 0644]
tests/auto/particles/qsgmaskextruder/qsgmaskextruder.pro [new file with mode: 0644]
tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp [new file with mode: 0644]
tests/auto/particles/qsgparticlegroup/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgparticlegroup/qsgparticlegroup.pro [new file with mode: 0644]
tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp [new file with mode: 0644]
tests/auto/particles/qsgparticlesystem/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgparticlesystem/qsgparticlesystem.pro [new file with mode: 0644]
tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp [new file with mode: 0644]
tests/auto/particles/qsgpointattractor/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgpointattractor/qsgpointattractor.pro [new file with mode: 0644]
tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp [new file with mode: 0644]
tests/auto/particles/qsgpointdirection/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgpointdirection/qsgpointdirection.pro [new file with mode: 0644]
tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp [new file with mode: 0644]
tests/auto/particles/qsgrectangleextruder/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgrectangleextruder/qsgrectangleextruder.pro [new file with mode: 0644]
tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp [new file with mode: 0644]
tests/auto/particles/qsgtargetdirection/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgtargetdirection/qsgtargetdirection.pro [new file with mode: 0644]
tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp [new file with mode: 0644]
tests/auto/particles/qsgtrailemitter/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgtrailemitter/qsgtrailemitter.pro [new file with mode: 0644]
tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp [new file with mode: 0644]
tests/auto/particles/qsgturbulence/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgturbulence/qsgturbulence.pro [new file with mode: 0644]
tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp [new file with mode: 0644]
tests/auto/particles/qsgwander/data/basic.qml [new file with mode: 0644]
tests/auto/particles/qsgwander/qsgwander.pro [new file with mode: 0644]
tests/auto/particles/qsgwander/tst_qsgwander.cpp [new file with mode: 0644]
tests/auto/particles/shared/particlestestsshared.h [new file with mode: 0644]
tests/auto/particles/shared/star.png [new file with mode: 0644]

index 5aad023..89e465b 100644 (file)
@@ -79,7 +79,7 @@ static const char qt_particles_default_fragment_code[] =
         "varying highp vec2 qt_TexCoord0;                           \n"
         "uniform lowp float qt_Opacity;                             \n"
         "void main() {                                              \n"
-        "    gl_FragColor = texture2D(source, fTex) * qt_Opacity;   \n"
+        "    gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;   \n"
         "}";
 
 static QSGGeometry::Attribute PlainParticle_Attributes[] = {
index 031fc89..44b08e3 100644 (file)
@@ -54,6 +54,10 @@ QT_BEGIN_NAMESPACE
 
     A drag will be applied to moving objects which is this factor of their current velocity.
 */
+static qreal sign(qreal a)
+{
+    return a >= 0 ? 1 : -1;
+}
 
 QSGFrictionAffector::QSGFrictionAffector(QSGItem *parent) :
     QSGParticleAffector(parent), m_factor(0.0)
@@ -66,8 +70,17 @@ bool QSGFrictionAffector::affectParticle(QSGParticleData *d, qreal dt)
         return false;
     qreal curVX = d->curVX();
     qreal curVY = d->curVY();
-    d->setInstantaneousVX(curVX + (curVX * m_factor * -1 * dt));
-    d->setInstantaneousVY(curVY + (curVY * m_factor * -1 * dt));
+    qreal newVX = curVX + (curVX * m_factor * -1 * dt);
+    qreal newVY = curVY + (curVY * m_factor * -1 * dt);
+
+    //Since we're modelling a continuous function, it will never pass 0.
+    if (sign(curVX) != sign(newVX))
+        newVX = 0;
+    if (sign(curVY) != sign(newVY))
+        newVY = 0;
+
+    d->setInstantaneousVX(newVX);
+    d->setInstantaneousVY(newVY);
     return true;
 }
 QT_END_NAMESPACE
index 084409f..5dd93d2 100644 (file)
@@ -103,7 +103,7 @@ private:
     QHash<int,int> m_lookups;
 };
 
-class QSGParticleGroupData{
+class Q_AUTOTEST_EXPORT QSGParticleGroupData {
 public:
     QSGParticleGroupData(int id, QSGParticleSystem* sys);
     ~QSGParticleGroupData();
@@ -143,7 +143,7 @@ struct Color4ub {
     uchar a;
 };
 
-class QSGParticleData{
+class Q_AUTOTEST_EXPORT QSGParticleData {
 public:
     //TODO: QObject like memory management (without the cost, just attached to system)
     QSGParticleData(QSGParticleSystem* sys);
@@ -225,7 +225,7 @@ private:
     QSGV8ParticleData* v8Datum;
 };
 
-class QSGParticleSystem : public QSGItem
+class Q_AUTOTEST_EXPORT QSGParticleSystem : public QSGItem
 {
     Q_OBJECT
     Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
index accc88f..fde227c 100644 (file)
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
 */
 
 QSGRectangleExtruder::QSGRectangleExtruder(QObject *parent) :
-    QObject(parent), m_fill(true)
+    QSGParticleExtruder(parent), m_fill(true)
 {
 }
 
index 5795375..9cc51b2 100644 (file)
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
 
 QT_MODULE(Declarative)
 
-class QSGRectangleExtruder : public QObject
+class QSGRectangleExtruder : public QSGParticleExtruder
 {
     Q_OBJECT
     Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)
diff --git a/tests/auto/particles/qsgage/data/jump.qml b/tests/auto/particles/qsgage/data/jump.qml
new file mode 100644 (file)
index 0000000..e66f9f4
--- /dev/null
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        Age {
+            once: true
+            advancePosition: false
+            lifeLeft: 100
+        }
+
+        ImageParticle { source: "../../shared/star.png" }
+        Emitter {
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+            speed: PointDirection{ x: 500; y: 500 }
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgage/data/kill.qml b/tests/auto/particles/qsgage/data/kill.qml
new file mode 100644 (file)
index 0000000..2558435
--- /dev/null
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        Age {}
+
+        ImageParticle { source: "../../shared/star.png" }
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+            speed: PointDirection{ x: 1000; y: 1000 }
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgage/data/onceoff.qml b/tests/auto/particles/qsgage/data/onceoff.qml
new file mode 100644 (file)
index 0000000..15d0e12
--- /dev/null
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        Age {
+            once: true
+            lifeLeft: 100
+        }
+
+        ImageParticle { source: "../../shared/star.png" }
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+            speed: PointDirection{ x: 500; y: 500 }
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgage/data/sustained.qml b/tests/auto/particles/qsgage/data/sustained.qml
new file mode 100644 (file)
index 0000000..96aefec
--- /dev/null
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        Age {
+            once: false
+            lifeLeft: 100
+        }
+
+        ImageParticle { source: "../../shared/star.png" }
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+            speed: PointDirection{ x: 500; y: 500 }
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgage/qsgage.pro b/tests/auto/particles/qsgage/qsgage.pro
new file mode 100644 (file)
index 0000000..3ca0740
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgage.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgage/tst_qsgage.cpp b/tests/auto/particles/qsgage/tst_qsgage.cpp
new file mode 100644 (file)
index 0000000..884c210
--- /dev/null
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgage : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgage();
+
+private slots:
+    void test_kill();
+    void test_jump();
+    void test_onceOff();
+    void test_sustained();
+};
+
+tst_qsgage::tst_qsgage()
+{
+}
+
+void tst_qsgage::test_kill()
+{
+    QSGView* view = createView(SRCDIR "/data/kill.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 1000.f);
+        QCOMPARE(d->vy, 1000.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0) - 0.5f + EPSILON);
+    }
+}
+
+void tst_qsgage::test_jump()
+{
+    QSGView* view = createView(SRCDIR "/data/jump.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        //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);
+        QCOMPARE(d->vx, 500.f);
+        QCOMPARE(d->vy, 500.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0) - 0.4f + EPSILON);
+    }
+}
+
+void tst_qsgage::test_onceOff()
+{
+    QSGView* view = createView(SRCDIR "/data/onceoff.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    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
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 500.f);
+        QCOMPARE(d->vy, 500.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0) - 0.4f + EPSILON);
+    }
+}
+
+void tst_qsgage::test_sustained()
+{
+    QSGView* view = createView(SRCDIR "/data/sustained.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    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
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 500.f);
+        QCOMPARE(d->vy, 500.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(myFuzzyCompare(d->t, ((qreal)system->timeInt/1000.0) - 0.4f));
+    }
+}
+
+QTEST_MAIN(tst_qsgage);
+
+#include "tst_qsgage.moc"
diff --git a/tests/auto/particles/qsgangleddirection/data/basic.qml b/tests/auto/particles/qsgangleddirection/data/basic.qml
new file mode 100644 (file)
index 0000000..c2fda56
--- /dev/null
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+            speed: AngleDirection { angle: 45; magnitude: 500 }
+            acceleration: AngleDirection { angle: 45; angleVariation: 22; magnitude: 250; magnitudeVariation: 249}
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgangleddirection/qsgangleddirection.pro b/tests/auto/particles/qsgangleddirection/qsgangleddirection.pro
new file mode 100644 (file)
index 0000000..a90b00b
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgangleddirection.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp b/tests/auto/particles/qsgangleddirection/tst_qsgangleddirection.cpp
new file mode 100644 (file)
index 0000000..0cc2c8b
--- /dev/null
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <qmath.h>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgangleddirection : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgangleddirection();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgangleddirection::tst_qsgangleddirection()
+{
+}
+
+void tst_qsgangleddirection::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QVERIFY(qFuzzyCompare(d->vx, 353.55339f));
+        QVERIFY(qFuzzyCompare(d->vy, 353.55339f));
+        QVERIFY(d->ax > 0.f);
+        QVERIFY(d->ax < 500.f);
+        QVERIFY(d->ay > 0.f);
+        QVERIFY(d->ay < 500.f);
+        QVERIFY(qSqrt(d->ax*d->ax + d->ay*d->ay) < 500.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgangleddirection);
+
+#include "tst_qsgangleddirection.moc"
diff --git a/tests/auto/particles/qsgcumulativedirection/data/basic.qml b/tests/auto/particles/qsgcumulativedirection/data/basic.qml
new file mode 100644 (file)
index 0000000..bd46c45
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+            speed: CumulativeDirection {
+                PointDirection { x: 100; y: -100 }
+                PointDirection { x: -100; y: 100 }
+            }
+            acceleration: CumulativeDirection {
+                AngleDirection { angle: 0; magnitude: 100 }
+                AngleDirection { angle: 180; magnitude: 100 }
+            }
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgcumulativedirection/qsgcumulativedirection.pro b/tests/auto/particles/qsgcumulativedirection/qsgcumulativedirection.pro
new file mode 100644 (file)
index 0000000..03d9ca2
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgcumulativedirection.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp b/tests/auto/particles/qsgcumulativedirection/tst_qsgcumulativedirection.cpp
new file mode 100644 (file)
index 0000000..0c54ad8
--- /dev/null
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgcumulativedirection : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgcumulativedirection();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgcumulativedirection::tst_qsgcumulativedirection()
+{
+}
+
+void tst_qsgcumulativedirection::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QVERIFY(myFuzzyCompare(d->x, 0.0f));
+        QVERIFY(myFuzzyCompare(d->y, 0.0f));
+        QVERIFY(myFuzzyCompare(d->vx, 0.0f));
+        QVERIFY(myFuzzyCompare(d->vy, 0.0f));
+        QVERIFY(myFuzzyCompare(d->ax, 0.0f));
+        QVERIFY(myFuzzyCompare(d->ay, 0.0f));
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgcumulativedirection);
+
+#include "tst_qsgcumulativedirection.moc"
diff --git a/tests/auto/particles/qsgcustomaffector/data/basic.qml b/tests/auto/particles/qsgcustomaffector/data/basic.qml
new file mode 100644 (file)
index 0000000..7371698
--- /dev/null
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+
+        Affector {
+            once: true
+            onAffectParticles: {
+                for (var i=0; i<particles.length; i++) {
+                    particles[i].initialX = 100;
+                    particles[i].initialY = 100;
+                    particles[i].initialVX = 100;
+                    particles[i].initialVY = 100;
+                    particles[i].initialAX = 100;
+                    particles[i].initialAY = 100;
+                    particles[i].startSize = 100;
+                    particles[i].endSize = 100;
+                }
+            }
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgcustomaffector/qsgcustomaffector.pro b/tests/auto/particles/qsgcustomaffector/qsgcustomaffector.pro
new file mode 100644 (file)
index 0000000..1484491
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgcustomaffector.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp b/tests/auto/particles/qsgcustomaffector/tst_qsgcustomaffector.cpp
new file mode 100644 (file)
index 0000000..6ae2aa5
--- /dev/null
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgcustomaffector : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgcustomaffector();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgcustomaffector::tst_qsgcustomaffector()
+{
+}
+
+void tst_qsgcustomaffector::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 100.f);
+        QCOMPARE(d->y, 100.f);
+        QCOMPARE(d->vx, 100.f);
+        QCOMPARE(d->vy, 100.f);
+        QCOMPARE(d->ax, 100.f);
+        QCOMPARE(d->ay, 100.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 100.f);
+        QCOMPARE(d->endSize, 100.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgcustomaffector);
+
+#include "tst_qsgcustomaffector.moc"
diff --git a/tests/auto/particles/qsgcustomparticle/data/basic.qml b/tests/auto/particles/qsgcustomparticle/data/basic.qml
new file mode 100644 (file)
index 0000000..244f706
--- /dev/null
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        CustomParticle {
+            property variant source: ShaderEffectSource {
+                hideSource: true
+                sourceItem: Image {
+                    source: "../../shared/star.png"
+                }
+            }
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgcustomparticle/qsgcustomparticle.pro b/tests/auto/particles/qsgcustomparticle/qsgcustomparticle.pro
new file mode 100644 (file)
index 0000000..a151daf
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgcustomparticle.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp b/tests/auto/particles/qsgcustomparticle/tst_qsgcustomparticle.cpp
new file mode 100644 (file)
index 0000000..74ef8af
--- /dev/null
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgcustomparticle : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgcustomparticle();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgcustomparticle::tst_qsgcustomparticle()
+{
+}
+
+void tst_qsgcustomparticle::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QVERIFY(view);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    bool oneNonZero = false;
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+        QVERIFY(d->r >= 0.0 && d->r <= 1.0);
+        if (d->r != 0.0 )
+            oneNonZero = true;
+    }
+    QVERIFY(oneNonZero);//Zero is a valid value, but it also needs to be set to a random number
+}
+
+QTEST_MAIN(tst_qsgcustomparticle);
+
+#include "tst_qsgcustomparticle.moc"
diff --git a/tests/auto/particles/qsgellipseextruder/data/basic.qml b/tests/auto/particles/qsgellipseextruder/data/basic.qml
new file mode 100644 (file)
index 0000000..fa5fb36
--- /dev/null
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            groups: ["", "nondefault"]
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            anchors.fill: parent
+            shape: EllipseShape{}
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+
+        Emitter{
+            group: "nondefault"
+            anchors.fill: parent
+            shape: EllipseShape{ fill: false }
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgellipseextruder/qsgellipseextruder.pro b/tests/auto/particles/qsgellipseextruder/qsgellipseextruder.pro
new file mode 100644 (file)
index 0000000..5315686
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgellipseextruder.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp b/tests/auto/particles/qsgellipseextruder/tst_qsgellipseextruder.cpp
new file mode 100644 (file)
index 0000000..f398936
--- /dev/null
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qmath.h>
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgellipseextruder : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgellipseextruder();
+
+private slots:
+    void test_basic();
+private:
+    bool inCircle(qreal x, qreal y, qreal r, bool borderOnly=false);
+};
+
+tst_qsgellipseextruder::tst_qsgellipseextruder()
+{
+}
+
+bool tst_qsgellipseextruder::inCircle(qreal x, qreal y, qreal r, bool borderOnly)
+{
+    x -= r;
+    y -= r;
+    if (myFuzzyCompare(x,0) && myFuzzyCompare(y,0))
+        return !borderOnly;
+    qreal mag = qSqrt(x*x + y*y);
+    if (borderOnly)
+        return myFuzzyCompare(mag, r); //Need myFuzzyCompare for smaller Epsilon than qFuzzyCompare
+    else
+        return mag - EPSILON < r;
+}
+
+void tst_qsgellipseextruder::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    //Filled
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QVERIFY(inCircle(d->x, d->y, 160, false));
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+    //Just border
+    QCOMPARE(system->groupData[1]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[1]->data) {
+        QVERIFY(inCircle(d->x, d->y, 160, true));
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgellipseextruder);
+
+#include "tst_qsgellipseextruder.moc"
diff --git a/tests/auto/particles/qsgfriction/data/basic.qml b/tests/auto/particles/qsgfriction/data/basic.qml
new file mode 100644 (file)
index 0000000..87a8897
--- /dev/null
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            groups: ["","notdefault"]
+            source: "../../shared/star.png"
+        }
+
+        Friction {
+            factor: 0.2
+        }
+
+        Emitter{
+            //0,0 position
+            speed: PointDirection{x:100}
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+
+        Friction {
+            groups: ["notdefault"]
+            factor: 1000.0
+        }
+
+        Emitter{
+            //0,0 position
+            group: "notdefault"
+            y:200
+            speed: PointDirection{x:100}
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgfriction/qsgfriction.pro b/tests/auto/particles/qsgfriction/qsgfriction.pro
new file mode 100644 (file)
index 0000000..a56f4b4
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgfriction.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp b/tests/auto/particles/qsgfriction/tst_qsgfriction.cpp
new file mode 100644 (file)
index 0000000..8981275
--- /dev/null
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgfriction : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgfriction();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgfriction::tst_qsgfriction()
+{
+}
+
+void tst_qsgfriction::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    //Default is just slowed a little
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QVERIFY(d->vx < 100.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+
+    //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 > ((qreal)system->timeInt/1000.0) - 0.25)
+            continue;
+        QVERIFY(myFuzzyCompare(d->vx, 0.f));
+        QCOMPARE(d->y, 200.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgfriction);
+
+#include "tst_qsgfriction.moc"
diff --git a/tests/auto/particles/qsggravity/data/basic.qml b/tests/auto/particles/qsggravity/data/basic.qml
new file mode 100644 (file)
index 0000000..9275654
--- /dev/null
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Gravity {
+            acceleration: 1000
+            angle: 45
+        }
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsggravity/qsggravity.pro b/tests/auto/particles/qsggravity/qsggravity.pro
new file mode 100644 (file)
index 0000000..d7a7bbd
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsggravity.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsggravity/tst_qsggravity.cpp b/tests/auto/particles/qsggravity/tst_qsggravity.cpp
new file mode 100644 (file)
index 0000000..584ec18
--- /dev/null
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsggravity : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsggravity();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsggravity::tst_qsggravity()
+{
+}
+
+void tst_qsggravity::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->ax, 707.10678f);
+        QCOMPARE(d->ay, 707.10678f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsggravity);
+
+#include "tst_qsggravity.moc"
diff --git a/tests/auto/particles/qsgimageparticle/data/basic.qml b/tests/auto/particles/qsgimageparticle/data/basic.qml
new file mode 100644 (file)
index 0000000..f5ef4c1
--- /dev/null
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgimageparticle/qsgimageparticle.pro b/tests/auto/particles/qsgimageparticle/qsgimageparticle.pro
new file mode 100644 (file)
index 0000000..d1197f0
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgimageparticle.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp b/tests/auto/particles/qsgimageparticle/tst_qsgimageparticle.cpp
new file mode 100644 (file)
index 0000000..5e6e77c
--- /dev/null
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgimageparticle : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgimageparticle();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgimageparticle::tst_qsgimageparticle()
+{
+}
+
+void tst_qsgimageparticle::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+        QCOMPARE(d->color.r, (uchar)255);
+        QCOMPARE(d->color.g, (uchar)255);
+        QCOMPARE(d->color.b, (uchar)255);
+        QCOMPARE(d->color.a, (uchar)255);
+        QCOMPARE(d->xx, 1.0f);
+        QCOMPARE(d->xy, 0.0f);
+        QCOMPARE(d->yy, 1.0f);
+        QCOMPARE(d->yx, 0.0f);
+        QCOMPARE(d->rotation, 0.0f);
+        QCOMPARE(d->rotationSpeed, 0.0f);
+        QCOMPARE(d->autoRotate, 0.0f);
+        QCOMPARE(d->animIdx, 0.0f);
+        QCOMPARE(d->frameDuration, 1.0f);
+        QCOMPARE(d->frameCount, 1.0f);
+        QCOMPARE(d->animT, -1.0f);
+    }
+}
+
+QTEST_MAIN(tst_qsgimageparticle);
+
+#include "tst_qsgimageparticle.moc"
diff --git a/tests/auto/particles/qsgitemparticle/data/basic.qml b/tests/auto/particles/qsgitemparticle/data/basic.qml
new file mode 100644 (file)
index 0000000..dbe16a0
--- /dev/null
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ItemParticle {
+            delegate: Image{ source: "../../shared/star.png" }
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgitemparticle/qsgitemparticle.pro b/tests/auto/particles/qsgitemparticle/qsgitemparticle.pro
new file mode 100644 (file)
index 0000000..e2d2c67
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgitemparticle.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp b/tests/auto/particles/qsgitemparticle/tst_qsgitemparticle.cpp
new file mode 100644 (file)
index 0000000..440ebaf
--- /dev/null
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+#include <private/qsgimage_p.h>
+
+class tst_qsgitemparticle : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgitemparticle();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgitemparticle::tst_qsgitemparticle()
+{
+}
+
+void tst_qsgitemparticle::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+        if (d->t > ((qreal)system->timeInt/1000.0) - 0.05)//Delegates appear between frames, may miss the first couple
+            continue;
+        if (d->t < ((qreal)system->timeInt/1000.0) - 0.5)//Delegates cleared on death
+            continue;
+        QVERIFY(d->delegate);
+        QVERIFY(qobject_cast<QSGImage*>(d->delegate));
+    }
+}
+
+QTEST_MAIN(tst_qsgitemparticle);
+
+#include "tst_qsgitemparticle.moc"
diff --git a/tests/auto/particles/qsglineextruder/data/basic.qml b/tests/auto/particles/qsglineextruder/data/basic.qml
new file mode 100644 (file)
index 0000000..dbe2ec5
--- /dev/null
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            groups: ["", "notdefault"]
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            anchors.fill: parent
+            shape: LineShape{}
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+        Emitter{
+            anchors.fill: parent
+            group: "notdefault"
+            shape: LineShape{mirrored: true}
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsglineextruder/qsglineextruder.pro b/tests/auto/particles/qsglineextruder/qsglineextruder.pro
new file mode 100644 (file)
index 0000000..ccafa70
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsglineextruder.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp b/tests/auto/particles/qsglineextruder/tst_qsglineextruder.cpp
new file mode 100644 (file)
index 0000000..6a7cfe4
--- /dev/null
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsglineextruder : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsglineextruder();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsglineextruder::tst_qsglineextruder()
+{
+}
+
+void tst_qsglineextruder::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, d->y);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+
+    QCOMPARE(system->groupData[1]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[1]->data) {
+        QCOMPARE(d->x + d->y, 320.0f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsglineextruder);
+
+#include "tst_qsglineextruder.moc"
diff --git a/tests/auto/particles/qsgmaskextruder/data/basic.qml b/tests/auto/particles/qsgmaskextruder/data/basic.qml
new file mode 100644 (file)
index 0000000..804df83
--- /dev/null
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //100,100 rect at 100,100
+            anchors.fill: parent
+            shape: MaskShape{source: "smallmask.png"}
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgmaskextruder/data/smallmask.png b/tests/auto/particles/qsgmaskextruder/data/smallmask.png
new file mode 100644 (file)
index 0000000..e36fb9f
Binary files /dev/null and b/tests/auto/particles/qsgmaskextruder/data/smallmask.png differ
diff --git a/tests/auto/particles/qsgmaskextruder/qsgmaskextruder.pro b/tests/auto/particles/qsgmaskextruder/qsgmaskextruder.pro
new file mode 100644 (file)
index 0000000..8cd5302
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgmaskextruder.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp b/tests/auto/particles/qsgmaskextruder/tst_qsgmaskextruder.cpp
new file mode 100644 (file)
index 0000000..1ac33a0
--- /dev/null
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgmaskextruder : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgmaskextruder();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgmaskextruder::tst_qsgmaskextruder()
+{
+}
+
+void tst_qsgmaskextruder::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QVERIFY(d->x >= 100.0f && d->x <= 200.0f);
+        QVERIFY(d->y >= 100.0f && d->y <= 200.0f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgmaskextruder);
+
+#include "tst_qsgmaskextruder.moc"
diff --git a/tests/auto/particles/qsgparticlegroup/data/basic.qml b/tests/auto/particles/qsgparticlegroup/data/basic.qml
new file mode 100644 (file)
index 0000000..97dadd7
--- /dev/null
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        ParticleGroup {
+            name: "notdefault"
+            duration: 0
+            to: {"":1}
+        }
+
+        Emitter{
+            //0,0 position
+            group: "notdefault"
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgparticlegroup/qsgparticlegroup.pro b/tests/auto/particles/qsgparticlegroup/qsgparticlegroup.pro
new file mode 100644 (file)
index 0000000..40e799d
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgparticlegroup.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp b/tests/auto/particles/qsgparticlegroup/tst_qsgparticlegroup.cpp
new file mode 100644 (file)
index 0000000..21eb52b
--- /dev/null
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgparticlegroup : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgparticlegroup();
+
+private slots:
+    void test_instantTransition();
+};
+
+tst_qsgparticlegroup::tst_qsgparticlegroup()
+{
+}
+
+void tst_qsgparticlegroup::test_instantTransition()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    //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) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgparticlegroup);
+
+#include "tst_qsgparticlegroup.moc"
diff --git a/tests/auto/particles/qsgparticlesystem/data/basic.qml b/tests/auto/particles/qsgparticlesystem/data/basic.qml
new file mode 100644 (file)
index 0000000..f5ef4c1
--- /dev/null
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgparticlesystem/qsgparticlesystem.pro b/tests/auto/particles/qsgparticlesystem/qsgparticlesystem.pro
new file mode 100644 (file)
index 0000000..6ba836a
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgparticlesystem.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp b/tests/auto/particles/qsgparticlesystem/tst_qsgparticlesystem.cpp
new file mode 100644 (file)
index 0000000..d5a0a2a
--- /dev/null
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgparticlesystem : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgparticlesystem();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgparticlesystem::tst_qsgparticlesystem()
+{
+}
+
+void tst_qsgparticlesystem::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgparticlesystem);
+
+#include "tst_qsgparticlesystem.moc"
diff --git a/tests/auto/particles/qsgpointattractor/data/basic.qml b/tests/auto/particles/qsgpointattractor/data/basic.qml
new file mode 100644 (file)
index 0000000..86861a9
--- /dev/null
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Attractor {
+            anchors.centerIn: parent
+            proportionalToDistance: Attractor.Constant
+            affectedParameter: Attractor.Position
+            strength: 100
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgpointattractor/qsgpointattractor.pro b/tests/auto/particles/qsgpointattractor/qsgpointattractor.pro
new file mode 100644 (file)
index 0000000..b2acf47
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgpointattractor.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp b/tests/auto/particles/qsgpointattractor/tst_qsgpointattractor.cpp
new file mode 100644 (file)
index 0000000..33fc670
--- /dev/null
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgpointattractor : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgpointattractor();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgpointattractor::tst_qsgpointattractor()
+{
+}
+
+void tst_qsgpointattractor::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QVERIFY(d->x != 0.f);
+        QVERIFY(d->y != 0.f);
+        QVERIFY(d->x == d->y);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgpointattractor);
+
+#include "tst_qsgpointattractor.moc"
diff --git a/tests/auto/particles/qsgpointdirection/data/basic.qml b/tests/auto/particles/qsgpointdirection/data/basic.qml
new file mode 100644 (file)
index 0000000..60c2a3e
--- /dev/null
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            speed: PointDirection{ x: 100; y: 100 }
+            acceleration: PointDirection{ x: 100; xVariation: 100; y: 100; yVariation: 100 }
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgpointdirection/qsgpointdirection.pro b/tests/auto/particles/qsgpointdirection/qsgpointdirection.pro
new file mode 100644 (file)
index 0000000..6a02503
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgpointdirection.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp b/tests/auto/particles/qsgpointdirection/tst_qsgpointdirection.cpp
new file mode 100644 (file)
index 0000000..89d0f31
--- /dev/null
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgpointdirection : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgpointdirection();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgpointdirection::tst_qsgpointdirection()
+{
+}
+
+void tst_qsgpointdirection::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 100.f);
+        QCOMPARE(d->vy, 100.f);
+        QVERIFY(d->ax >= 0.f);
+        QVERIFY(d->ax <= 200.f);
+        QVERIFY(d->ay >= 0.f);
+        QVERIFY(d->ay <= 200.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgpointdirection);
+
+#include "tst_qsgpointdirection.moc"
diff --git a/tests/auto/particles/qsgrectangleextruder/data/basic.qml b/tests/auto/particles/qsgrectangleextruder/data/basic.qml
new file mode 100644 (file)
index 0000000..a66827e
--- /dev/null
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            groups: ["", "notdefault"]
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            width: 100
+            height: 100
+            size: 32
+            shape: RectangleShape{}
+            emitRate: 1000
+            lifeSpan: 500
+        }
+        Emitter{
+            width: 100
+            height: 100
+            group: "notdefault"
+            size: 32
+            shape: RectangleShape{fill: false}
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgrectangleextruder/qsgrectangleextruder.pro b/tests/auto/particles/qsgrectangleextruder/qsgrectangleextruder.pro
new file mode 100644 (file)
index 0000000..207aa13
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgrectangleextruder.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp b/tests/auto/particles/qsgrectangleextruder/tst_qsgrectangleextruder.cpp
new file mode 100644 (file)
index 0000000..1e45f81
--- /dev/null
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgrectangleextruder : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgrectangleextruder();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgrectangleextruder::tst_qsgrectangleextruder()
+{
+}
+
+void tst_qsgrectangleextruder::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QVERIFY(d->x >= 0.f);
+        QVERIFY(d->x <= 100.f);
+        QVERIFY(d->y >= 0.f);
+        QVERIFY(d->y <= 100.f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+
+    QCOMPARE(system->groupData[1]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[1]->data) {
+        if (!myFuzzyCompare(d->x, 0.f) && !myFuzzyCompare(d->x, 100.f)){
+            QVERIFY(d->x >= 0.f);
+            QVERIFY(d->x <= 100.f);
+            QVERIFY(myFuzzyCompare(d->y, 0.f) || myFuzzyCompare(d->y, 100.f));
+        } else {
+            QVERIFY(d->y >= 0.f);
+            QVERIFY(d->y <= 100.f);
+        }
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgrectangleextruder);
+
+#include "tst_qsgrectangleextruder.moc"
diff --git a/tests/auto/particles/qsgtargetdirection/data/basic.qml b/tests/auto/particles/qsgtargetdirection/data/basic.qml
new file mode 100644 (file)
index 0000000..a8caea4
--- /dev/null
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Emitter{
+            //0,0 position
+            speed: TargetDirection{ targetItem: sys; proportionalMagnitude: true; magnitude: 1 }
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgtargetdirection/qsgtargetdirection.pro b/tests/auto/particles/qsgtargetdirection/qsgtargetdirection.pro
new file mode 100644 (file)
index 0000000..397957e
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgtargetdirection.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp b/tests/auto/particles/qsgtargetdirection/tst_qsgtargetdirection.cpp
new file mode 100644 (file)
index 0000000..c5d84f5
--- /dev/null
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgtargetdirection : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgtargetdirection();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgtargetdirection::tst_qsgtargetdirection()
+{
+}
+
+void tst_qsgtargetdirection::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 0.f);
+        QCOMPARE(d->y, 0.f);
+        QCOMPARE(d->vx, 160.f);
+        QCOMPARE(d->vy, 160.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgtargetdirection);
+
+#include "tst_qsgtargetdirection.moc"
diff --git a/tests/auto/particles/qsgtrailemitter/data/basic.qml b/tests/auto/particles/qsgtrailemitter/data/basic.qml
new file mode 100644 (file)
index 0000000..538d14f
--- /dev/null
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            groups: ["","notdefault"]
+            source: "../../shared/star.png"
+        }
+
+
+        TrailEmitter {
+            group: "notdefault"
+            follow: ""
+            size: 32
+            emitRatePerParticle: 2
+            lifeSpan: 500
+            speed: PointDirection{ x: 500; y: 500 }
+        }
+        Emitter{
+            x: 4
+            y: 4
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgtrailemitter/qsgtrailemitter.pro b/tests/auto/particles/qsgtrailemitter/qsgtrailemitter.pro
new file mode 100644 (file)
index 0000000..914d0e5
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgtrailemitter.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp b/tests/auto/particles/qsgtrailemitter/tst_qsgtrailemitter.cpp
new file mode 100644 (file)
index 0000000..a92b791
--- /dev/null
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgtrailemitter : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgtrailemitter();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgtrailemitter::tst_qsgtrailemitter()
+{
+}
+
+void tst_qsgtrailemitter::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->x, 4.f);
+        QCOMPARE(d->y, 4.f);
+        QCOMPARE(d->vx, 0.f);
+        QCOMPARE(d->vy, 0.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+
+    QCOMPARE(system->groupData[1]->size(), 500);
+    foreach (QSGParticleData *d, system->groupData[1]->data) {
+        QCOMPARE(d->x, 4.f);
+        QCOMPARE(d->y, 4.f);
+        QCOMPARE(d->vx, 500.f);
+        QCOMPARE(d->vy, 500.f);
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgtrailemitter);
+
+#include "tst_qsgtrailemitter.moc"
diff --git a/tests/auto/particles/qsgturbulence/data/basic.qml b/tests/auto/particles/qsgturbulence/data/basic.qml
new file mode 100644 (file)
index 0000000..42b5cd6
--- /dev/null
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Turbulence {
+            anchors.fill: parent
+            strength: 1000
+        }
+
+        Emitter{
+            //100,100 position
+            x: 100
+            y: 100
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgturbulence/qsgturbulence.pro b/tests/auto/particles/qsgturbulence/qsgturbulence.pro
new file mode 100644 (file)
index 0000000..1c38cda
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgturbulence.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp b/tests/auto/particles/qsgturbulence/tst_qsgturbulence.cpp
new file mode 100644 (file)
index 0000000..c7feb3c
--- /dev/null
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgturbulence : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgturbulence();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgturbulence::tst_qsgturbulence()
+{
+}
+
+void tst_qsgturbulence::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    //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);
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QVERIFY(d->vx != 0.f);
+        QVERIFY(d->vy != 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+    }
+}
+
+QTEST_MAIN(tst_qsgturbulence);
+
+#include "tst_qsgturbulence.moc"
diff --git a/tests/auto/particles/qsgwander/data/basic.qml b/tests/auto/particles/qsgwander/data/basic.qml
new file mode 100644 (file)
index 0000000..ebb4bd9
--- /dev/null
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+    color: "black"
+    width: 320
+    height: 320
+
+    ParticleSystem {
+        id: sys
+        objectName: "system"
+        anchors.fill: parent
+
+        ImageParticle {
+            source: "../../shared/star.png"
+        }
+
+        Wander {
+            pace: 400
+            xVariance: 100
+            yVariance: 100
+        }
+
+        Emitter{
+            //0,0 position
+            size: 32
+            emitRate: 1000
+            lifeSpan: 500
+        }
+    }
+}
diff --git a/tests/auto/particles/qsgwander/qsgwander.pro b/tests/auto/particles/qsgwander/qsgwander.pro
new file mode 100644 (file)
index 0000000..b8bb4ae
--- /dev/null
@@ -0,0 +1,11 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qsgwander.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private declarative-private opengl-private
+
diff --git a/tests/auto/particles/qsgwander/tst_qsgwander.cpp b/tests/auto/particles/qsgwander/tst_qsgwander.cpp
new file mode 100644 (file)
index 0000000..24b718c
--- /dev/null
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qsgparticlesystem_p.h>
+
+class tst_qsgwander : public QObject
+{
+    Q_OBJECT
+public:
+    tst_qsgwander();
+
+private slots:
+    void test_basic();
+};
+
+tst_qsgwander::tst_qsgwander()
+{
+}
+
+void tst_qsgwander::test_basic()
+{
+    QSGView* view = createView(SRCDIR "/data/basic.qml", 600);
+    QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+
+    QCOMPARE(system->groupData[0]->size(), 500);
+    //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;
+    bool vyChanged = false;
+    foreach (QSGParticleData *d, system->groupData[0]->data) {
+        QCOMPARE(d->ax, 0.f);
+        QCOMPARE(d->ay, 0.f);
+        QCOMPARE(d->lifeSpan, 0.5f);
+        QCOMPARE(d->size, 32.f);
+        QCOMPARE(d->endSize, 32.f);
+        QVERIFY(d->t <= ((qreal)system->timeInt/1000.0));
+        if (d->vx != 0.0f)
+            vxChanged = true;
+        if (d->vy != 0.0f)
+            vyChanged = true;
+    }
+    QVERIFY(vxChanged);
+    QVERIFY(vyChanged);
+}
+
+QTEST_MAIN(tst_qsgwander);
+
+#include "tst_qsgwander.moc"
diff --git a/tests/auto/particles/shared/particlestestsshared.h b/tests/auto/particles/shared/particlestestsshared.h
new file mode 100644 (file)
index 0000000..f4c44c1
--- /dev/null
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PARTICLES_TESTS_SHARED
+#define PARTICLES_TESTS_SHARED
+#include <QSGView>
+#include <QtTest>
+const qreal EPSILON = 0.0001;
+
+bool extremelyFuzzyCompare(qreal a, qreal b, qreal e)//For cases which can have larger variances
+{
+    return (a + e > b) && (a - e < b);
+}
+
+bool myFuzzyCompare(qreal a, qreal b)//For cases which might be near 0 so qFuzzyCompare fails
+{
+    return (a + EPSILON > b) && (a - EPSILON < b);
+}
+
+QSGView* createView(const QString &filename, int additionalWait)
+{
+    QSGView *canvas = new QSGView(0);
+
+    canvas->setSource(QUrl::fromLocalFile(filename));
+    if (canvas->status() != QSGView::Ready)
+        return 0;
+    canvas->show();
+    QTest::qWaitForWindowShown(canvas);
+    if (additionalWait)
+        QTest::qWait(additionalWait);
+
+    return canvas;
+}
+
+#endif
diff --git a/tests/auto/particles/shared/star.png b/tests/auto/particles/shared/star.png
new file mode 100644 (file)
index 0000000..0d592cf
Binary files /dev/null and b/tests/auto/particles/shared/star.png differ