summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/transforms/qabstractskeleton.cpp11
-rw-r--r--src/core/transforms/qabstractskeleton.h1
-rw-r--r--tests/auto/animation/channelmapping/tst_channelmapping.cpp32
-rw-r--r--tests/auto/core/qskeleton/tst_qskeleton.cpp36
-rw-r--r--tests/auto/render/skeleton/tst_skeleton.cpp23
5 files changed, 24 insertions, 79 deletions
diff --git a/src/core/transforms/qabstractskeleton.cpp b/src/core/transforms/qabstractskeleton.cpp
index 0cc1a28d2..e401c3043 100644
--- a/src/core/transforms/qabstractskeleton.cpp
+++ b/src/core/transforms/qabstractskeleton.cpp
@@ -39,7 +39,6 @@
#include "qabstractskeleton.h"
#include "qabstractskeleton_p.h"
-#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -128,16 +127,6 @@ void QAbstractSkeletonPrivate::setJointCount(int jointCount)
q->blockNotifications(block);
}
-void QAbstractSkeleton::sceneChangeEvent(const QSceneChangePtr &change)
-{
- Q_D(QAbstractSkeleton);
- if (change->type() == Qt3DCore::PropertyUpdated) {
- const Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
- if (e->propertyName() == QByteArrayLiteral("jointCount"))
- d->setJointCount(e->value().toInt());
- }
-}
-
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/transforms/qabstractskeleton.h b/src/core/transforms/qabstractskeleton.h
index 902def9f8..7da78011f 100644
--- a/src/core/transforms/qabstractskeleton.h
+++ b/src/core/transforms/qabstractskeleton.h
@@ -64,7 +64,6 @@ Q_SIGNALS:
protected:
QAbstractSkeleton(QAbstractSkeletonPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void sceneChangeEvent(const QSceneChangePtr &change) override;
private:
Q_DECLARE_PRIVATE(QAbstractSkeleton)
diff --git a/tests/auto/animation/channelmapping/tst_channelmapping.cpp b/tests/auto/animation/channelmapping/tst_channelmapping.cpp
index e108e3d26..26a57449d 100644
--- a/tests/auto/animation/channelmapping/tst_channelmapping.cpp
+++ b/tests/auto/animation/channelmapping/tst_channelmapping.cpp
@@ -38,7 +38,6 @@
#include <Qt3DCore/qskeleton.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/private/qbackendnode_p.h>
#include "testpostmanarbiter.h"
@@ -181,16 +180,31 @@ private Q_SLOTS:
const char *testName = "translation";
QCOMPARE(qstrcmp(testName, backendMapping.propertyName()), 0);
+ }
-// // WHEN
-// const auto skeletonId = Qt3DCore::QNodeId::createId();
-// updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId());
-// updateChange->setPropertyName("skeleton");
-// updateChange->setValue(QVariant::fromValue(skeletonId));
-// backendMapping.sceneChangeEvent(updateChange);
+ void checkSkeletonPropertyUpdate()
+ {
+ // GIVEN
+ Qt3DAnimation::QSkeletonMapping mapping;
+ Qt3DAnimation::Animation::Handler handler;
+ Qt3DAnimation::Animation::ChannelMapping backendMapping;
+ backendMapping.setHandler(&handler);
+ simulateInitializationSync(&mapping, &backendMapping);
-// // THEN
-// QCOMPARE(backendMapping.skeletonId(), skeletonId);
+ // WHEN
+ mapping.setEnabled(false);
+ backendMapping.syncFromFrontEnd(&mapping, false);
+
+ // THEN
+ QCOMPARE(backendMapping.isEnabled(), false);
+
+ // WHEN
+ auto skeleton = new Qt3DCore::QSkeleton;
+ mapping.setSkeleton(skeleton);
+ backendMapping.syncFromFrontEnd(&mapping, false);
+
+ // THEN
+ QCOMPARE(backendMapping.skeletonId(), skeleton->id());
}
};
diff --git a/tests/auto/core/qskeleton/tst_qskeleton.cpp b/tests/auto/core/qskeleton/tst_qskeleton.cpp
index 299567806..5c88bd754 100644
--- a/tests/auto/core/qskeleton/tst_qskeleton.cpp
+++ b/tests/auto/core/qskeleton/tst_qskeleton.cpp
@@ -30,7 +30,6 @@
#include <Qt3DCore/qskeleton.h>
#include <Qt3DCore/private/qskeleton_p.h>
#include <Qt3DCore/qjoint.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
@@ -160,41 +159,6 @@ 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);
-
- // Cleanup
- QNodePrivate::get(this)->setArbiter(nullptr);
- }
};
QTEST_MAIN(tst_QSkeleton)
diff --git a/tests/auto/render/skeleton/tst_skeleton.cpp b/tests/auto/render/skeleton/tst_skeleton.cpp
index 6af055fb0..2786f27a8 100644
--- a/tests/auto/render/skeleton/tst_skeleton.cpp
+++ b/tests/auto/render/skeleton/tst_skeleton.cpp
@@ -34,9 +34,7 @@
#include <Qt3DCore/qskeletonloader.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/private/qbackendnode_p.h>
-#include <Qt3DCore/private/qpropertyupdatedchangebase_p.h>
#include <qbackendnodetester.h>
#include <testpostmanarbiter.h>
#include <testrenderer.h>
@@ -49,24 +47,6 @@ Q_DECLARE_METATYPE(Qt3DRender::Render::JointInfo)
Q_DECLARE_METATYPE(Qt3DRender::Render::SkeletonData)
Q_DECLARE_METATYPE(Qt3DCore::Sqt)
-namespace {
-
-void linearizeTreeHelper(QJoint *joint, QVector<QJoint *> &joints)
-{
- joints.push_back(joint);
- for (const auto child : joint->childJoints())
- linearizeTreeHelper(child, joints);
-}
-
-QVector<QJoint *> linearizeTree(QJoint *rootJoint)
-{
- QVector<QJoint *> joints;
- linearizeTreeHelper(rootJoint, joints);
- return joints;
-}
-
-}
-
class tst_Skeleton : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
@@ -155,7 +135,6 @@ private Q_SLOTS:
backendSkeleton.setRenderer(&renderer);
backendSkeleton.setSkeletonManager(nodeManagers.skeletonManager());
backendSkeleton.setDataType(Skeleton::File);
- Qt3DCore::QPropertyUpdatedChangePtr updateChange;
// Initialize to ensure skeleton manager is set
QSkeletonLoader skeleton;
@@ -225,7 +204,7 @@ private Q_SLOTS:
QTest::addColumn<SkeletonData>("skeletonData");
QTest::addColumn<QJoint *>("expectedRootJoint");
- QTest::newRow("empty") << SkeletonData() << (QJoint*)nullptr;
+ QTest::newRow("empty") << SkeletonData() << static_cast<QJoint*>(nullptr);
SkeletonData skeletonData;
JointInfo rootJointInfo;