diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-03-24 13:21:25 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-03-26 07:29:29 +0000 |
commit | 9a5139a2b59ac27afa190caa46ba22138f9dfa6c (patch) | |
tree | e0ceb21228fd923aa72cdeb87d637377ae92060a /tests/auto | |
parent | 78280da782ea8c1882afe18ee611aa199e914418 (diff) |
Remove clips property from QAbstractClipBlendNode and friends
No longer needed as concrete subclasses each provide their own specific
APIs for managing clips or sub trees.
Change-Id: I8e090bcf18ad9bf0d19e36128d7556aaa6cd6edf
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto')
9 files changed, 0 insertions, 318 deletions
diff --git a/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp b/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp index 5e25cccb9..cd77425a0 100644 --- a/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp +++ b/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp @@ -136,7 +136,6 @@ private Q_SLOTS: additiveBlend.setBaseClip(&baseClip); additiveBlend.setAdditiveClip(&additiveClip); additiveBlend.setAdditiveFactor(0.8f); - additiveBlend.addClip(&clip); { // WHEN @@ -149,8 +148,6 @@ private Q_SLOTS: QCOMPARE(backendAdditiveBlend.baseClipId(), baseClip.id()); QCOMPARE(backendAdditiveBlend.additiveClipId(), additiveClip.id()); QCOMPARE(backendAdditiveBlend.additiveFactor(), 0.8f); - QCOMPARE(backendAdditiveBlend.clipIds().size(), 1); - QCOMPARE(backendAdditiveBlend.clipIds().first(), clip.id()); } { // WHEN diff --git a/tests/auto/animation/animation.pro b/tests/auto/animation/animation.pro index a608c6cbb..eeb9a70af 100644 --- a/tests/auto/animation/animation.pro +++ b/tests/auto/animation/animation.pro @@ -12,7 +12,6 @@ SUBDIRS += \ qtConfig(private_tests) { SUBDIRS += \ animationcliploader \ - qabstractclipblendnode \ fcurve \ functionrangefinder \ bezierevaluator \ diff --git a/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp b/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp index c214cea58..c945b6f3f 100644 --- a/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp +++ b/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp @@ -114,7 +114,6 @@ private Q_SLOTS: // THEN QCOMPARE(backendClipBlendNode.isEnabled(), false); QVERIFY(backendClipBlendNode.peerId().isNull()); - QCOMPARE(backendClipBlendNode.clipIds(), Qt3DCore::QNodeIdVector()); QCOMPARE(backendClipBlendNode.parentId(), Qt3DCore::QNodeId()); QCOMPARE(backendClipBlendNode.childrenIds(), Qt3DCore::QNodeIdVector()); QVERIFY(backendClipBlendNode.clipBlendNodeManager() == nullptr); @@ -127,7 +126,6 @@ private Q_SLOTS: // GIVEN Qt3DAnimation::QLerpClipBlend clipBlendNode; Qt3DAnimation::QAnimationClipLoader clip; - clipBlendNode.addClip(&clip); QCoreApplication::processEvents(); @@ -141,8 +139,6 @@ private Q_SLOTS: // THEN QCOMPARE(backendClipBlendNode.isEnabled(), true); QCOMPARE(backendClipBlendNode.peerId(), clipBlendNode.id()); - QCOMPARE(backendClipBlendNode.clipIds().size(), 1); - QCOMPARE(backendClipBlendNode.clipIds().first(), clip.id()); QCOMPARE(backendClipBlendNode.parentId(), Qt3DCore::QNodeId()); QCOMPARE(backendClipBlendNode.childrenIds().size(), 0); QCOMPARE(backendClipBlendNode.clipBlendNodeManager(), &manager); @@ -163,112 +159,6 @@ private Q_SLOTS: } } - void checkSceneChangeEvents() - { - // GIVEN - TestClipBlendNode backendClipBlendNode; - ClipBlendNodeManager manager; - backendClipBlendNode.setClipBlendNodeManager(&manager); - { - // WHEN - const bool newValue = false; - const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("enabled"); - change->setValue(newValue); - backendClipBlendNode.sceneChangeEvent(change); - - // THEN - QCOMPARE(backendClipBlendNode.isEnabled(), newValue); - } - { - // WHEN - Qt3DAnimation::QAnimationClipLoader clip; - // To geneate the type_info in the QNodePrivate of clip - Qt3DCore::QNodeCreatedChangeGenerator generator(&clip); - - const auto addedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &clip); - backendClipBlendNode.sceneChangeEvent(addedChange); - - // THEN - QCOMPARE(backendClipBlendNode.clipIds().size(), 1); - QCOMPARE(backendClipBlendNode.clipIds().first(), clip.id()); - - // WHEN - const auto removedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &clip); - backendClipBlendNode.sceneChangeEvent(removedChange); - - // THEN - QCOMPARE(backendClipBlendNode.clipIds().size(), 0); - } - { - // WHEN - Qt3DAnimation::QLerpClipBlend clipBlendChild; - // Will be destroyed when manager is destroyed - TestClipBlendNode *backenChildClipBlendNode = new TestClipBlendNode(); - backendClipBlendNode.setClipBlendNodeManager(&manager); - manager.appendNode(clipBlendChild.id(), backenChildClipBlendNode); - - // To geneate the type_info in the QNodePrivate of clipBlendChild - Qt3DCore::QNodeCreatedChangeGenerator generator(&clipBlendChild); - const auto addChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &clipBlendChild); - backendClipBlendNode.sceneChangeEvent(addChange); - - // THEN - QCOMPARE(backendClipBlendNode.childrenIds().size(), 1); - QCOMPARE(backendClipBlendNode.childrenIds().first(), clipBlendChild.id()); - - // WHEN - const auto removedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &clipBlendChild); - backendClipBlendNode.sceneChangeEvent(removedChange); - - // THEN - QCOMPARE(backendClipBlendNode.childrenIds().size(), 0); - } - } - - void checkParentInitialization() - { - // GIVEN - TestClipBlendNode *backendClipBlendNode = new TestClipBlendNode(); - TestClipBlendNode *backendChildClipBlendNode = new TestClipBlendNode(); - Qt3DAnimation::QLerpClipBlend clipBlendParent; - Qt3DAnimation::QLerpClipBlend childClipBlend(&clipBlendParent); - ClipBlendNodeManager manager; - backendClipBlendNode->setClipBlendNodeManager(&manager); - backendChildClipBlendNode->setClipBlendNodeManager(&manager); - - // THEN - QCOMPARE(backendClipBlendNode->parentId(), Qt3DCore::QNodeId()); - QCOMPARE(backendClipBlendNode->childrenIds().size(), 0); - QCOMPARE(backendChildClipBlendNode->parentId(), Qt3DCore::QNodeId()); - QCOMPARE(backendChildClipBlendNode->childrenIds().size(), 0); - - // WHEN - manager.appendNode(clipBlendParent.id(), backendClipBlendNode); - manager.appendNode(childClipBlend.id(), backendChildClipBlendNode); - simulateInitialization(&clipBlendParent, backendClipBlendNode); - simulateInitialization(&childClipBlend, backendChildClipBlendNode); - - // THEN - QCOMPARE(backendClipBlendNode->parentId(), Qt3DCore::QNodeId()); - QCOMPARE(backendClipBlendNode->childrenIds().size(), 1); - QCOMPARE(backendClipBlendNode->childrenIds().first(), childClipBlend.id()); - QCOMPARE(backendChildClipBlendNode->parentId(), clipBlendParent.id()); - QCOMPARE(backendChildClipBlendNode->childrenIds().size(), 0); - - // WHEN - // To geneate the type_info in the QNodePrivate of clipBlendChild - Qt3DCore::QNodeCreatedChangeGenerator generator(&childClipBlend); - const auto removedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &childClipBlend); - backendClipBlendNode->sceneChangeEvent(removedChange); - - // THEN - QCOMPARE(backendClipBlendNode->parentId(), Qt3DCore::QNodeId()); - QCOMPARE(backendClipBlendNode->childrenIds().size(), 0); - QCOMPARE(backendChildClipBlendNode->parentId(), Qt3DCore::QNodeId()); - QCOMPARE(backendChildClipBlendNode->childrenIds().size(), 0); - } - void checkClipResults_data() { QTest::addColumn<TestClipBlendNode *>("blendNode"); diff --git a/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp b/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp index f9ebfec4e..1ff17f9aa 100644 --- a/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp +++ b/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp @@ -130,7 +130,6 @@ private Q_SLOTS: Qt3DAnimation::QLerpClipBlend lerpBlend; Qt3DAnimation::QAnimationClipLoader clip; lerpBlend.setBlendFactor(0.8f); - lerpBlend.addClip(&clip); { // WHEN @@ -141,8 +140,6 @@ private Q_SLOTS: QCOMPARE(backendLerpBlend.isEnabled(), true); QCOMPARE(backendLerpBlend.peerId(), lerpBlend.id()); QCOMPARE(backendLerpBlend.blendFactor(), 0.8f); - QCOMPARE(backendLerpBlend.clipIds().size(), 1); - QCOMPARE(backendLerpBlend.clipIds().first(), clip.id()); } { // WHEN diff --git a/tests/auto/animation/qabstractclipblendnode/qabstractclipblendnode.pro b/tests/auto/animation/qabstractclipblendnode/qabstractclipblendnode.pro deleted file mode 100644 index 9dff8e7bd..000000000 --- a/tests/auto/animation/qabstractclipblendnode/qabstractclipblendnode.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -TARGET = tst_qabstractclipblendnode - -QT += 3dcore 3dcore-private 3danimation 3danimation-private testlib - -CONFIG += testcase - -SOURCES += tst_qabstractclipblendnode.cpp - -include(../../core/common/common.pri) diff --git a/tests/auto/animation/qabstractclipblendnode/tst_qabstractclipblendnode.cpp b/tests/auto/animation/qabstractclipblendnode/tst_qabstractclipblendnode.cpp deleted file mode 100644 index f5f1e73d4..000000000 --- a/tests/auto/animation/qabstractclipblendnode/tst_qabstractclipblendnode.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Paul Lemire <paul.lemire350@gmail.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtTest/QTest> -#include <Qt3DAnimation/qabstractclipblendnode.h> -#include <Qt3DAnimation/qanimationcliploader.h> -#include <QObject> -#include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> -#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> -#include <Qt3DCore/qnodecreatedchange.h> -#include "testpostmanarbiter.h" - -namespace { - -class TestClipBlendNode : public Qt3DAnimation::QAbstractClipBlendNode -{ -public: - TestClipBlendNode(Qt3DCore::QNode *parent = nullptr) - : Qt3DAnimation::QAbstractClipBlendNode(parent) - {} - - using Qt3DAnimation::QAbstractClipBlendNode::addClip; - using Qt3DAnimation::QAbstractClipBlendNode::removeClip; -}; - -} - -class tst_QAbstractClipBlendNode : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - - void checkDefaultConstruction() - { - // GIVEN - TestClipBlendNode abstractClipBlendNode; - - // THEN - QCOMPARE(abstractClipBlendNode.clips().size(), 0); - } - - void checkPropertyChanges() - { - // GIVEN - TestClipBlendNode abstractClipBlendNode; - - { - // WHEN - Qt3DAnimation::QAnimationClipLoader newValue; - abstractClipBlendNode.addClip(&newValue); - - // THEN - QCOMPARE(abstractClipBlendNode.clips().size(), 1); - - // WHEN - abstractClipBlendNode.addClip(&newValue); - - // THEN - QCOMPARE(abstractClipBlendNode.clips().size(), 1); - - // WHEN - abstractClipBlendNode.removeClip(&newValue); - - // THEN - QCOMPARE(abstractClipBlendNode.clips().size(), 0); - } - } - - void checkClipBookkeeping() - { - // GIVEN - TestClipBlendNode abstractClipBlendNode; - - { - // WHEN - Qt3DAnimation::QAnimationClipLoader clip; - abstractClipBlendNode.addClip(&clip); - - QCOMPARE(abstractClipBlendNode.clips().size(), 1); - } - - // THEN -> should not crash - QCOMPARE(abstractClipBlendNode.clips().size(), 0); - } - - void checkClipUpdate() - { - // GIVEN - TestArbiter arbiter; - TestClipBlendNode abstractClipBlendNode; - Qt3DAnimation::QAnimationClipLoader clip; - arbiter.setArbiterOnNode(&abstractClipBlendNode); - - { - // WHEN - abstractClipBlendNode.addClip(&clip); - QCoreApplication::processEvents(); - - // THEN - QCOMPARE(arbiter.events.size(), 1); - auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>(); - QCOMPARE(change->propertyName(), "clip"); - QCOMPARE(change->addedNodeId(), clip.id()); - QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded); - - arbiter.events.clear(); - } - - { - // WHEN - abstractClipBlendNode.removeClip(&clip); - QCoreApplication::processEvents(); - - // THEN - QCOMPARE(arbiter.events.size(), 1); - auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>(); - QCOMPARE(change->propertyName(), "clip"); - QCOMPARE(change->removedNodeId(), clip.id()); - QCOMPARE(change->type(), Qt3DCore::PropertyValueRemoved); - - arbiter.events.clear(); - } - - } - - void checkParentClipBlendNode() - { - // GIVEN - TestClipBlendNode clipNodeLevel0; - TestClipBlendNode clipNodeLevel1_1(&clipNodeLevel0); - TestClipBlendNode clipNodeLevel1_2(&clipNodeLevel0); - TestClipBlendNode clipNodeLevel2_1(&clipNodeLevel1_1); - Qt3DCore::QNode fakeNodeLevel2_2(&clipNodeLevel1_2); - TestClipBlendNode clipNodeLeve3_1(&fakeNodeLevel2_2); - - // THEN - QVERIFY(clipNodeLevel0.parent() == nullptr); - QCOMPARE(clipNodeLevel1_1.parent(), &clipNodeLevel0); - QCOMPARE(clipNodeLevel1_2.parent(), &clipNodeLevel0); - QCOMPARE(clipNodeLevel2_1.parent(), &clipNodeLevel1_1); - QCOMPARE(fakeNodeLevel2_2.parent(), &clipNodeLevel1_2); - QCOMPARE(clipNodeLeve3_1.parent(), &fakeNodeLevel2_2); - - QVERIFY(clipNodeLevel0.parentClipBlendNode() == nullptr); - QCOMPARE(clipNodeLevel1_1.parentClipBlendNode(), &clipNodeLevel0); - QCOMPARE(clipNodeLevel1_2.parentClipBlendNode(), &clipNodeLevel0); - QCOMPARE(clipNodeLevel2_1.parentClipBlendNode(), &clipNodeLevel1_1); - QCOMPARE(clipNodeLeve3_1.parentClipBlendNode(), &clipNodeLevel1_2); - } -}; - -QTEST_MAIN(tst_QAbstractClipBlendNode) - -#include "tst_qabstractclipblendnode.moc" diff --git a/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp b/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp index 536853b1f..c1f01394f 100644 --- a/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp +++ b/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp @@ -160,7 +160,6 @@ private Q_SLOTS: QCOMPARE(addBlend.metaObject(), creationChangeData->metaObject()); QCOMPARE(cloneData.baseClipId, baseClip.id()); QCOMPARE(cloneData.additiveClipId, additiveClip.id()); - QCOMPARE(creationChangeData->parentClipBlendNodeId(), Qt3DCore::QNodeId()); } // WHEN @@ -185,7 +184,6 @@ private Q_SLOTS: QCOMPARE(addBlend.metaObject(), creationChangeData->metaObject()); QCOMPARE(cloneData.baseClipId, baseClip.id()); QCOMPARE(cloneData.additiveClipId, additiveClip.id()); - QCOMPARE(creationChangeData->parentClipBlendNodeId(), Qt3DCore::QNodeId()); } } diff --git a/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp b/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp index 6be6970ae..bdbee9380 100644 --- a/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp +++ b/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp @@ -112,7 +112,6 @@ private Q_SLOTS: QCOMPARE(clipBlendNode.isEnabled(), creationChangeData->isNodeEnabled()); QCOMPARE(clipBlendNode.metaObject(), creationChangeData->metaObject()); QCOMPARE(cloneData.clipId, clip.id()); - QCOMPARE(creationChangeData->parentClipBlendNodeId(), Qt3DCore::QNodeId()); } // WHEN @@ -135,7 +134,6 @@ private Q_SLOTS: QCOMPARE(clipBlendNode.isEnabled(), creationChangeData->isNodeEnabled()); QCOMPARE(clipBlendNode.metaObject(), creationChangeData->metaObject()); QCOMPARE(cloneData.clipId, clip.id()); - QCOMPARE(creationChangeData->parentClipBlendNodeId(), Qt3DCore::QNodeId()); } } diff --git a/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp b/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp index d6b449fdb..057f37786 100644 --- a/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp +++ b/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp @@ -160,7 +160,6 @@ private Q_SLOTS: QCOMPARE(lerpBlend.metaObject(), creationChangeData->metaObject()); QCOMPARE(cloneData.startClipId, startClip.id()); QCOMPARE(cloneData.endClipId, endClip.id()); - QCOMPARE(creationChangeData->parentClipBlendNodeId(), Qt3DCore::QNodeId()); } // WHEN @@ -185,7 +184,6 @@ private Q_SLOTS: QCOMPARE(lerpBlend.metaObject(), creationChangeData->metaObject()); QCOMPARE(cloneData.startClipId, startClip.id()); QCOMPARE(cloneData.endClipId, endClip.id()); - QCOMPARE(creationChangeData->parentClipBlendNodeId(), Qt3DCore::QNodeId()); } } |