summaryrefslogtreecommitdiffstats
path: root/tests/auto/core/qskeleton/tst_qskeleton.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-07-31 20:47:53 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-08-09 13:04:51 +0000
commit91783b495928b5896aa2e4246ea8748b5fd7aaf8 (patch)
tree4186097c7a25c66f9e005ec27cf43c0bd2b0aded /tests/auto/core/qskeleton/tst_qskeleton.cpp
parentd6ec5fbc54a1adbfd6b7405c96fc5f7eb88c2480 (diff)
Add jointCount property to QAbstractSkeleton
Set this from the backend when a skeleton is loaded. Change-Id: I752670b93b6ae1fad70534b5f8983ae2ca86fd78 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests/auto/core/qskeleton/tst_qskeleton.cpp')
-rw-r--r--tests/auto/core/qskeleton/tst_qskeleton.cpp45
1 files changed, 43 insertions, 2 deletions
diff --git a/tests/auto/core/qskeleton/tst_qskeleton.cpp b/tests/auto/core/qskeleton/tst_qskeleton.cpp
index 3d1758716..f66e07cbe 100644
--- a/tests/auto/core/qskeleton/tst_qskeleton.cpp
+++ b/tests/auto/core/qskeleton/tst_qskeleton.cpp
@@ -38,11 +38,12 @@
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
-#include "testpostmanarbiter.h"
+#include <QSignalSpy>
+#include <testpostmanarbiter.h>
using namespace Qt3DCore;
-class tst_QSkeleton: public QObject
+class tst_QSkeleton: public QSkeleton
{
Q_OBJECT
public:
@@ -52,6 +53,14 @@ public:
}
private Q_SLOTS:
+ void checkDefaultConstruction()
+ {
+ // GIVEN
+ QSkeleton skeleton;
+
+ // THEN
+ QCOMPARE(skeleton.jointCount(), 0);
+ }
void checkCreationChange_data()
{
@@ -162,6 +171,38 @@ private Q_SLOTS:
// THEN Should not crash when the joint is destroyed (tests for failed removal of destruction helper)
}
}
+
+ void checkJointCountPropertyUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ arbiter.setArbiterOnNode(this);
+ QSignalSpy spy(this, SIGNAL(jointCountChanged(int)));
+ const int newJointCount = 99;
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ auto valueChange = QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ valueChange->setPropertyName("jointCount");
+ valueChange->setValue(QVariant(newJointCount));
+ sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(jointCount(), newJointCount);
+
+ // WHEN
+ spy.clear();
+ sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(jointCount(), newJointCount);
+ }
};
QTEST_MAIN(tst_QSkeleton)