Initial commit of particle system autotests
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>
This commit is contained in:
parent
69e925444e
commit
e59fbf997e
|
@ -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[] = {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
|
|||
*/
|
||||
|
||||
QSGRectangleExtruder::QSGRectangleExtruder(QObject *parent) :
|
||||
QObject(parent), m_fill(true)
|
||||
QSGParticleExtruder(parent), m_fill(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 719 B |
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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"
|
|
@ -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
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Loading…
Reference in New Issue