diff options
author | Mike Krus <mike.krus@kdab.com> | 2019-10-08 08:01:10 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2019-10-21 15:38:45 +0100 |
commit | 1e499f548a24482a0809a34767a04c91a940ffe8 (patch) | |
tree | 70bab2e2613540b5d0d40a01beeeb2e2fe4eef77 /tests | |
parent | ae88eeee627664b06935004cc0d2868b65905d62 (diff) |
Remove old code from animation classes & update tests
Change-Id: Ic91a4f168172d6f34d858488e6fc170e8ed875f9
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/animation/channelmapping/tst_channelmapping.cpp | 32 | ||||
-rw-r--r-- | tests/auto/core/qskeleton/tst_qskeleton.cpp | 36 | ||||
-rw-r--r-- | tests/auto/render/skeleton/tst_skeleton.cpp | 23 |
3 files changed, 24 insertions, 67 deletions
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; |