summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2015-12-01 16:05:30 +0100
committerKevin Ottens <kevin.ottens@kdab.com>2015-12-02 16:20:09 +0000
commitd745d6c83ef4a7e1370abbe963920d9d427adae1 (patch)
treea58a2c2c0a1cdf0f70bd719110e2d31965f1cc28 /tests
parentc25253d5ddc2cd1eb79b3f3206484903a1f77959 (diff)
Add missing test for QAspectEngine::registerAspect
Change-Id: Id41bd1acd5e9b1d272b13ec6e53cc34080df51fe Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/core/qaspectengine/tst_qaspectengine.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
index e3d8fb9d9..d7a0f9950 100644
--- a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
+++ b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
@@ -35,12 +35,38 @@
****************************************************************************/
#include <QtTest/QtTest>
+#include <Qt3DCore/QAbstractAspect>
#include <Qt3DCore/qaspectengine.h>
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qtransform.h>
using namespace Qt3DCore;
+class FakeAspect : public QAbstractAspect
+{
+ Q_OBJECT
+public:
+ explicit FakeAspect(QObject *parent = 0)
+ : QAbstractAspect(parent) {}
+
+private:
+ void setRootEntity(QEntity *) Q_DECL_OVERRIDE {}
+ void onInitialize(const QVariantMap &) Q_DECL_OVERRIDE {}
+ void onStartup() Q_DECL_OVERRIDE {}
+ void onShutdown() Q_DECL_OVERRIDE {}
+ void onCleanup() Q_DECL_OVERRIDE {}
+ void sceneNodeAdded(QSceneChangePtr &) Q_DECL_OVERRIDE {}
+ void sceneNodeRemoved(QSceneChangePtr &) Q_DECL_OVERRIDE {}
+
+ QVector<QAspectJobPtr> jobsToExecute(qint64) Q_DECL_OVERRIDE
+ {
+ return QVector<QAspectJobPtr>();
+ }
+};
+
+QT3D_REGISTER_ASPECT("fake", FakeAspect)
+
+
class tst_QAspectEngine : public QObject
{
Q_OBJECT
@@ -94,6 +120,22 @@ private Q_SLOTS:
// THEN
// Nothing particular happen on exit, especially no crash
+ };
+
+ void shouldRegisterAspectsByName()
+ {
+ // GIVEN
+ QAspectEngine engine;
+
+ // THEN
+ QVERIFY(engine.aspects().isEmpty());
+
+ // WHEN
+ engine.registerAspect("fake");
+
+ // THEN
+ QCOMPARE(engine.aspects().size(), 1);
+ QVERIFY(qobject_cast<FakeAspect*>(engine.aspects().first()));
}
};