diff options
Diffstat (limited to 'tests')
127 files changed, 533 insertions, 1570 deletions
diff --git a/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp b/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp index d53fd9c2c..8e8ce43db 100644 --- a/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp +++ b/tests/auto/animation/additiveclipblend/tst_additiveclipblend.cpp @@ -32,7 +32,6 @@ #include <Qt3DAnimation/qanimationcliploader.h> #include <Qt3DAnimation/private/qadditiveclipblend_p.h> #include <Qt3DAnimation/private/additiveclipblend_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" using namespace Qt3DAnimation::Animation; diff --git a/tests/auto/animation/animationclip/tst_animationclip.cpp b/tests/auto/animation/animationclip/tst_animationclip.cpp index a98fbe886..35df21a58 100644 --- a/tests/auto/animation/animationclip/tst_animationclip.cpp +++ b/tests/auto/animation/animationclip/tst_animationclip.cpp @@ -117,70 +117,6 @@ private Q_SLOTS: // THEN QCOMPARE(backendClip.source(), newSource); } - - void checkDurationPropertyBackendNotification() - { - // GIVEN - TestArbiter arbiter; - AnimationClip backendClip; - backendClip.setEnabled(true); - Qt3DCore::QBackendNodePrivate::get(&backendClip)->setArbiter(&arbiter); - - // WHEN - backendClip.setDuration(64.0f); - - // THEN - QCOMPARE(backendClip.duration(), 64.0f); - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "duration"); - QCOMPARE(change->value().toFloat(), backendClip.duration()); - QCOMPARE(Qt3DCore::QPropertyUpdatedChangeBasePrivate::get(change.data())->m_isIntermediate, - false); - - arbiter.events.clear(); - - // WHEN - backendClip.setDuration(64.0f); - - // THEN - QCOMPARE(backendClip.duration(), 64.0f); - QCOMPARE(arbiter.events.count(), 0); - - arbiter.events.clear(); - } - - void checkStatusPropertyBackendNotification() - { - // GIVEN - TestArbiter arbiter; - AnimationClip backendClip; - backendClip.setEnabled(true); - Qt3DCore::QBackendNodePrivate::get(&backendClip)->setArbiter(&arbiter); - - // WHEN - backendClip.setStatus(Qt3DAnimation::QAnimationClipLoader::Error); - - // THEN - QCOMPARE(backendClip.status(), Qt3DAnimation::QAnimationClipLoader::Error); - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DAnimation::QAnimationClipLoader::Status>(), backendClip.status()); - QCOMPARE(Qt3DCore::QPropertyUpdatedChangeBasePrivate::get(change.data())->m_isIntermediate, - false); - - arbiter.events.clear(); - - // WHEN - backendClip.setStatus(Qt3DAnimation::QAnimationClipLoader::Error); - - // THEN - QCOMPARE(backendClip.status(), Qt3DAnimation::QAnimationClipLoader::Error); - QCOMPARE(arbiter.events.count(), 0); - - arbiter.events.clear(); - } }; QTEST_APPLESS_MAIN(tst_AnimationClip) diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp index 36f1cbe2f..385398bd1 100644 --- a/tests/auto/animation/animationutils/tst_animationutils.cpp +++ b/tests/auto/animation/animationutils/tst_animationutils.cpp @@ -795,16 +795,12 @@ private Q_SLOTS: QTest::addColumn<Qt3DCore::QNodeId>("animatorId"); QTest::addColumn<QVector<MappingData>>("mappingData"); QTest::addColumn<QVector<float>>("channelResults"); - QTest::addColumn<float>("normalizedTime"); - QTest::addColumn<bool>("finalFrame"); - QTest::addColumn<QVector<Qt3DCore::QPropertyUpdatedChangePtr>>("expectedChanges"); + QTest::addColumn<AnimationRecord>("expectedChanges"); Qt3DCore::QNodeId animatorId; QVector<MappingData> mappingData; QVector<float> channelResults; - bool finalFrame; - float normalizedTime; - QVector<Qt3DCore::QPropertyUpdatedChangePtr> expectedChanges; + AnimationRecord expectedChanges; // Single property, vec3 { @@ -816,40 +812,22 @@ private Q_SLOTS: mapping.channelIndices = QVector<int>() << 0 << 1 << 2; mappingData.push_back(mapping); channelResults = QVector<float>() << 1.0f << 2.0f << 3.0f; - finalFrame = false; - normalizedTime = 1.1f; // Invalid - - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId); - change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - change->setPropertyName(mapping.propertyName); - change->setValue(QVariant::fromValue(QVector3D(1.0f, 2.0f, 3.0f))); - expectedChanges.push_back(change); + expectedChanges.normalizedTime = 1.1f; // Invalid + expectedChanges.finalFrame = false; + expectedChanges.targetChanges.push_back({mapping.targetId, mapping.propertyName, QVariant::fromValue(QVector3D(1.0f, 2.0f, 3.0f))}); QTest::newRow("vec3 translation, final = false") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; - - normalizedTime = 1.0f; - auto normalizedTimeChange = Qt3DCore::QPropertyUpdatedChangePtr::create(animatorId); - normalizedTimeChange->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - normalizedTimeChange->setPropertyName("normalizedTime"); - normalizedTimeChange->setValue(normalizedTime); - expectedChanges.push_back(normalizedTimeChange); - - finalFrame = true; - auto animatorChange = Qt3DCore::QPropertyUpdatedChangePtr::create(animatorId); - animatorChange->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - animatorChange->setPropertyName("running"); - animatorChange->setValue(false); - expectedChanges.push_back(animatorChange); + << animatorId << mappingData << channelResults << expectedChanges; + + expectedChanges.normalizedTime = 1.0f; + expectedChanges.finalFrame = true; QTest::newRow("vec3 translation, final = true, normalizedTime = 1.0f") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } // Multiple properties, all vec3 @@ -871,46 +849,24 @@ private Q_SLOTS: channelResults = QVector<float>() << 1.0f << 2.0f << 3.0f << 4.0f << 5.0f << 6.0f; - finalFrame = false; - normalizedTime = -0.1f; // Invalid - - auto translationChange = Qt3DCore::QPropertyUpdatedChangePtr::create(translationMapping.targetId); - translationChange->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - translationChange->setPropertyName(translationMapping.propertyName); - translationChange->setValue(QVariant::fromValue(QVector3D(1.0f, 2.0f, 3.0f))); - expectedChanges.push_back(translationChange); + expectedChanges.finalFrame = false; + expectedChanges.normalizedTime = -0.1f; // Invalid - auto scaleChange = Qt3DCore::QPropertyUpdatedChangePtr::create(scaleMapping.targetId); - scaleChange->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - scaleChange->setPropertyName(scaleMapping.propertyName); - scaleChange->setValue(QVariant::fromValue(QVector3D(4.0f, 5.0f, 6.0f))); - expectedChanges.push_back(scaleChange); + expectedChanges.targetChanges.push_back({translationMapping.targetId, translationMapping.propertyName, QVariant::fromValue(QVector3D(1.0f, 2.0f, 3.0f))}); + expectedChanges.targetChanges.push_back({scaleMapping.targetId, scaleMapping.propertyName, QVariant::fromValue(QVector3D(4.0f, 5.0f, 6.0f))}); QTest::newRow("vec3 translation, vec3 scale, final = false") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; - - normalizedTime = 0.5f; - auto normalizedTimeChange = Qt3DCore::QPropertyUpdatedChangePtr::create(animatorId); - normalizedTimeChange->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - normalizedTimeChange->setPropertyName("normalizedTime"); - normalizedTimeChange->setValue(normalizedTime); - expectedChanges.push_back(normalizedTimeChange); - - finalFrame = true; - auto animatorChange = Qt3DCore::QPropertyUpdatedChangePtr::create(animatorId); - animatorChange->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - animatorChange->setPropertyName("running"); - animatorChange->setValue(false); - expectedChanges.push_back(animatorChange); + << animatorId << mappingData << channelResults << expectedChanges; + + expectedChanges.normalizedTime = 0.5f; + expectedChanges.finalFrame = true; QTest::newRow("vec3 translation, vec3 scale, final = true") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } // Single property, double @@ -923,22 +879,16 @@ private Q_SLOTS: mapping.channelIndices = QVector<int>() << 0; mappingData.push_back(mapping); channelResults = QVector<float>() << 3.5f; - finalFrame = false; - normalizedTime = -1.0f; // Invalid - - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId); - change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - change->setPropertyName(mapping.propertyName); - change->setValue(QVariant::fromValue(3.5f)); - expectedChanges.push_back(change); + expectedChanges.finalFrame = false; + expectedChanges.normalizedTime = -1.0f; // Invalid + expectedChanges.targetChanges.push_back({mapping.targetId, mapping.propertyName, QVariant::fromValue(3.5f)}); QTest::newRow("double mass") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } // Single property, vec2 @@ -951,22 +901,16 @@ private Q_SLOTS: mapping.channelIndices = QVector<int>() << 0 << 1; mappingData.push_back(mapping); channelResults = QVector<float>() << 2.0f << 1.0f; - finalFrame = false; - normalizedTime = 1.1f; // Invalid - - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId); - change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - change->setPropertyName(mapping.propertyName); - change->setValue(QVariant::fromValue(QVector2D(2.0f, 1.0f))); - expectedChanges.push_back(change); + expectedChanges.finalFrame = false; + expectedChanges.normalizedTime = 1.1f; // Invalid + expectedChanges.targetChanges.push_back({mapping.targetId, mapping.propertyName, QVariant::fromValue(QVector2D(2.0f, 1.0f))}); QTest::newRow("vec2 pos") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } // Single property, vec4 @@ -979,22 +923,16 @@ private Q_SLOTS: mapping.channelIndices = QVector<int>() << 0 << 1 << 2 << 3; mappingData.push_back(mapping); channelResults = QVector<float>() << 4.0f << 3.0f << 2.0f << 1.0f; - finalFrame = false; - normalizedTime = 1.1f; // Invalid - - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId); - change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - change->setPropertyName(mapping.propertyName); - change->setValue(QVariant::fromValue(QVector4D(4.0f, 3.0f, 2.0f, 1.0f))); - expectedChanges.push_back(change); + expectedChanges.finalFrame = false; + expectedChanges.normalizedTime = 1.1f; // Invalid + expectedChanges.targetChanges.push_back({mapping.targetId, mapping.propertyName, QVariant::fromValue(QVector4D(4.0f, 3.0f, 2.0f, 1.0f))}); QTest::newRow("vec4 foo") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } // Single property, quaternion @@ -1007,22 +945,16 @@ private Q_SLOTS: mapping.channelIndices = QVector<int>() << 0 << 1 << 2 << 3; mappingData.push_back(mapping); channelResults = QVector<float>() << 1.0f << 0.0f << 0.0f << 1.0f; - finalFrame = false; - normalizedTime = -0.1f; // Invalid - - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId); - change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - change->setPropertyName(mapping.propertyName); - change->setValue(QVariant::fromValue(QQuaternion(1.0f, 0.0f, 0.0f, 1.0f).normalized())); - expectedChanges.push_back(change); + expectedChanges.finalFrame = false; + expectedChanges.normalizedTime = -0.1f; // Invalid + expectedChanges.targetChanges.push_back({mapping.targetId, mapping.propertyName, QVariant::fromValue(QQuaternion(1.0f, 0.0f, 0.0f, 1.0f).normalized())}); QTest::newRow("quaternion rotation") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } // Single property, QColor @@ -1035,22 +967,16 @@ private Q_SLOTS: mapping.channelIndices = QVector<int>() << 0 << 1 << 2; mappingData.push_back(mapping); channelResults = QVector<float>() << 0.5f << 0.4f << 0.3f; - finalFrame = false; - normalizedTime = 1.1f; // Invalid - - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId); - change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - change->setPropertyName(mapping.propertyName); - change->setValue(QVariant::fromValue(QColor::fromRgbF(0.5f, 0.4f, 0.3f))); - expectedChanges.push_back(change); + expectedChanges.finalFrame = false; + expectedChanges.normalizedTime = 1.1f; // Invalid + expectedChanges.targetChanges.push_back({mapping.targetId, mapping.propertyName, QVariant::fromValue(QColor::fromRgbF(0.5f, 0.4f, 0.3f))}); QTest::newRow("QColor color") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } // Single property, QVariantList @@ -1063,23 +989,17 @@ private Q_SLOTS: mapping.channelIndices = QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6; mappingData.push_back(mapping); channelResults = QVector<float>() << 0.5f << 0.4f << 0.3f << 0.0f << 1.0f << 0.6f << 0.9f; - finalFrame = false; - normalizedTime = 1.1f; // Invalid - - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId); - change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - change->setPropertyName(mapping.propertyName); + expectedChanges.finalFrame = false; + expectedChanges.normalizedTime = 1.1f; // Invalid QVariantList expectedValue = QVariantList() << 0.5f << 0.4f << 0.3f << 0.0f << 1.0f << 0.6f << 0.9f; - change->setValue(QVariant::fromValue(expectedValue)); - expectedChanges.push_back(change); + expectedChanges.targetChanges.push_back({mapping.targetId, mapping.propertyName, QVariant::fromValue(expectedValue)}); QTest::newRow("QVariantList weights") - << animatorId << mappingData << channelResults << normalizedTime - << finalFrame << expectedChanges; + << animatorId << mappingData << channelResults << expectedChanges; mappingData.clear(); channelResults.clear(); - expectedChanges.clear(); + expectedChanges.targetChanges.clear(); } } @@ -1090,25 +1010,21 @@ private Q_SLOTS: QFETCH(Qt3DCore::QNodeId, animatorId); QFETCH(QVector<MappingData>, mappingData); QFETCH(QVector<float>, channelResults); - QFETCH(float, normalizedTime); - QFETCH(bool, finalFrame); - QFETCH(QVector<Qt3DCore::QPropertyUpdatedChangePtr>, expectedChanges); + QFETCH(AnimationRecord, expectedChanges); // WHEN - QVector<Qt3DCore::QSceneChangePtr> actualChanges - = preparePropertyChanges(animatorId, mappingData, channelResults, finalFrame, normalizedTime); + AnimationRecord actualChanges = prepareAnimationRecord(animatorId, mappingData, channelResults, + expectedChanges.finalFrame, expectedChanges.normalizedTime); // THEN - QCOMPARE(actualChanges.size(), expectedChanges.size()); - for (int i = 0; i < actualChanges.size(); ++i) { - auto expectedChange = expectedChanges[i]; - auto actualChange - = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(actualChanges[i]); - - QCOMPARE(actualChange->subjectId(), expectedChange->subjectId()); - QCOMPARE(actualChange->deliveryFlags(), expectedChange->deliveryFlags()); - QCOMPARE(actualChange->propertyName(), expectedChange->propertyName()); - QCOMPARE(actualChange->value(), expectedChange->value()); + QCOMPARE(actualChanges.targetChanges.size(), expectedChanges.targetChanges.size()); + for (int i = 0; i < actualChanges.targetChanges.size(); ++i) { + const auto &expectedChange = expectedChanges.targetChanges[i]; + const auto &actualChange = actualChanges.targetChanges[i]; + + QCOMPARE(actualChange.targetId, expectedChange.targetId); + QCOMPARE(actualChange.propertyName, expectedChange.propertyName); + QCOMPARE(actualChange.value, expectedChange.value); } } diff --git a/tests/auto/animation/channelmapper/tst_channelmapper.cpp b/tests/auto/animation/channelmapper/tst_channelmapper.cpp index 2dfa07a43..ad9f3c423 100644 --- a/tests/auto/animation/channelmapper/tst_channelmapper.cpp +++ b/tests/auto/animation/channelmapper/tst_channelmapper.cpp @@ -37,9 +37,6 @@ #include <Qt3DAnimation/private/qchannelmapper_p.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DCore/private/qbackendnode_p.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/animation/clipanimator/tst_clipanimator.cpp b/tests/auto/animation/clipanimator/tst_clipanimator.cpp index 5f297306a..5eccb0432 100644 --- a/tests/auto/animation/clipanimator/tst_clipanimator.cpp +++ b/tests/auto/animation/clipanimator/tst_clipanimator.cpp @@ -34,7 +34,6 @@ #include <Qt3DAnimation/qclock.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qbackendnode_p.h> #include <qbackendnodetester.h> #include <testpostmanarbiter.h> diff --git a/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp b/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp index 3d69d95d5..c8649a692 100644 --- a/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp +++ b/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp @@ -33,9 +33,6 @@ #include <Qt3DAnimation/private/qabstractclipblendnode_p.h> #include <Qt3DAnimation/private/clipblendnode_p.h> #include <Qt3DAnimation/private/managers_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include "qbackendnodetester.h" #include <random> diff --git a/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp b/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp index 47f309b10..75d1ab57f 100644 --- a/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp +++ b/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp @@ -32,7 +32,6 @@ #include <Qt3DAnimation/qanimationcliploader.h> #include <Qt3DAnimation/private/qclipblendvalue_p.h> #include <Qt3DAnimation/private/clipblendvalue_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include <random> diff --git a/tests/auto/animation/clock/tst_clock.cpp b/tests/auto/animation/clock/tst_clock.cpp index 793a01b25..03be85613 100644 --- a/tests/auto/animation/clock/tst_clock.cpp +++ b/tests/auto/animation/clock/tst_clock.cpp @@ -31,7 +31,6 @@ #include <Qt3DAnimation/private/clock_p.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qbackendnode_p.h> #include <qbackendnodetester.h> #include <testpostmanarbiter.h> diff --git a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp index 5d71b7dc6..baebf8e46 100644 --- a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp +++ b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp @@ -39,7 +39,6 @@ #include <Qt3DAnimation/private/managers_p.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qbackendnode_p.h> #include <qbackendnodetester.h> #include <testpostmanarbiter.h> diff --git a/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp b/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp index 732a87770..29c982253 100644 --- a/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp +++ b/tests/auto/animation/lerpclipblend/tst_lerpclipblend.cpp @@ -32,7 +32,6 @@ #include <Qt3DAnimation/qanimationcliploader.h> #include <Qt3DAnimation/private/qlerpclipblend_p.h> #include <Qt3DAnimation/private/lerpclipblend_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" using namespace Qt3DAnimation::Animation; diff --git a/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp b/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp index 2df135969..41f6b268a 100644 --- a/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp +++ b/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp @@ -33,7 +33,6 @@ #include <Qt3DAnimation/private/qadditiveclipblend_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DAnimation/qclipblendnodecreatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> diff --git a/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp b/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp index c52986055..274144d3e 100644 --- a/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp +++ b/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp @@ -158,42 +158,6 @@ private Q_SLOTS: } } - - void checkStatusPropertyUpdate() - { - // GIVEN - qRegisterMetaType<Qt3DAnimation::QAnimationClipLoader::Status>("Status"); - TestArbiter arbiter; - arbiter.setArbiterOnNode(this); - QSignalSpy spy(this, SIGNAL(statusChanged(Status))); - const Qt3DAnimation::QAnimationClipLoader::Status newStatus = Qt3DAnimation::QAnimationClipLoader::Error; - - // THEN - QVERIFY(spy.isValid()); - - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("status"); - valueChange->setValue(QVariant::fromValue(newStatus)); - sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(status(), newStatus); - - // WHEN - spy.clear(); - sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(status(), newStatus); - - // Cleanup - Qt3DCore::QNodePrivate::get(this)->setArbiter(nullptr); - } }; QTEST_MAIN(tst_QAnimationClipLoader) diff --git a/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp b/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp index 267ff03cb..81222292f 100644 --- a/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp +++ b/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp @@ -32,7 +32,6 @@ #include <Qt3DAnimation/private/qblendedclipanimator_p.h> #include <Qt3DAnimation/qlerpclipblend.h> #include <Qt3DAnimation/qchannelmapper.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <QObject> diff --git a/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp b/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp index 591ff54ce..fe1a2eda8 100644 --- a/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp +++ b/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp @@ -30,7 +30,6 @@ #include <Qt3DAnimation/qcallbackmapping.h> #include <Qt3DAnimation/private/qcallbackmapping_p.h> #include <Qt3DAnimation/private/qchannelmappingcreatedchange_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qentity.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> diff --git a/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp b/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp index e5a82e4c7..a55a509b2 100644 --- a/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp +++ b/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp @@ -35,10 +35,6 @@ #include <Qt3DAnimation/private/qchannelmapper_p.h> #include <Qt3DAnimation/qchannelmapping.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" class tst_QChannelmapper : public Qt3DAnimation::QChannelMapper diff --git a/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp b/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp index a47061077..749bc5ec7 100644 --- a/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp +++ b/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp @@ -31,7 +31,6 @@ #include <Qt3DAnimation/private/qabstractchannelmapping_p.h> #include <Qt3DAnimation/private/qchannelmapping_p.h> #include <Qt3DAnimation/private/qchannelmappingcreatedchange_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qentity.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> diff --git a/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp b/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp index 711653819..174cd6bce 100644 --- a/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp +++ b/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp @@ -34,7 +34,6 @@ #include <Qt3DAnimation/qclipanimator.h> #include <Qt3DAnimation/private/qanimationclip_p.h> #include <Qt3DAnimation/private/qclipanimator_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <QObject> diff --git a/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp b/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp index de1e13a33..b7e4f453b 100644 --- a/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp +++ b/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp @@ -33,7 +33,6 @@ #include <Qt3DAnimation/private/qclipblendvalue_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DAnimation/qclipblendnodecreatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> diff --git a/tests/auto/animation/qclock/tst_qclock.cpp b/tests/auto/animation/qclock/tst_qclock.cpp index b6050ade7..65c485566 100644 --- a/tests/auto/animation/qclock/tst_qclock.cpp +++ b/tests/auto/animation/qclock/tst_qclock.cpp @@ -30,7 +30,6 @@ #include <QtTest/QTest> #include <Qt3DAnimation/qclock.h> #include <Qt3DAnimation/private/qclock_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <QObject> diff --git a/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp b/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp index 1f7b646b4..68970838c 100644 --- a/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp +++ b/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp @@ -33,7 +33,6 @@ #include <Qt3DAnimation/private/qlerpclipblend_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DAnimation/qclipblendnodecreatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> diff --git a/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp b/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp index 843af441e..1eff6a568 100644 --- a/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp +++ b/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp @@ -30,7 +30,6 @@ #include <Qt3DAnimation/qskeletonmapping.h> #include <Qt3DAnimation/private/qskeletonmapping_p.h> #include <Qt3DCore/qskeleton.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qentity.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> diff --git a/tests/auto/animation/skeleton/tst_skeleton.cpp b/tests/auto/animation/skeleton/tst_skeleton.cpp index 9116be199..99acf0b43 100644 --- a/tests/auto/animation/skeleton/tst_skeleton.cpp +++ b/tests/auto/animation/skeleton/tst_skeleton.cpp @@ -63,7 +63,7 @@ private Q_SLOTS: skeleton.setRootJoint(rootJoint); // WHEN - simulateInitialization(&skeleton, &backendSkeleton); + simulateInitializationSync(&skeleton, &backendSkeleton); // THEN - nothing mirrored from frontend QCOMPARE(backendSkeleton.peerId(), skeleton.id()); @@ -127,37 +127,15 @@ private Q_SLOTS: Handler handler; Skeleton backendSkeleton; backendSkeleton.setHandler(&handler); - QPropertyUpdatedChangePtr updateChange; - - // WHEN - updateChange = QPropertyUpdatedChangePtr::create(QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendSkeleton.sceneChangeEvent(updateChange); - - // THEN - QCOMPARE(backendSkeleton.isEnabled(), true); - - // GIVEN - const QVector<QString> names = (QVector<QString>() - << QLatin1String("root") - << QLatin1String("child1") - << QLatin1String("child2")); - const QVector<Sqt> localPoses = (QVector<Sqt>() << Sqt() << Sqt() << Sqt()); + QSkeleton skeleton; + simulateInitializationSync(&skeleton, &backendSkeleton); // WHEN - JointNamesAndLocalPoses namesAndPoses; - namesAndPoses.names = names; - namesAndPoses.localPoses = localPoses; - - updateChange = QPropertyUpdatedChangePtr::create(QNodeId()); - updateChange->setPropertyName("jointNamesAndLocalPoses"); - updateChange->setValue(QVariant::fromValue(namesAndPoses)); - backendSkeleton.sceneChangeEvent(updateChange); + skeleton.setEnabled(false); + backendSkeleton.syncFromFrontEnd(&skeleton, false); // THEN - QCOMPARE(backendSkeleton.jointNames(), names); - QCOMPARE(backendSkeleton.jointLocalPoses(), localPoses); + QCOMPARE(backendSkeleton.isEnabled(), false); } void checkJointTransforms_data() diff --git a/tests/auto/core/common/testpostmanarbiter.cpp b/tests/auto/core/common/testpostmanarbiter.cpp index 3fd8c80d1..5869cbad3 100644 --- a/tests/auto/core/common/testpostmanarbiter.cpp +++ b/tests/auto/core/common/testpostmanarbiter.cpp @@ -94,6 +94,13 @@ void TestArbiter::addDirtyFrontEndNode(Qt3DCore::QNode *node) dirtyNodes << node; } +void TestArbiter::addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) +{ + if (!dirtyNodes.contains(node)) + dirtyNodes << node; + dirtySubNodes.push_back({node, subNode, change, property}); +} + void TestArbiter::removeDirtyFrontEndNode(Qt3DCore::QNode *node) { dirtyNodes.removeOne(node); diff --git a/tests/auto/core/common/testpostmanarbiter.h b/tests/auto/core/common/testpostmanarbiter.h index 8dfb5874e..cecc24f93 100644 --- a/tests/auto/core/common/testpostmanarbiter.h +++ b/tests/auto/core/common/testpostmanarbiter.h @@ -28,7 +28,6 @@ #include <Qt3DCore/private/qpostman_p.h> #include <Qt3DCore/private/qchangearbiter_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> QT_BEGIN_NAMESPACE @@ -67,9 +66,11 @@ public: QVector<Qt3DCore::QSceneChangePtr> events; QVector<Qt3DCore::QNode *> dirtyNodes; + QVector<Qt3DCore::NodeRelationshipChange> dirtySubNodes; void setArbiterOnNode(Qt3DCore::QNode *node); void addDirtyFrontEndNode(Qt3DCore::QNode *node) final; + void addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) final; void removeDirtyFrontEndNode(Qt3DCore::QNode *node) final; private: diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp index c5369ab3e..3b93e7715 100644 --- a/tests/auto/core/nodes/tst_nodes.cpp +++ b/tests/auto/core/nodes/tst_nodes.cpp @@ -33,7 +33,6 @@ #include <Qt3DCore/qaspectengine.h> #include <Qt3DCore/qabstractaspect.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qcomponentaddedchange.h> #include <Qt3DCore/qcomponentremovedchange.h> #include <Qt3DCore/qnodedestroyedchange.h> @@ -180,11 +179,18 @@ public: dirtyNodes << node; } + void addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) final { + if (!dirtyNodes.contains(node)) + dirtyNodes << node; + dirtySubNodes.push_back({node, subNode, change, property}); + } + void removeDirtyFrontEndNode(Qt3DCore::QNode *node) final { dirtyNodes.removeOne(node); - }; + } QVector<Qt3DCore::QNode *> dirtyNodes; + QVector<Qt3DCore::NodeRelationshipChange> dirtySubNodes; QList<ChangeRecord> events; QScopedPointer<SimplePostman> m_postman; }; @@ -1595,7 +1601,8 @@ void tst_Nodes::checkSceneIsSetOnConstructionWithParent() } // THEN - QCOMPARE(spy.events.size(), 10); // 5 QComponentAddedChange(entity, cmp) and 5 QComponentAddedChange(cmp, entity) + QCOMPARE(spy.events.size(), 0); + QCOMPARE(spy.dirtySubNodes.size(), 5); // 5 entities changed } void tst_Nodes::appendingParentlessComponentToEntityWithoutScene() @@ -1624,33 +1631,21 @@ void tst_Nodes::appendingParentlessComponentToEntityWithoutScene() QVERIFY(entity->components().count() == 1); QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(entitySpy.events.size(), 1); - QVERIFY(entitySpy.events.first().wasLocked()); - QCOMPARE(componentSpy.events.size(), 1); + QCOMPARE(entitySpy.events.size(), 0); + QCOMPARE(entitySpy.dirtyNodes.size(), 1); + QCOMPARE(entitySpy.dirtySubNodes.size(), 1); + + const auto event = entitySpy.dirtySubNodes.first(); + QCOMPARE(event.change, Qt3DCore::ComponentAdded); + QCOMPARE(event.node, entity.data()); + QCOMPARE(event.subNode, comp); + QCOMPARE(event.property, nullptr); // Note: since QEntity has no scene in this test case, we only have the // ComponentAdded event In theory we should also get the NodeCreated event // when setting the parent but that doesn't happen since no scene is // actually set on the entity and that QNodePrivate::_q_addChild will // return early in such a case. - - // Check that we received ComponentAdded - { - const auto event = entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), entity->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } - { - const auto event = componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), comp->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } } } @@ -1688,10 +1683,8 @@ void tst_Nodes::appendingParentlessComponentToNonRootEntity() QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(eventSpy.events.size(), 3); + QCOMPARE(eventSpy.events.size(), 1); // - entity added as child to root - // - component added for entity - // - component added for compontent QVERIFY(eventSpy.events.first().wasLocked()); QVERIFY(Qt3DCore::QNodePrivate::get(entity.data())->m_hasBackendNode); @@ -1705,24 +1698,6 @@ void tst_Nodes::appendingParentlessComponentToNonRootEntity() QCOMPARE(event->propertyName(), QByteArrayLiteral("children")); QCOMPARE(event->addedNodeId(), entity->id()); } - { - const auto event = eventSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QVERIFY(!event.isNull()); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), entity->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } - { - const auto event = eventSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QVERIFY(!event.isNull()); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), comp->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } } } @@ -1756,10 +1731,8 @@ void tst_Nodes::appendingParentlessComponentToEntityWithScene() QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(eventSpy.events.size(), 3); + QCOMPARE(eventSpy.events.size(), 1); // - child added - // - component added for entity - // - component added for compontent QVERIFY(eventSpy.events.first().wasLocked()); { @@ -1770,24 +1743,6 @@ void tst_Nodes::appendingParentlessComponentToEntityWithScene() QCOMPARE(event->propertyName(), QByteArrayLiteral("children")); QCOMPARE(event->addedNodeId(), comp->id()); } - { - const auto event = eventSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QVERIFY(!event.isNull()); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), entity->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } - { - const auto event = eventSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QVERIFY(!event.isNull()); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), comp->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } } } @@ -1817,24 +1772,15 @@ void tst_Nodes::appendingComponentToEntity() QVERIFY(entity->components().count() == 1); QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(entitySpy.events.size(), 1); - QVERIFY(entitySpy.events.first().wasLocked()); - { - const auto event = entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), entity->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } - { - const auto event = componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>(); - QCOMPARE(event->type(), Qt3DCore::ComponentAdded); - QCOMPARE(event->subjectId(), comp->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } + QCOMPARE(entitySpy.events.size(), 0); + QCOMPARE(entitySpy.dirtyNodes.size(), 1); + QCOMPARE(entitySpy.dirtySubNodes.size(), 1); + QCOMPARE(entitySpy.dirtyNodes.first(), entity.data()); + const auto event = entitySpy.dirtySubNodes.takeFirst(); + QCOMPARE(event.node, entity.data()); + QCOMPARE(event.subNode, comp); + QCOMPARE(event.change, Qt3DCore::ComponentAdded); + QCOMPARE(event.property, nullptr); } } @@ -1859,6 +1805,8 @@ void tst_Nodes::removingComponentFromEntity() // WHEN entitySpy.events.clear(); + entitySpy.dirtyNodes.clear(); + entitySpy.dirtySubNodes.clear(); componentSpy.events.clear(); entity->removeComponent(comp); @@ -1866,24 +1814,17 @@ void tst_Nodes::removingComponentFromEntity() QVERIFY(entity->components().count() == 0); QVERIFY(comp->parent() == entity.data()); QVERIFY(entity->children().count() == 1); - QCOMPARE(entitySpy.events.size(), 1); - QVERIFY(entitySpy.events.first().wasLocked()); - QCOMPARE(componentSpy.events.size(), 1); - { - const auto event = entitySpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentRemovedChange>(); - QCOMPARE(event->type(), Qt3DCore::ComponentRemoved); - QCOMPARE(event->subjectId(), entity->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); - } + QCOMPARE(entitySpy.events.size(), 0); + QCOMPARE(entitySpy.dirtyNodes.size(), 1); + QCOMPARE(entitySpy.dirtySubNodes.size(), 1); + QCOMPARE(componentSpy.events.size(), 0); { - const auto event = componentSpy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentRemovedChange>(); - QCOMPARE(event->type(), Qt3DCore::ComponentRemoved); - QCOMPARE(event->subjectId(), comp->id()); - QCOMPARE(event->entityId(), entity->id()); - QCOMPARE(event->componentId(), comp->id()); - QCOMPARE(event->componentMetaObject(), comp->metaObject()); + const auto event = entitySpy.dirtySubNodes.takeFirst(); + qDebug() << event.change; + QCOMPARE(event.change, Qt3DCore::ComponentRemoved); + QCOMPARE(event.node, entity.data()); + QCOMPARE(event.subNode, comp); + QCOMPARE(event.property, nullptr); } } } diff --git a/tests/auto/core/qarmature/tst_qarmature.cpp b/tests/auto/core/qarmature/tst_qarmature.cpp index b64757b5c..098efd1af 100644 --- a/tests/auto/core/qarmature/tst_qarmature.cpp +++ b/tests/auto/core/qarmature/tst_qarmature.cpp @@ -30,7 +30,6 @@ #include <Qt3DCore/qarmature.h> #include <Qt3DCore/private/qarmature_p.h> #include <Qt3DCore/qskeleton.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> diff --git a/tests/auto/core/qjoint/tst_qjoint.cpp b/tests/auto/core/qjoint/tst_qjoint.cpp index 436814f7f..2fff33b8f 100644 --- a/tests/auto/core/qjoint/tst_qjoint.cpp +++ b/tests/auto/core/qjoint/tst_qjoint.cpp @@ -29,7 +29,6 @@ #include <QtTest/QTest> #include <Qt3DCore/qjoint.h> #include <Qt3DCore/private/qjoint_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <QObject> diff --git a/tests/auto/core/qskeleton/tst_qskeleton.cpp b/tests/auto/core/qskeleton/tst_qskeleton.cpp index 04c9bf7a1..299567806 100644 --- a/tests/auto/core/qskeleton/tst_qskeleton.cpp +++ b/tests/auto/core/qskeleton/tst_qskeleton.cpp @@ -31,8 +31,6 @@ #include <Qt3DCore/private/qskeleton_p.h> #include <Qt3DCore/qjoint.h> #include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> diff --git a/tests/auto/core/qtransform/tst_qtransform.cpp b/tests/auto/core/qtransform/tst_qtransform.cpp index dd13b28f7..37848ffd6 100644 --- a/tests/auto/core/qtransform/tst_qtransform.cpp +++ b/tests/auto/core/qtransform/tst_qtransform.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QtTest/QtTest> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qtransform.h> #include <Qt3DCore/qcomponent.h> #include <Qt3DCore/private/qtransform_p.h> diff --git a/tests/auto/coretest/testpostmanarbiter_p.h b/tests/auto/coretest/testpostmanarbiter_p.h index 26c0cbc67..8954357fe 100644 --- a/tests/auto/coretest/testpostmanarbiter_p.h +++ b/tests/auto/coretest/testpostmanarbiter_p.h @@ -42,7 +42,6 @@ #include <Qt3DCore/private/qpostman_p.h> #include <Qt3DCore/private/qchangearbiter_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> QT_BEGIN_NAMESPACE diff --git a/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp b/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp index 1390b6b49..48ac4b3fe 100644 --- a/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp +++ b/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp @@ -89,7 +89,7 @@ private Q_SLOTS: axisInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); // THEN QCOMPARE(backendAxisInput.peerId(), axisInput.id()); @@ -114,7 +114,7 @@ private Q_SLOTS: axisInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); backendAxisInput.cleanup(); // THEN @@ -125,23 +125,21 @@ private Q_SLOTS: void checkPropertyChanges() { // GIVEN + DummyAxisInput axisInput; DummyAxisInputBackend backendAxisInput; + simulateInitializationSync(&axisInput, &backendAxisInput); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setEnabled(false); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN - QCOMPARE(backendAxisInput.isEnabled(), true); + QCOMPARE(backendAxisInput.isEnabled(), false); // WHEN TestDevice device; - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("sourceDevice"); - updateChange->setValue(QVariant::fromValue(device.id())); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setSourceDevice(&device); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.sourceDevice(), device.id()); diff --git a/tests/auto/input/action/tst_action.cpp b/tests/auto/input/action/tst_action.cpp index 7ef9bca1e..6b8b11b80 100644 --- a/tests/auto/input/action/tst_action.cpp +++ b/tests/auto/input/action/tst_action.cpp @@ -64,7 +64,7 @@ private Q_SLOTS: action.addInput(&actionInput); // WHEN - simulateInitialization(&action, &backendAction); + simulateInitializationSync(&action, &backendAction); // THEN QCOMPARE(backendAction.peerId(), action.id()); @@ -96,7 +96,7 @@ private Q_SLOTS: action.addInput(&axisInput); // WHEN - simulateInitialization(&action, &backendAction); + simulateInitializationSync(&action, &backendAction); backendAction.setActionTriggered(true); backendAction.cleanup(); @@ -109,70 +109,35 @@ private Q_SLOTS: void checkPropertyChanges() { // GIVEN + Qt3DInput::QAction action; Qt3DInput::Input::Action backendAction; - Qt3DCore::QPropertyUpdatedChangePtr updateChange; + simulateInitializationSync(&action, &backendAction); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendAction.sceneChangeEvent(updateChange); + action.setEnabled(false); + backendAction.syncFromFrontEnd(&action, false); // THEN - QCOMPARE(backendAction.isEnabled(), true); + QCOMPARE(backendAction.isEnabled(), false); // WHEN DummyActionInput input; const Qt3DCore::QNodeId inputId = input.id(); - const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &input); - nodeAddedChange->setPropertyName("input"); - backendAction.sceneChangeEvent(nodeAddedChange); + action.addInput(&input); + backendAction.syncFromFrontEnd(&action, false); // THEN QCOMPARE(backendAction.inputs().size(), 1); QCOMPARE(backendAction.inputs().first(), inputId); // WHEN - const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &input); - nodeRemovedChange->setPropertyName("input"); - backendAction.sceneChangeEvent(nodeRemovedChange); + action.removeInput(&input); + backendAction.syncFromFrontEnd(&action, false); // THEN QCOMPARE(backendAction.inputs().size(), 0); } - void checkActivePropertyBackendNotification() - { - // GIVEN - TestArbiter arbiter; - Qt3DInput::Input::Action backendAction; - backendAction.setEnabled(true); - Qt3DCore::QBackendNodePrivate::get(&backendAction)->setArbiter(&arbiter); - const bool currentActionTriggeredValue = backendAction.actionTriggered(); - - // WHEN - backendAction.setActionTriggered(true); - - // THEN - QVERIFY(currentActionTriggeredValue != backendAction.actionTriggered()); - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "active"); - QCOMPARE(change->value().toBool(), backendAction.actionTriggered()); - - - arbiter.events.clear(); - - // WHEN - backendAction.setActionTriggered(true); - - // THEN - QVERIFY(currentActionTriggeredValue != backendAction.actionTriggered()); - QCOMPARE(arbiter.events.count(), 0); - - arbiter.events.clear(); - } - void shouldNotActivateWhenDisabled() { // GIVEN diff --git a/tests/auto/input/actioninput/tst_actioninput.cpp b/tests/auto/input/actioninput/tst_actioninput.cpp index 23dfaad64..3c9918da0 100644 --- a/tests/auto/input/actioninput/tst_actioninput.cpp +++ b/tests/auto/input/actioninput/tst_actioninput.cpp @@ -30,7 +30,6 @@ #include <qbackendnodetester.h> #include "testdevice.h" -#include <Qt3DCore/QPropertyUpdatedChange> #include <Qt3DInput/private/actioninput_p.h> #include <Qt3DInput/private/inputhandler_p.h> #include <Qt3DInput/QActionInput> @@ -50,7 +49,7 @@ private Q_SLOTS: actionInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&actionInput, &backendActionInput); + simulateInitializationSync(&actionInput, &backendActionInput); // THEN QCOMPARE(backendActionInput.peerId(), actionInput.id()); @@ -78,7 +77,7 @@ private Q_SLOTS: actionInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&actionInput, &backendActionInput); + simulateInitializationSync(&actionInput, &backendActionInput); backendActionInput.cleanup(); // THEN @@ -90,32 +89,28 @@ private Q_SLOTS: void shouldHandlePropertyChanges() { // GIVEN + Qt3DInput::QActionInput actionInput; Qt3DInput::Input::ActionInput backendActionInput; + simulateInitializationSync(&actionInput, &backendActionInput); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setValue(QVariant::fromValue(QVector<int>() << 64)); - updateChange->setPropertyName("buttons"); - backendActionInput.sceneChangeEvent(updateChange); + actionInput.setButtons(QVector<int>() << 64); + backendActionInput.syncFromFrontEnd(&actionInput, false); // THEN QCOMPARE(backendActionInput.buttons(), QVector<int>() << 64); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendActionInput.sceneChangeEvent(updateChange); + actionInput.setEnabled(false); + backendActionInput.syncFromFrontEnd(&actionInput, false); // THEN - QCOMPARE(backendActionInput.isEnabled(), true); + QCOMPARE(backendActionInput.isEnabled(), false); // WHEN TestDevice device; - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("sourceDevice"); - updateChange->setValue(QVariant::fromValue(device.id())); - backendActionInput.sceneChangeEvent(updateChange); + actionInput.setSourceDevice(&device); + backendActionInput.syncFromFrontEnd(&actionInput, false); // THEN QCOMPARE(backendActionInput.sourceDevice(), device.id()); @@ -135,7 +130,7 @@ private Q_SLOTS: actionInput.setEnabled(true); actionInput.setButtons(QVector<int>() << Qt::Key_Space << Qt::Key_Return); actionInput.setSourceDevice(device); - simulateInitialization(&actionInput, &backendActionInput); + simulateInitializationSync(&actionInput, &backendActionInput); // WHEN deviceBackend->setButtonPressed(Qt::Key_Up, true); @@ -188,7 +183,7 @@ private Q_SLOTS: actionInput.setEnabled(false); actionInput.setButtons(QVector<int>() << Qt::Key_Space << Qt::Key_Return); actionInput.setSourceDevice(device); - simulateInitialization(&actionInput, &backendActionInput); + simulateInitializationSync(&actionInput, &backendActionInput); // WHEN deviceBackend->setButtonPressed(Qt::Key_Space, true); diff --git a/tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp b/tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp index a37c37e96..0bdaadc46 100644 --- a/tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp +++ b/tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp @@ -55,7 +55,7 @@ private Q_SLOTS: axisInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); // THEN QCOMPARE(backendAxisInput.peerId(), axisInput.id()); @@ -83,7 +83,7 @@ private Q_SLOTS: axisInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); backendAxisInput.cleanup(); // THEN @@ -95,32 +95,28 @@ private Q_SLOTS: void checkPropertyChanges() { // GIVEN + Qt3DInput::QAnalogAxisInput axisInput; Qt3DInput::Input::AnalogAxisInput backendAxisInput; + simulateInitializationSync(&axisInput, &backendAxisInput); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setValue(32); - updateChange->setPropertyName("axis"); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setAxis(32); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.axis(), 32); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setEnabled(false); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN - QCOMPARE(backendAxisInput.isEnabled(), true); + QCOMPARE(backendAxisInput.isEnabled(), false); // WHEN TestDevice device; - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("sourceDevice"); - updateChange->setValue(QVariant::fromValue(device.id())); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setSourceDevice(&device); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.sourceDevice(), device.id()); @@ -142,7 +138,7 @@ private Q_SLOTS: axisInput.setEnabled(true); axisInput.setAxis(2); axisInput.setSourceDevice(device); - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); QCOMPARE(backendAxisInput.axis(), 2); // WHEN @@ -176,7 +172,7 @@ private Q_SLOTS: axisInput.setEnabled(false); axisInput.setAxis(2); axisInput.setSourceDevice(device); - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); QCOMPARE(backendAxisInput.axis(), 2); // WHEN diff --git a/tests/auto/input/axis/tst_axis.cpp b/tests/auto/input/axis/tst_axis.cpp index 8ad8098af..de9d5c553 100644 --- a/tests/auto/input/axis/tst_axis.cpp +++ b/tests/auto/input/axis/tst_axis.cpp @@ -139,37 +139,6 @@ private Q_SLOTS: QCOMPARE(backendAxis.inputs().size(), 0); } - void checkValuePropertyBackendNotification() - { - // GIVEN - TestArbiter arbiter; - Qt3DInput::Input::Axis backendAxis; - backendAxis.setEnabled(true); - Qt3DCore::QBackendNodePrivate::get(&backendAxis)->setArbiter(&arbiter); - - // WHEN - backendAxis.setAxisValue(454.0f); - - // THEN - QCOMPARE(backendAxis.axisValue(), 454.0f); - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "value"); - QCOMPARE(change->value().toFloat(), backendAxis.axisValue()); - - arbiter.events.clear(); - - // WHEN - backendAxis.setAxisValue(454.0f); - - // THEN - QCOMPARE(backendAxis.axisValue(), 454.0f); - QCOMPARE(arbiter.events.count(), 0); - - arbiter.events.clear(); - - } - void shouldNotChangeValueWhenDisabled() { // GIVEN diff --git a/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp b/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp index 8e0b499fd..f7d7d32f1 100644 --- a/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp +++ b/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp @@ -28,11 +28,9 @@ #include <QtTest/QTest> #include <qbackendnodetester.h> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DInput/private/axis_p.h> #include <Qt3DInput/private/axisaccumulator_p.h> #include <Qt3DInput/private/qabstractaxisinput_p.h> @@ -61,7 +59,7 @@ private Q_SLOTS: axisAccumulator.setScale(2.0f); // WHEN - simulateInitialization(&axisAccumulator, &backendAccumulator); + simulateInitializationSync(&axisAccumulator, &backendAccumulator); // THEN QCOMPARE(backendAccumulator.peerId(), axisAccumulator.id()); @@ -95,7 +93,7 @@ private Q_SLOTS: axisAccumulator.setEnabled(true); // WHEN - simulateInitialization(&axisAccumulator, &backendAxisAccumulator); + simulateInitializationSync(&axisAccumulator, &backendAxisAccumulator); backendAxisAccumulator.cleanup(); // THEN @@ -110,100 +108,41 @@ private Q_SLOTS: void checkPropertyChanges() { // GIVEN + Qt3DInput::QAxisAccumulator axisAccumulator; Qt3DInput::Input::AxisAccumulator backendAxisAccumulator; - Qt3DCore::QPropertyUpdatedChangePtr updateChange; + simulateInitializationSync(&axisAccumulator, &backendAxisAccumulator); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendAxisAccumulator.sceneChangeEvent(updateChange); + axisAccumulator.setEnabled(false); + backendAxisAccumulator.syncFromFrontEnd(&axisAccumulator, false); // THEN - QCOMPARE(backendAxisAccumulator.isEnabled(), true); + QCOMPARE(backendAxisAccumulator.isEnabled(), false); // WHEN Qt3DInput::QAxis axis; const Qt3DCore::QNodeId axisId = axis.id(); - updateChange = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("sourceAxis"); - updateChange->setValue(QVariant::fromValue(axisId)); - backendAxisAccumulator.sceneChangeEvent(updateChange); + axisAccumulator.setSourceAxis(&axis); + backendAxisAccumulator.syncFromFrontEnd(&axisAccumulator, false); // THEN QCOMPARE(backendAxisAccumulator.sourceAxisId(), axisId); // WHEN - updateChange = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("sourceAxisType"); - updateChange->setValue(Qt3DInput::QAxisAccumulator::Acceleration); - backendAxisAccumulator.sceneChangeEvent(updateChange); + axisAccumulator.setSourceAxisType(Qt3DInput::QAxisAccumulator::Acceleration); + backendAxisAccumulator.syncFromFrontEnd(&axisAccumulator, false); // THEN QCOMPARE(backendAxisAccumulator.sourceAxisType(), Qt3DInput::QAxisAccumulator::Acceleration); // WHEN - updateChange = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("scale"); - updateChange->setValue(3.0f); - backendAxisAccumulator.sceneChangeEvent(updateChange); + axisAccumulator.setScale(3.f); + backendAxisAccumulator.syncFromFrontEnd(&axisAccumulator, false); // THEN QCOMPARE(backendAxisAccumulator.scale(), 3.0f); } - void checkValuePropertyBackendNotification() - { - // GIVEN - TestArbiter arbiter; - Qt3DInput::Input::AxisAccumulator backendAxisAccumulator; - backendAxisAccumulator.setEnabled(true); - Qt3DCore::QBackendNodePrivate::get(&backendAxisAccumulator)->setArbiter(&arbiter); - - // WHEN - backendAxisAccumulator.setValue(454.0f); - - // THEN - QCOMPARE(backendAxisAccumulator.value(), 454.0f); - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "value"); - QCOMPARE(change->value().toFloat(), backendAxisAccumulator.value()); - - arbiter.events.clear(); - - // WHEN - backendAxisAccumulator.setValue(454.0f); - - // THEN - QCOMPARE(backendAxisAccumulator.value(), 454.0f); - QCOMPARE(arbiter.events.count(), 0); - - arbiter.events.clear(); - - - // WHEN - backendAxisAccumulator.setVelocity(383.0f); - - // THEN - QCOMPARE(backendAxisAccumulator.velocity(), 383.0f); - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr velocityChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(velocityChange->propertyName(), "velocity"); - QCOMPARE(velocityChange->value().toFloat(), backendAxisAccumulator.velocity()); - - arbiter.events.clear(); - - // WHEN - backendAxisAccumulator.setVelocity(383.0f); - - // THEN - QCOMPARE(backendAxisAccumulator.velocity(), 383.0f); - QCOMPARE(arbiter.events.count(), 0); - - arbiter.events.clear(); - } - void shouldNotChangeValueWhenDisabled() { // GIVEN @@ -288,7 +227,7 @@ private Q_SLOTS: axisAccumulator.setScale(scale); axisAccumulator.setSourceAxisType(sourceAxisType); axisAccumulator.setEnabled(true); - simulateInitialization(&axisAccumulator, &backendAxisAccumulator); + simulateInitializationSync(&axisAccumulator, &backendAxisAccumulator); backendAxisAccumulator.stepIntegration(&axisManager, dt); diff --git a/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp b/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp index fa3bca3d2..91085357a 100644 --- a/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp +++ b/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp @@ -30,9 +30,6 @@ #include <qbackendnodetester.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DInput/private/axis_p.h> #include <Qt3DInput/private/axisaccumulator_p.h> #include <Qt3DInput/private/axisaccumulatorjob_p.h> @@ -79,7 +76,7 @@ private Q_SLOTS: axisAccumulator->setSourceAxis(axis); axisAccumulator->setScale(scale); axisAccumulator->setSourceAxisType(sourceAxisType); - simulateInitialization(axisAccumulator, backendAxisAccumulator); + simulateInitializationSync(axisAccumulator, backendAxisAccumulator); } // WHEN diff --git a/tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp b/tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp index 18887cfe6..5debe4d99 100644 --- a/tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp +++ b/tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp @@ -58,7 +58,7 @@ private Q_SLOTS: axisInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); // THEN QCOMPARE(backendAxisInput.peerId(), axisInput.id()); @@ -98,7 +98,7 @@ private Q_SLOTS: axisInput.setSourceDevice(&sourceDevice); // WHEN - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); backendAxisInput.cleanup(); // THEN @@ -115,77 +115,63 @@ private Q_SLOTS: void checkPropertyChanges() { // GIVEN + Qt3DInput::QButtonAxisInput axisInput; Qt3DInput::Input::ButtonAxisInput backendAxisInput; + simulateInitializationSync(&axisInput, &backendAxisInput); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setValue(QVariant::fromValue(QVector<int>() << 64)); - updateChange->setPropertyName("buttons"); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setButtons(QVector<int>() << 64); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.buttons(), QVector<int>() << 64); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setValue(0.5f); - updateChange->setPropertyName("scale"); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setScale(0.5f); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.scale(), 0.5f); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setEnabled(false); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN - QCOMPARE(backendAxisInput.isEnabled(), true); + QCOMPARE(backendAxisInput.isEnabled(), false); // WHEN TestDevice device; - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("sourceDevice"); - updateChange->setValue(QVariant::fromValue(device.id())); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setSourceDevice(&device); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.sourceDevice(), device.id()); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setValue(0.42f); - updateChange->setPropertyName("acceleration"); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setAcceleration(0.42f); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.acceleration(), 0.42f); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setValue(-0.42f); - updateChange->setPropertyName("acceleration"); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setAcceleration(-0.42f); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QVERIFY(qIsInf(backendAxisInput.acceleration())); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setValue(0.43f); - updateChange->setPropertyName("deceleration"); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setDeceleration(0.43f); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QCOMPARE(backendAxisInput.deceleration(), 0.43f); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setValue(-0.43f); - updateChange->setPropertyName("deceleration"); - backendAxisInput.sceneChangeEvent(updateChange); + axisInput.setDeceleration(-0.43f); + backendAxisInput.syncFromFrontEnd(&axisInput, false); // THEN QVERIFY(qIsInf(backendAxisInput.deceleration())); @@ -210,7 +196,7 @@ private Q_SLOTS: axisInput.setAcceleration(0.15f); axisInput.setDeceleration(0.3f); axisInput.setSourceDevice(device); - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); QCOMPARE(backendAxisInput.speedRatio(), 0.0f); QCOMPARE(backendAxisInput.lastUpdateTime(), 0); @@ -311,7 +297,7 @@ private Q_SLOTS: axisInput.setAcceleration(0.15f); axisInput.setDeceleration(0.3f); axisInput.setSourceDevice(device); - simulateInitialization(&axisInput, &backendAxisInput); + simulateInitializationSync(&axisInput, &backendAxisInput); QCOMPARE(backendAxisInput.speedRatio(), 0.0f); QCOMPARE(backendAxisInput.lastUpdateTime(), 0); diff --git a/tests/auto/input/commons/testdeviceproxy.h b/tests/auto/input/commons/testdeviceproxy.h index 13e10d501..737eadfe7 100644 --- a/tests/auto/input/commons/testdeviceproxy.h +++ b/tests/auto/input/commons/testdeviceproxy.h @@ -103,9 +103,10 @@ public: return d->m_device; } - void simulateSceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) + void setDevice(TestPhysicalDevice *device) { - Qt3DInput::QAbstractPhysicalDeviceProxy::sceneChangeEvent(change); + Q_D(TestProxy); + d->setDevice(device); } private: diff --git a/tests/auto/input/inputchord/tst_inputchord.cpp b/tests/auto/input/inputchord/tst_inputchord.cpp index 093bd29f7..e34fc4abe 100644 --- a/tests/auto/input/inputchord/tst_inputchord.cpp +++ b/tests/auto/input/inputchord/tst_inputchord.cpp @@ -30,9 +30,6 @@ #include <qbackendnodetester.h> #include "testdevice.h" -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> #include <Qt3DInput/private/actioninput_p.h> #include <Qt3DInput/private/inputchord_p.h> #include <Qt3DInput/private/inputhandler_p.h> @@ -55,7 +52,7 @@ private Q_SLOTS: inputChord.addChord(&actionInput); // WHEN - simulateInitialization(&inputChord, &backendInputChord); + simulateInitializationSync(&inputChord, &backendInputChord); // THEN QCOMPARE(backendInputChord.peerId(), inputChord.id()); @@ -89,7 +86,7 @@ private Q_SLOTS: inputChord.addChord(&actionInput); // WHEN - simulateInitialization(&inputChord, &backendInputChord); + simulateInitializationSync(&inputChord, &backendInputChord); backendInputChord.cleanup(); // THEN @@ -101,41 +98,37 @@ private Q_SLOTS: void shouldHandlePropertyChanges() { // GIVEN + Qt3DInput::QInputChord inputChord; Qt3DInput::Input::InputChord backendInputChord; + simulateInitializationSync(&inputChord, &backendInputChord); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setValue(250); - updateChange->setPropertyName("timeout"); - backendInputChord.sceneChangeEvent(updateChange); + inputChord.setTimeout(250); + backendInputChord.syncFromFrontEnd(&inputChord, false); // THEN QCOMPARE(backendInputChord.timeout(), 250000000); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendInputChord.sceneChangeEvent(updateChange); + inputChord.setEnabled(false); + backendInputChord.syncFromFrontEnd(&inputChord, false); // THEN - QCOMPARE(backendInputChord.isEnabled(), true); + QCOMPARE(backendInputChord.isEnabled(), false); // WHEN Qt3DInput::QActionInput input; const Qt3DCore::QNodeId inputId = input.id(); - const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &input); - nodeAddedChange->setPropertyName("chord"); - backendInputChord.sceneChangeEvent(nodeAddedChange); + inputChord.addChord(&input); + backendInputChord.syncFromFrontEnd(&inputChord, false); // THEN QCOMPARE(backendInputChord.chords().size(), 1); QCOMPARE(backendInputChord.chords().first(), inputId); // WHEN - const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &input); - nodeRemovedChange->setPropertyName("chord"); - backendInputChord.sceneChangeEvent(nodeRemovedChange); + inputChord.removeChord(&input); + backendInputChord.syncFromFrontEnd(&inputChord, false); // THEN QCOMPARE(backendInputChord.chords().size(), 0); @@ -154,13 +147,13 @@ private Q_SLOTS: firstInput->setButtons(QVector<int>() << Qt::Key_Q << Qt::Key_W); firstInput->setSourceDevice(device); auto backendFirstInput = handler.actionInputManager()->getOrCreateResource(firstInput->id()); - simulateInitialization(firstInput, backendFirstInput); + simulateInitializationSync(firstInput, backendFirstInput); auto secondInput = new Qt3DInput::QActionInput; secondInput->setButtons(QVector<int>() << Qt::Key_A << Qt::Key_S); secondInput->setSourceDevice(device); auto backendSecondInput = handler.actionInputManager()->getOrCreateResource(secondInput->id()); - simulateInitialization(secondInput, backendSecondInput); + simulateInitializationSync(secondInput, backendSecondInput); Qt3DInput::Input::InputChord backendInputChord; Qt3DInput::QInputChord inputChord; @@ -168,7 +161,7 @@ private Q_SLOTS: inputChord.setTimeout(300); inputChord.addChord(firstInput); inputChord.addChord(secondInput); - simulateInitialization(&inputChord, &backendInputChord); + simulateInitializationSync(&inputChord, &backendInputChord); // WHEN deviceBackend->setButtonPressed(Qt::Key_Up, true); @@ -242,13 +235,13 @@ private Q_SLOTS: firstInput->setButtons(QVector<int>() << Qt::Key_Q); firstInput->setSourceDevice(device); auto backendFirstInput = handler.actionInputManager()->getOrCreateResource(firstInput->id()); - simulateInitialization(firstInput, backendFirstInput); + simulateInitializationSync(firstInput, backendFirstInput); auto secondInput = new Qt3DInput::QActionInput; secondInput->setButtons(QVector<int>() << Qt::Key_W); secondInput->setSourceDevice(device); auto backendSecondInput = handler.actionInputManager()->getOrCreateResource(secondInput->id()); - simulateInitialization(secondInput, backendSecondInput); + simulateInitializationSync(secondInput, backendSecondInput); Qt3DInput::Input::InputChord backendInputChord; Qt3DInput::QInputChord inputChord; @@ -256,7 +249,7 @@ private Q_SLOTS: inputChord.setTimeout(300); inputChord.addChord(firstInput); inputChord.addChord(secondInput); - simulateInitialization(&inputChord, &backendInputChord); + simulateInitializationSync(&inputChord, &backendInputChord); // WHEN deviceBackend->setButtonPressed(Qt::Key_Q, true); @@ -290,13 +283,13 @@ private Q_SLOTS: firstInput->setButtons(QVector<int>() << Qt::Key_Q); firstInput->setSourceDevice(device); auto backendFirstInput = handler.actionInputManager()->getOrCreateResource(firstInput->id()); - simulateInitialization(firstInput, backendFirstInput); + simulateInitializationSync(firstInput, backendFirstInput); auto secondInput = new Qt3DInput::QActionInput; secondInput->setButtons(QVector<int>() << Qt::Key_W); secondInput->setSourceDevice(device); auto backendSecondInput = handler.actionInputManager()->getOrCreateResource(secondInput->id()); - simulateInitialization(secondInput, backendSecondInput); + simulateInitializationSync(secondInput, backendSecondInput); Qt3DInput::Input::InputChord backendInputChord; Qt3DInput::QInputChord inputChord; @@ -304,7 +297,7 @@ private Q_SLOTS: inputChord.setTimeout(300); inputChord.addChord(firstInput); inputChord.addChord(secondInput); - simulateInitialization(&inputChord, &backendInputChord); + simulateInitializationSync(&inputChord, &backendInputChord); // WHEN deviceBackend->setButtonPressed(Qt::Key_Q, true); diff --git a/tests/auto/input/inputsequence/tst_inputsequence.cpp b/tests/auto/input/inputsequence/tst_inputsequence.cpp index b5630ddb5..6059d7e9c 100644 --- a/tests/auto/input/inputsequence/tst_inputsequence.cpp +++ b/tests/auto/input/inputsequence/tst_inputsequence.cpp @@ -30,9 +30,6 @@ #include <qbackendnodetester.h> #include "testdevice.h" -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> #include <Qt3DInput/private/actioninput_p.h> #include <Qt3DInput/private/inputhandler_p.h> #include <Qt3DInput/private/inputmanagers_p.h> @@ -56,7 +53,7 @@ private Q_SLOTS: inputSequence.addSequence(&actionInput); // WHEN - simulateInitialization(&inputSequence, &backendInputSequence); + simulateInitializationSync(&inputSequence, &backendInputSequence); // THEN QCOMPARE(backendInputSequence.peerId(), inputSequence.id()); @@ -93,7 +90,7 @@ private Q_SLOTS: inputSequence.addSequence(&actionInput); // WHEN - simulateInitialization(&inputSequence, &backendInputSequence); + simulateInitializationSync(&inputSequence, &backendInputSequence); backendInputSequence.cleanup(); // THEN @@ -106,50 +103,44 @@ private Q_SLOTS: void shouldHandlePropertyChanges() { // GIVEN + Qt3DInput::QInputSequence inputSequence; Qt3DInput::Input::InputSequence backendInputSequence; + simulateInitializationSync(&inputSequence, &backendInputSequence); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setValue(250); - updateChange->setPropertyName("timeout"); - backendInputSequence.sceneChangeEvent(updateChange); + inputSequence.setTimeout(250); + backendInputSequence.syncFromFrontEnd(&inputSequence, false); // THEN QCOMPARE(backendInputSequence.timeout(), 250000000); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setValue(150); - updateChange->setPropertyName("buttonInterval"); - backendInputSequence.sceneChangeEvent(updateChange); + inputSequence.setButtonInterval(150); + backendInputSequence.syncFromFrontEnd(&inputSequence, false); // THEN QCOMPARE(backendInputSequence.buttonInterval(), 150000000); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendInputSequence.sceneChangeEvent(updateChange); + inputSequence.setEnabled(false); + backendInputSequence.syncFromFrontEnd(&inputSequence, false); // THEN - QCOMPARE(backendInputSequence.isEnabled(), true); + QCOMPARE(backendInputSequence.isEnabled(), false); // WHEN Qt3DInput::QActionInput input; const Qt3DCore::QNodeId inputId = input.id(); - const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &input); - nodeAddedChange->setPropertyName("sequence"); - backendInputSequence.sceneChangeEvent(nodeAddedChange); + inputSequence.addSequence(&input); + backendInputSequence.syncFromFrontEnd(&inputSequence, false); // THEN QCOMPARE(backendInputSequence.sequences().size(), 1); QCOMPARE(backendInputSequence.sequences().first(), inputId); // WHEN - const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &input); - nodeRemovedChange->setPropertyName("sequence"); - backendInputSequence.sceneChangeEvent(nodeRemovedChange); + inputSequence.removeSequence(&input); + backendInputSequence.syncFromFrontEnd(&inputSequence, false); // THEN QCOMPARE(backendInputSequence.sequences().size(), 0); @@ -168,19 +159,19 @@ private Q_SLOTS: firstInput->setButtons(QVector<int>() << Qt::Key_Q << Qt::Key_A); firstInput->setSourceDevice(device); auto backendFirstInput = handler.actionInputManager()->getOrCreateResource(firstInput->id()); - simulateInitialization(firstInput, backendFirstInput); + simulateInitializationSync(firstInput, backendFirstInput); auto secondInput = new Qt3DInput::QActionInput; secondInput->setButtons(QVector<int>() << Qt::Key_S << Qt::Key_W); secondInput->setSourceDevice(device); auto backendSecondInput = handler.actionInputManager()->getOrCreateResource(secondInput->id()); - simulateInitialization(secondInput, backendSecondInput); + simulateInitializationSync(secondInput, backendSecondInput); auto thirdInput = new Qt3DInput::QActionInput; thirdInput->setButtons(QVector<int>() << Qt::Key_D << Qt::Key_E); thirdInput->setSourceDevice(device); auto backendThirdInput = handler.actionInputManager()->getOrCreateResource(thirdInput->id()); - simulateInitialization(thirdInput, backendThirdInput); + simulateInitializationSync(thirdInput, backendThirdInput); Qt3DInput::Input::InputSequence backendInputSequence; Qt3DInput::QInputSequence inputSequence; @@ -190,7 +181,7 @@ private Q_SLOTS: inputSequence.addSequence(firstInput); inputSequence.addSequence(secondInput); inputSequence.addSequence(thirdInput); - simulateInitialization(&inputSequence, &backendInputSequence); + simulateInitializationSync(&inputSequence, &backendInputSequence); // WHEN deviceBackend->setButtonPressed(Qt::Key_Up, true); @@ -294,19 +285,19 @@ private Q_SLOTS: firstInput->setButtons(QVector<int>() << Qt::Key_Q << Qt::Key_A); firstInput->setSourceDevice(device); auto backendFirstInput = handler.actionInputManager()->getOrCreateResource(firstInput->id()); - simulateInitialization(firstInput, backendFirstInput); + simulateInitializationSync(firstInput, backendFirstInput); auto secondInput = new Qt3DInput::QActionInput; secondInput->setButtons(QVector<int>() << Qt::Key_S << Qt::Key_W); secondInput->setSourceDevice(device); auto backendSecondInput = handler.actionInputManager()->getOrCreateResource(secondInput->id()); - simulateInitialization(secondInput, backendSecondInput); + simulateInitializationSync(secondInput, backendSecondInput); auto thirdInput = new Qt3DInput::QActionInput; thirdInput->setButtons(QVector<int>() << Qt::Key_D << Qt::Key_E); thirdInput->setSourceDevice(device); auto backendThirdInput = handler.actionInputManager()->getOrCreateResource(thirdInput->id()); - simulateInitialization(thirdInput, backendThirdInput); + simulateInitializationSync(thirdInput, backendThirdInput); Qt3DInput::Input::InputSequence backendInputSequence; Qt3DInput::QInputSequence inputSequence; @@ -316,7 +307,7 @@ private Q_SLOTS: inputSequence.addSequence(firstInput); inputSequence.addSequence(secondInput); inputSequence.addSequence(thirdInput); - simulateInitialization(&inputSequence, &backendInputSequence); + simulateInitializationSync(&inputSequence, &backendInputSequence); // WHEN deviceBackend->setButtonPressed(Qt::Key_Q, true); @@ -352,19 +343,19 @@ private Q_SLOTS: firstInput->setButtons(QVector<int>() << Qt::Key_Q << Qt::Key_A); firstInput->setSourceDevice(device); auto backendFirstInput = handler.actionInputManager()->getOrCreateResource(firstInput->id()); - simulateInitialization(firstInput, backendFirstInput); + simulateInitializationSync(firstInput, backendFirstInput); auto secondInput = new Qt3DInput::QActionInput; secondInput->setButtons(QVector<int>() << Qt::Key_S << Qt::Key_W); secondInput->setSourceDevice(device); auto backendSecondInput = handler.actionInputManager()->getOrCreateResource(secondInput->id()); - simulateInitialization(secondInput, backendSecondInput); + simulateInitializationSync(secondInput, backendSecondInput); auto thirdInput = new Qt3DInput::QActionInput; thirdInput->setButtons(QVector<int>() << Qt::Key_D << Qt::Key_E); thirdInput->setSourceDevice(device); auto backendThirdInput = handler.actionInputManager()->getOrCreateResource(thirdInput->id()); - simulateInitialization(thirdInput, backendThirdInput); + simulateInitializationSync(thirdInput, backendThirdInput); Qt3DInput::Input::InputSequence backendInputSequence; Qt3DInput::QInputSequence inputSequence; @@ -374,7 +365,7 @@ private Q_SLOTS: inputSequence.addSequence(firstInput); inputSequence.addSequence(secondInput); inputSequence.addSequence(thirdInput); - simulateInitialization(&inputSequence, &backendInputSequence); + simulateInitializationSync(&inputSequence, &backendInputSequence); // WHEN deviceBackend->setButtonPressed(Qt::Key_Q, true); @@ -410,13 +401,13 @@ private Q_SLOTS: firstInput->setButtons(QVector<int>() << Qt::Key_Q); firstInput->setSourceDevice(device); auto backendFirstInput = handler.actionInputManager()->getOrCreateResource(firstInput->id()); - simulateInitialization(firstInput, backendFirstInput); + simulateInitializationSync(firstInput, backendFirstInput); auto secondInput = new Qt3DInput::QActionInput; secondInput->setButtons(QVector<int>() << Qt::Key_S); secondInput->setSourceDevice(device); auto backendSecondInput = handler.actionInputManager()->getOrCreateResource(secondInput->id()); - simulateInitialization(secondInput, backendSecondInput); + simulateInitializationSync(secondInput, backendSecondInput); Qt3DInput::Input::InputSequence backendInputSequence; Qt3DInput::QInputSequence inputSequence; @@ -425,7 +416,7 @@ private Q_SLOTS: inputSequence.setTimeout(450); inputSequence.addSequence(firstInput); inputSequence.addSequence(secondInput); - simulateInitialization(&inputSequence, &backendInputSequence); + simulateInitializationSync(&inputSequence, &backendInputSequence); // WHEN deviceBackend->setButtonPressed(Qt::Key_Q, true); diff --git a/tests/auto/input/keyboardhandler/tst_keyboardhandler.cpp b/tests/auto/input/keyboardhandler/tst_keyboardhandler.cpp index 3681f3554..b0280df05 100644 --- a/tests/auto/input/keyboardhandler/tst_keyboardhandler.cpp +++ b/tests/auto/input/keyboardhandler/tst_keyboardhandler.cpp @@ -31,7 +31,6 @@ #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DInput/private/inputhandler_p.h> #include <Qt3DInput/private/inputmanagers_p.h> @@ -54,7 +53,7 @@ private Q_SLOTS: auto keyboardDevice = new Qt3DInput::QKeyboardDevice; auto backendKeyboardDevice = inputHandler.keyboardDeviceManager()->getOrCreateResource(keyboardDevice->id()); backendKeyboardDevice->setInputHandler(&inputHandler); - simulateInitialization(keyboardDevice, backendKeyboardDevice); + simulateInitializationSync(keyboardDevice, backendKeyboardDevice); Qt3DInput::QKeyboardHandler keyboardHandler; auto backendKeyboardHandler = inputHandler.keyboardInputManager()->getOrCreateResource(keyboardHandler.id()); @@ -64,7 +63,7 @@ private Q_SLOTS: keyboardHandler.setSourceDevice(keyboardDevice); // WHEN - simulateInitialization(&keyboardHandler, backendKeyboardHandler); + simulateInitializationSync(&keyboardHandler, backendKeyboardHandler); // THEN QCOMPARE(backendKeyboardHandler->peerId(), keyboardHandler.id()); @@ -90,50 +89,45 @@ private Q_SLOTS: // GIVEN Qt3DInput::Input::InputHandler inputHandler; + Qt3DInput::QKeyboardHandler keyboardHandler; + keyboardHandler.setEnabled(false); + Qt3DInput::Input::KeyboardHandler backendKeyboardHandler; + backendKeyboardHandler.setInputHandler(&inputHandler); + Qt3DInput::QKeyboardDevice device; Qt3DInput::Input::KeyboardDevice *backendKeyboardDevice = inputHandler.keyboardDeviceManager()->getOrCreateResource(device.id()); backendKeyboardDevice->setInputHandler(&inputHandler); - Qt3DInput::Input::KeyboardHandler *backendKeyboardHandler - = inputHandler.keyboardInputManager()->getOrCreateResource(Qt3DCore::QNodeId::createId()); - backendKeyboardHandler->setInputHandler(&inputHandler); + simulateInitializationSync(&keyboardHandler, &backendKeyboardHandler); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setPropertyName("sourceDevice"); - updateChange->setValue(QVariant::fromValue(device.id())); - backendKeyboardHandler->sceneChangeEvent(updateChange); + keyboardHandler.setSourceDevice(&device); + backendKeyboardHandler.syncFromFrontEnd(&keyboardHandler, false); // THEN - QCOMPARE(backendKeyboardHandler->keyboardDevice(), device.id()); + QCOMPARE(backendKeyboardHandler.keyboardDevice(), device.id()); // WHEN (still disabled, nothing should happen) - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("focus"); - updateChange->setValue(true); - backendKeyboardHandler->sceneChangeEvent(updateChange); + keyboardHandler.setFocus(true); + backendKeyboardHandler.syncFromFrontEnd(&keyboardHandler, false); // THEN QVERIFY(backendKeyboardDevice->lastKeyboardInputRequester().isNull()); // WHEN - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendKeyboardHandler->sceneChangeEvent(updateChange); + keyboardHandler.setEnabled(true); + backendKeyboardHandler.syncFromFrontEnd(&keyboardHandler, false); // THEN - QCOMPARE(backendKeyboardHandler->isEnabled(), true); + QCOMPARE(backendKeyboardHandler.isEnabled(), true); // WHEN (now enabled, should request focus) - updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - updateChange->setPropertyName("focus"); - updateChange->setValue(true); - backendKeyboardHandler->sceneChangeEvent(updateChange); + keyboardHandler.setFocus(true); + backendKeyboardHandler.syncFromFrontEnd(&keyboardHandler, false); // THEN - QCOMPARE(backendKeyboardDevice->lastKeyboardInputRequester(), backendKeyboardHandler->peerId()); + QCOMPARE(backendKeyboardDevice->lastKeyboardInputRequester(), backendKeyboardHandler.peerId()); } }; diff --git a/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp b/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp index a436959cc..985ee1955 100644 --- a/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp +++ b/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp @@ -118,13 +118,14 @@ private Q_SLOTS: { backendProxy->setManager(manager); Qt3DCore::QBackendNodeTester backendNodeCreator; - backendNodeCreator.simulateInitialization(&proxy, backendProxy); + backendNodeCreator.simulateInitializationSync(&proxy, backendProxy); Qt3DCore::QBackendNodePrivate::get(backendProxy)->setArbiter(&arbiter); } // THEN QCOMPARE(manager->lookupResource(proxy.id()), backendProxy); QCOMPARE(backendProxy->deviceName(), QStringLiteral("TestProxy")); + QVERIFY(backendProxy->physicalDeviceId().isNull()); const QVector<Qt3DCore::QNodeId> pendingProxies = manager->takePendingProxiesToLoad(); QCOMPARE(pendingProxies.size(), 1); @@ -138,11 +139,7 @@ private Q_SLOTS: job.run(); // THEN -> PhysicalDeviceWrapper::setDevice should have been called - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "device"); - QVERIFY(change->value().value<Qt3DInput::QAbstractPhysicalDevice *>() != nullptr); - QCOMPARE(change->subjectId(), proxy.id()); + QVERIFY(!backendProxy->physicalDeviceId().isNull()); } // WHEN -> invalid name @@ -155,7 +152,7 @@ private Q_SLOTS: { backendProxy->setManager(manager); Qt3DCore::QBackendNodeTester backendNodeCreator; - backendNodeCreator.simulateInitialization(&proxy, backendProxy); + backendNodeCreator.simulateInitializationSync(&proxy, backendProxy); Qt3DCore::QBackendNodePrivate::get(backendProxy)->setArbiter(&arbiter); } diff --git a/tests/auto/input/logicaldevice/tst_logicaldevice.cpp b/tests/auto/input/logicaldevice/tst_logicaldevice.cpp index 58c8c7fcb..94994886a 100644 --- a/tests/auto/input/logicaldevice/tst_logicaldevice.cpp +++ b/tests/auto/input/logicaldevice/tst_logicaldevice.cpp @@ -33,9 +33,6 @@ #include <Qt3DInput/qaxis.h> #include <Qt3DInput/private/qlogicaldevice_p.h> #include <Qt3DInput/private/logicaldevice_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include "qbackendnodetester.h" class tst_LogicalDevice : public Qt3DCore::QBackendNodeTester @@ -59,24 +56,19 @@ private Q_SLOTS: void checkCleanupState() { // GIVEN + Qt3DInput::QLogicalDevice logicalDevice; Qt3DInput::Input::LogicalDevice backendLogicalDevice; + simulateInitializationSync(&logicalDevice, &backendLogicalDevice); // WHEN backendLogicalDevice.setEnabled(true); // WHEN - { - Qt3DInput::QAxis newValue; - const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &newValue); - change->setPropertyName("axis"); - backendLogicalDevice.sceneChangeEvent(change); - } - { - Qt3DInput::QAction newValue; - const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &newValue); - change->setPropertyName("action"); - backendLogicalDevice.sceneChangeEvent(change); - } + Qt3DInput::QAxis newAxisValue; + Qt3DInput::QAction newActionValue; + logicalDevice.addAxis(&newAxisValue); + logicalDevice.addAction(&newActionValue); + backendLogicalDevice.syncFromFrontEnd(&logicalDevice, false); // THEN QCOMPARE(backendLogicalDevice.axes().size(), 1); @@ -104,7 +96,7 @@ private Q_SLOTS: { // WHEN Qt3DInput::Input::LogicalDevice backendLogicalDevice; - simulateInitialization(&logicalDevice, &backendLogicalDevice); + simulateInitializationSync(&logicalDevice, &backendLogicalDevice); // THEN QCOMPARE(backendLogicalDevice.isEnabled(), true); @@ -118,7 +110,7 @@ private Q_SLOTS: // WHEN Qt3DInput::Input::LogicalDevice backendLogicalDevice; logicalDevice.setEnabled(false); - simulateInitialization(&logicalDevice, &backendLogicalDevice); + simulateInitializationSync(&logicalDevice, &backendLogicalDevice); // THEN QCOMPARE(backendLogicalDevice.isEnabled(), false); @@ -128,15 +120,15 @@ private Q_SLOTS: void checkSceneChangeEvents() { // GIVEN + Qt3DInput::QLogicalDevice logicalDevice; Qt3DInput::Input::LogicalDevice backendLogicalDevice; + simulateInitializationSync(&logicalDevice, &backendLogicalDevice); { // WHEN const bool newValue = false; - const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("enabled"); - change->setValue(newValue); - backendLogicalDevice.sceneChangeEvent(change); + logicalDevice.setEnabled(newValue); + backendLogicalDevice.syncFromFrontEnd(&logicalDevice, false); // THEN QCOMPARE(backendLogicalDevice.isEnabled(), newValue); @@ -144,18 +136,16 @@ private Q_SLOTS: { // WHEN Qt3DInput::QAxis newValue; - const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &newValue); - change->setPropertyName("axis"); - backendLogicalDevice.sceneChangeEvent(change); + logicalDevice.addAxis(&newValue); + backendLogicalDevice.syncFromFrontEnd(&logicalDevice, false); // THEN QCOMPARE(backendLogicalDevice.axes().size(), 1); QCOMPARE(backendLogicalDevice.axes().first(), newValue.id()); // WHEN - const auto change2 = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &newValue); - change2->setPropertyName("axis"); - backendLogicalDevice.sceneChangeEvent(change2); + logicalDevice.removeAxis(&newValue); + backendLogicalDevice.syncFromFrontEnd(&logicalDevice, false); // THEN QCOMPARE(backendLogicalDevice.axes().size(), 0); @@ -163,18 +153,16 @@ private Q_SLOTS: { // WHEN Qt3DInput::QAction newValue; - const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &newValue); - change->setPropertyName("action"); - backendLogicalDevice.sceneChangeEvent(change); + logicalDevice.addAction(&newValue); + backendLogicalDevice.syncFromFrontEnd(&logicalDevice, false); // THEN QCOMPARE(backendLogicalDevice.actions().size(), 1); QCOMPARE(backendLogicalDevice.actions().first(), newValue.id()); // WHEN - const auto change2 = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &newValue); - change2->setPropertyName("action"); - backendLogicalDevice.sceneChangeEvent(change2); + logicalDevice.removeAction(&newValue); + backendLogicalDevice.syncFromFrontEnd(&logicalDevice, false); // THEN QCOMPARE(backendLogicalDevice.actions().size(), 0); diff --git a/tests/auto/input/mousedevice/tst_mousedevice.cpp b/tests/auto/input/mousedevice/tst_mousedevice.cpp index 64447d0de..f245e399d 100644 --- a/tests/auto/input/mousedevice/tst_mousedevice.cpp +++ b/tests/auto/input/mousedevice/tst_mousedevice.cpp @@ -31,7 +31,6 @@ #include <Qt3DInput/qmousedevice.h> #include <Qt3DInput/private/qmousedevice_p.h> #include <Qt3DInput/private/mousedevice_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" class tst_MouseDevice : public Qt3DCore::QBackendNodeTester @@ -70,7 +69,7 @@ private Q_SLOTS: { // WHEN Qt3DInput::Input::MouseDevice backendMouseDevice; - simulateInitialization(&mouseDevice, &backendMouseDevice); + simulateInitializationSync(&mouseDevice, &backendMouseDevice); // THEN QCOMPARE(backendMouseDevice.isEnabled(), true); @@ -91,7 +90,7 @@ private Q_SLOTS: // WHEN Qt3DInput::Input::MouseDevice backendMouseDevice; mouseDevice.setEnabled(false); - simulateInitialization(&mouseDevice, &backendMouseDevice); + simulateInitializationSync(&mouseDevice, &backendMouseDevice); // THEN QCOMPARE(backendMouseDevice.peerId(), mouseDevice.id()); @@ -220,15 +219,15 @@ private Q_SLOTS: void checkSceneChangeEvents() { // GIVEN + Qt3DInput::QMouseDevice mouseDevice; Qt3DInput::Input::MouseDevice backendMouseDevice; + simulateInitializationSync(&mouseDevice, &backendMouseDevice); { // WHEN const bool newValue = false; - const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("enabled"); - change->setValue(newValue); - backendMouseDevice.sceneChangeEvent(change); + mouseDevice.setEnabled(newValue); + backendMouseDevice.syncFromFrontEnd(&mouseDevice, false); // THEN QCOMPARE(backendMouseDevice.isEnabled(), newValue); @@ -236,10 +235,8 @@ private Q_SLOTS: { // WHEN const float newValue = 99.0f; - const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("sensitivity"); - change->setValue(QVariant::fromValue(newValue)); - backendMouseDevice.sceneChangeEvent(change); + mouseDevice.setSensitivity(newValue); + backendMouseDevice.syncFromFrontEnd(&mouseDevice, false); // THEN QCOMPARE(backendMouseDevice.sensitivity(), newValue); diff --git a/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp b/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp index d19e69ecc..aaf46a54b 100644 --- a/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp +++ b/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp @@ -69,7 +69,7 @@ private Q_SLOTS: // WHEN Qt3DInput::Input::PhysicalDeviceProxy backendPhysicalDeviceProxy; backendPhysicalDeviceProxy.setManager(&manager); - simulateInitialization(&PhysicalDeviceProxy, &backendPhysicalDeviceProxy); + simulateInitializationSync(&PhysicalDeviceProxy, &backendPhysicalDeviceProxy); // THEN QCOMPARE(backendPhysicalDeviceProxy.isEnabled(), true); @@ -83,7 +83,7 @@ private Q_SLOTS: Qt3DInput::Input::PhysicalDeviceProxy backendPhysicalDeviceProxy; backendPhysicalDeviceProxy.setManager(&manager); PhysicalDeviceProxy.setEnabled(false); - simulateInitialization(&PhysicalDeviceProxy, &backendPhysicalDeviceProxy); + simulateInitializationSync(&PhysicalDeviceProxy, &backendPhysicalDeviceProxy); // THEN QCOMPARE(backendPhysicalDeviceProxy.peerId(), PhysicalDeviceProxy.id()); @@ -100,7 +100,7 @@ private Q_SLOTS: // WHEN backendPhysicalDeviceProxy.setManager(&manager); - simulateInitialization(&deviceProxy, &backendPhysicalDeviceProxy); + simulateInitializationSync(&deviceProxy, &backendPhysicalDeviceProxy); // THEN QCOMPARE(backendPhysicalDeviceProxy.deviceName(), QStringLiteral("TestProxy")); @@ -109,27 +109,6 @@ private Q_SLOTS: QCOMPARE(pendingWrappers.first(), deviceProxy.id()); } - void checkDeviceLoadedNotification() - { - // GIVEN - Qt3DInput::Input::PhysicalDeviceProxy backendPhysicalDeviceProxy; - TestPhysicalDevice physicalDevice; - TestArbiter arbiter; - - // WHEN - Qt3DCore::QBackendNodePrivate::get(&backendPhysicalDeviceProxy)->setArbiter(&arbiter); - - backendPhysicalDeviceProxy.setDevice(&physicalDevice); - - // THEN - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "device"); - QCOMPARE(change->value().value<Qt3DInput::QAbstractPhysicalDevice *>(), &physicalDevice); - QCOMPARE(change->subjectId(), backendPhysicalDeviceProxy.peerId()); - QCOMPARE(backendPhysicalDeviceProxy.physicalDeviceId(), physicalDevice.id()); - } - void checkCleanupState() { // GIVEN @@ -139,7 +118,7 @@ private Q_SLOTS: // WHEN backendPhysicalDeviceProxy.setManager(&manager); - simulateInitialization(&deviceProxy, &backendPhysicalDeviceProxy); + simulateInitializationSync(&deviceProxy, &backendPhysicalDeviceProxy); backendPhysicalDeviceProxy.cleanup(); diff --git a/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp b/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp index d146a80e7..247a881ad 100644 --- a/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp +++ b/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp @@ -36,9 +36,6 @@ #include <Qt3DInput/private/qinputaspect_p.h> #include <Qt3DInput/private/inputmanagers_p.h> #include <Qt3DInput/private/axissetting_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> #include <Qt3DCore/qpropertynoderemovedchange.h> #include "testdevice.h" @@ -143,7 +140,7 @@ private Q_SLOTS: { // WHEN TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode; - simulateInitialization(&physicalDeviceNode, &backendQAbstractPhysicalDeviceBackendNode); + simulateInitializationSync(&physicalDeviceNode, &backendQAbstractPhysicalDeviceBackendNode); // THEN QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.isEnabled(), true); @@ -153,7 +150,7 @@ private Q_SLOTS: // WHEN TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode; physicalDeviceNode.setEnabled(false); - simulateInitialization(&physicalDeviceNode, &backendQAbstractPhysicalDeviceBackendNode); + simulateInitializationSync(&physicalDeviceNode, &backendQAbstractPhysicalDeviceBackendNode); // THEN QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.peerId(), physicalDeviceNode.id()); @@ -164,17 +161,17 @@ private Q_SLOTS: void checkSceneChangeEvents() { // GIVEN + TestDevice physicalDeviceNode; TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode; Qt3DInput::QInputAspect aspect; backendQAbstractPhysicalDeviceBackendNode.setInputAspect(&aspect); + simulateInitializationSync(&physicalDeviceNode, &backendQAbstractPhysicalDeviceBackendNode); { // WHEN const bool newValue = false; - const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("enabled"); - change->setValue(newValue); - backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change); + physicalDeviceNode.setEnabled(newValue); + backendQAbstractPhysicalDeviceBackendNode.syncFromFrontEnd(&physicalDeviceNode, false); // THEN QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.isEnabled(), newValue); @@ -195,47 +192,43 @@ private Q_SLOTS: Qt3DInput::Input::InputHandler *handler = aspectPrivate->m_inputHandler.data(); Qt3DInput::Input::AxisSetting *backendSetting1 = handler->axisSettingManager()->getOrCreateResource(settings1.id()); Qt3DInput::Input::AxisSetting *backendSetting2 = handler->axisSettingManager()->getOrCreateResource(settings2.id()); - simulateInitialization(&settings1, backendSetting1); - simulateInitialization(&settings2, backendSetting2); + simulateInitializationSync(&settings1, backendSetting1); + simulateInitializationSync(&settings2, backendSetting2); } // Adding AxisSettings { // WHEN - auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &settings1); - change->setPropertyName("axisSettings"); - backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change); + physicalDeviceNode.addAxisSetting(&settings1); + backendQAbstractPhysicalDeviceBackendNode.syncFromFrontEnd(&physicalDeviceNode, false); // THEN QCOMPARE(priv->m_axisSettings.size(), 1); // WHEN - change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &settings2); - change->setPropertyName("axisSettings"); - backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change); + physicalDeviceNode.addAxisSetting(&settings2); + backendQAbstractPhysicalDeviceBackendNode.syncFromFrontEnd(&physicalDeviceNode, false); // THEN QCOMPARE(priv->m_axisSettings.size(), 2); } + // Removing AxisSettings { // WHEN - auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &settings1); - change->setPropertyName("axisSettings"); - backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change); + physicalDeviceNode.removeAxisSetting(&settings1); + backendQAbstractPhysicalDeviceBackendNode.syncFromFrontEnd(&physicalDeviceNode, false); // THEN QCOMPARE(priv->m_axisSettings.size(), 1); // WHEN - change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &settings2); - change->setPropertyName("axisSettings"); - backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change); + physicalDeviceNode.removeAxisSetting(&settings2); + backendQAbstractPhysicalDeviceBackendNode.syncFromFrontEnd(&physicalDeviceNode, false); // THEN QCOMPARE(priv->m_axisSettings.size(), 0); } - } } diff --git a/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp b/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp index b4dfef05e..aef76cc0d 100644 --- a/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp +++ b/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp @@ -55,30 +55,6 @@ private Q_SLOTS: QVERIFY(abstractPhysicalDeviceProxy.device() == nullptr); } - - void checkDeviceLoading() - { - // GIVEN - TestProxy abstractPhysicalDeviceProxy; - - // WHEN - TestPhysicalDevice *device = new TestPhysicalDevice(); - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("device"); - change->setValue(QVariant::fromValue(device)); - - abstractPhysicalDeviceProxy.simulateSceneChangeEvent(change); - - // THEN - QCOMPARE(abstractPhysicalDeviceProxy.deviceName(), QLatin1String("TestProxy")); - QCOMPARE(abstractPhysicalDeviceProxy.status(), Qt3DInput::QAbstractPhysicalDeviceProxy::Ready); - QCOMPARE(abstractPhysicalDeviceProxy.axisCount(), device->axisCount()); - QCOMPARE(abstractPhysicalDeviceProxy.buttonCount(), device->buttonCount()); - QCOMPARE(abstractPhysicalDeviceProxy.axisNames(), device->axisNames()); - QCOMPARE(abstractPhysicalDeviceProxy.buttonNames(), device->buttonNames()); - QVERIFY(abstractPhysicalDeviceProxy.device() == device); - } - void checkDeviceBookkeeping() { // GIVEN @@ -86,11 +62,7 @@ private Q_SLOTS: // WHEN TestPhysicalDevice *device = new TestPhysicalDevice(); - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("device"); - change->setValue(QVariant::fromValue(device)); - - abstractPhysicalDeviceProxy->simulateSceneChangeEvent(change); + abstractPhysicalDeviceProxy->setDevice(device); // THEN QVERIFY(abstractPhysicalDeviceProxy->device() == device); diff --git a/tests/auto/input/qaction/tst_qaction.cpp b/tests/auto/input/qaction/tst_qaction.cpp index 4becee318..8d097978f 100644 --- a/tests/auto/input/qaction/tst_qaction.cpp +++ b/tests/auto/input/qaction/tst_qaction.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QtTest/QTest> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> @@ -36,10 +37,6 @@ #include <Qt3DInput/private/qaction_p.h> #include <Qt3DInput/private/qactioninput_p.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" // We need to call QNode::clone which is protected @@ -116,44 +113,24 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - Qt3DCore::QPropertyNodeAddedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>(); - QCOMPARE(change->propertyName(), "input"); - QCOMPARE(change->addedNodeId(), input->id()); - QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), action.data()); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); // WHEN action->removeInput(input); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>(); - QCOMPARE(nodeRemovedChange->propertyName(), "input"); - QCOMPARE(nodeRemovedChange->removedNodeId(), input->id()); - QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), action.data()); arbiter.events.clear(); } - void checkActivePropertyChanged() - { - // GIVEN - QCOMPARE(isActive(), false); - - // Note: simulate backend change to frontend - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("active"); - valueChange->setValue(true); - sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(isActive(), true); - } - void checkActionInputBookkeeping() { // GIVEN diff --git a/tests/auto/input/qaxis/tst_qaxis.cpp b/tests/auto/input/qaxis/tst_qaxis.cpp index 03ddcb76d..36d434c6a 100644 --- a/tests/auto/input/qaxis/tst_qaxis.cpp +++ b/tests/auto/input/qaxis/tst_qaxis.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QtTest/QTest> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> @@ -35,16 +36,9 @@ #include <Qt3DInput/QAnalogAxisInput> #include <Qt3DInput/private/qaxis_p.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" -// We need to call QNode::clone which is protected -// We need to call QAxis::sceneChangeEvent which is protected -// So we sublcass QAxis instead of QObject -class tst_QAxis: public Qt3DInput::QAxis +class tst_QAxis: public QObject { Q_OBJECT public: @@ -131,22 +125,6 @@ private Q_SLOTS: arbiter.events.clear(); } - void checkValuePropertyChanged() - { - // GIVEN - QCOMPARE(value(), 0.0f); - - // Note: simulate backend change to frontend - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("value"); - valueChange->setValue(383.0f); - sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(value(), 383.0f); - } - void checkAxisInputBookkeeping() { // GIVEN diff --git a/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp b/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp index 492573fd8..e4145ab7a 100644 --- a/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp +++ b/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QtTest/QTest> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> @@ -35,10 +36,6 @@ #include <Qt3DInput/qaxisaccumulator.h> #include <Qt3DInput/private/qaxisaccumulator_p.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" class tst_QAxisAccumulator: public Qt3DInput::QAxisAccumulator @@ -158,33 +155,6 @@ private Q_SLOTS: arbiter.dirtyNodes.clear(); } - void checkValuePropertyChanged() - { - // GIVEN - QCOMPARE(value(), 0.0f); - - // Note: simulate backend change to frontend - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("value"); - valueChange->setValue(383.0f); - sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(value(), 383.0f); - QCOMPARE(velocity(), 0.0f); - - // WHEN - valueChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - valueChange->setPropertyName("velocity"); - valueChange->setValue(123.0f); - sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(value(), 383.0f); - QCOMPARE(velocity(), 123.0f); - } - void checkAxisInputBookkeeping() { // GIVEN diff --git a/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp index 924c1f080..e8ab3e172 100644 --- a/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp +++ b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp @@ -27,7 +27,6 @@ ****************************************************************************/ #include <QtTest/QTest> -#include <Qt3DCore/QPropertyUpdatedChange> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> diff --git a/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp b/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp index 426a50237..3f1e7fd09 100644 --- a/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp +++ b/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp @@ -27,7 +27,6 @@ ****************************************************************************/ #include <QtTest/QTest> -#include <Qt3DCore/QPropertyUpdatedChange> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> diff --git a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp index f81fcee41..c7236ac7d 100644 --- a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp +++ b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp @@ -36,10 +36,6 @@ #include <Qt3DInput/QAxis> #include <Qt3DInput/QAction> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" class tst_QLogicalDevice: public QObject @@ -122,56 +118,48 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - Qt3DCore::QPropertyNodeAddedChangePtr nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>(); - QCOMPARE(nodeAddedChange->propertyName(), "action"); - QCOMPARE(nodeAddedChange->addedNodeId(), action->id()); - QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); // WHEN logicalDevice->removeAction(action); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>(); - QCOMPARE(nodeRemovedChange->propertyName(), "action"); - QCOMPARE(nodeRemovedChange->removedNodeId(), action->id()); - QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); // WHEN Qt3DInput::QAxis *axis = new Qt3DInput::QAxis(logicalDevice.data()); QCoreApplication::processEvents(); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); logicalDevice->addAxis(axis); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>(); - QCOMPARE(nodeAddedChange->propertyName(), "axis"); - QCOMPARE(nodeAddedChange->addedNodeId(), axis->id()); - QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); // WHEN logicalDevice->removeAxis(axis); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>(); - QCOMPARE(nodeRemovedChange->propertyName(), "axis"); - QCOMPARE(nodeRemovedChange->removedNodeId(), axis->id()); - QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); } void checkAxisBookkeeping() diff --git a/tests/auto/input/qmousedevice/tst_qmousedevice.cpp b/tests/auto/input/qmousedevice/tst_qmousedevice.cpp index 58d260d16..fd2c8e603 100644 --- a/tests/auto/input/qmousedevice/tst_qmousedevice.cpp +++ b/tests/auto/input/qmousedevice/tst_qmousedevice.cpp @@ -33,7 +33,6 @@ #include <Qt3DInput/private/qmousedevice_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/input/utils/tst_utils.cpp b/tests/auto/input/utils/tst_utils.cpp index d90034a3f..14a289556 100644 --- a/tests/auto/input/utils/tst_utils.cpp +++ b/tests/auto/input/utils/tst_utils.cpp @@ -31,7 +31,6 @@ #include <Qt3DInput/private/utils_p.h> #include <Qt3DInput/private/axis_p.h> #include <Qt3DInput/qanalogaxisinput.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include "testdeviceproxy.h" @@ -94,7 +93,7 @@ private Q_SLOTS: // WHEN -> Create backend AnalogAxisInput Qt3DInput::Input::AnalogAxisInput *backendAxisInput = handler.analogAxisInputManager()->getOrCreateResource(analogAxisInput.id()); - simulateInitialization(&analogAxisInput, backendAxisInput); + simulateInitializationSync(&analogAxisInput, backendAxisInput); // THEN QCOMPARE(backendAxisInput->axis(), analogAxisInput.axis()); @@ -125,7 +124,7 @@ private Q_SLOTS: // WHEN -> Create backend AnalogAxisInput Qt3DInput::Input::AnalogAxisInput *backendAxisInput = handler.analogAxisInputManager()->getOrCreateResource(analogAxisInput.id()); - simulateInitialization(&analogAxisInput, backendAxisInput); + simulateInitializationSync(&analogAxisInput, backendAxisInput); // THEN QCOMPARE(backendAxisInput->axis(), analogAxisInput.axis()); @@ -165,7 +164,7 @@ private Q_SLOTS: // WHEN -> Create backend AnalogAxisInput Qt3DInput::Input::AnalogAxisInput *backendAxisInput = handler.analogAxisInputManager()->getOrCreateResource(analogAxisInput.id()); - simulateInitialization(&analogAxisInput, backendAxisInput); + simulateInitializationSync(&analogAxisInput, backendAxisInput); // THEN QCOMPARE(backendAxisInput->axis(), analogAxisInput.axis()); @@ -196,7 +195,7 @@ private Q_SLOTS: // WHEN -> Create backend AnalogAxisInput Qt3DInput::Input::AnalogAxisInput *backendAxisInput = handler.analogAxisInputManager()->getOrCreateResource(analogAxisInput.id()); - simulateInitialization(&analogAxisInput, backendAxisInput); + simulateInitializationSync(&analogAxisInput, backendAxisInput); // THEN QCOMPARE(backendAxisInput->axis(), analogAxisInput.axis()); diff --git a/tests/auto/render/armature/tst_armature.cpp b/tests/auto/render/armature/tst_armature.cpp index 4f9380a3b..99b9aa7a5 100644 --- a/tests/auto/render/armature/tst_armature.cpp +++ b/tests/auto/render/armature/tst_armature.cpp @@ -32,7 +32,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 <qbackendnodetester.h> #include <testpostmanarbiter.h> diff --git a/tests/auto/render/attribute/tst_attribute.cpp b/tests/auto/render/attribute/tst_attribute.cpp index 12b99b37d..5571ef334 100644 --- a/tests/auto/render/attribute/tst_attribute.cpp +++ b/tests/auto/render/attribute/tst_attribute.cpp @@ -30,7 +30,6 @@ #include <qbackendnodetester.h> #include <Qt3DRender/private/attribute_p.h> #include <Qt3DRender/qbuffer.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "testrenderer.h" class tst_Attribute : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp b/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp index f7a6ce214..ccac64eea 100644 --- a/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp +++ b/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp @@ -31,7 +31,6 @@ #include <Qt3DRender/qblitframebuffer.h> #include <Qt3DRender/private/qblitframebuffer_p.h> #include <Qt3DRender/private/blitframebuffer_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/auto/render/effect/tst_effect.cpp b/tests/auto/render/effect/tst_effect.cpp index cb2ca41e1..369cdf793 100644 --- a/tests/auto/render/effect/tst_effect.cpp +++ b/tests/auto/render/effect/tst_effect.cpp @@ -34,9 +34,6 @@ #include <Qt3DRender/private/qeffect_p.h> #include <Qt3DRender/private/effect_p.h> #include <Qt3DRender/private/shaderparameterpack_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/auto/render/entity/tst_entity.cpp b/tests/auto/render/entity/tst_entity.cpp index 463fbbb79..e3b8e756e 100644 --- a/tests/auto/render/entity/tst_entity.cpp +++ b/tests/auto/render/entity/tst_entity.cpp @@ -28,16 +28,14 @@ #include <QtTest/QtTest> #include <Qt3DRender/private/entity_p.h> +#include <Qt3DRender/private/entity_p_p.h> #include <Qt3DRender/private/nodemanagers_p.h> #include <Qt3DRender/private/managers_p.h> #include <Qt3DRender/private/entityvisitor_p.h> #include <Qt3DRender/private/entityaccumulator_p.h> #include <Qt3DRender/QCameraLens> -#include <Qt3DCore/QPropertyUpdatedChange> #include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QComponentAddedChange> -#include <Qt3DCore/QComponentRemovedChange> #include <Qt3DCore/QTransform> #include <Qt3DRender/QEnvironmentLight> @@ -145,19 +143,18 @@ private slots: QVERIFY(entity.layerIds().isEmpty()); // WHEN - for (QComponent *component : components) { - const auto addChange = QComponentAddedChangePtr::create(&dummyFrontendEntity, component); - entity.sceneChangeEvent(addChange); - } + for (QComponent *component : components) + EntityPrivate::get(&entity)->componentAdded(component); Qt3DCore::QEntity dummyFrontendEntityChild; // Create nodes in the backend manager nodeManagers.renderNodesManager()->getOrCreateResource(dummyFrontendEntity.id()); nodeManagers.renderNodesManager()->getOrCreateResource(dummyFrontendEntityChild.id()); - // Send children added event to entity - const auto addEntityChange = QPropertyNodeAddedChangePtr::create(dummyFrontendEntity.id(), &dummyFrontendEntityChild); - entity.sceneChangeEvent(addEntityChange); +// TODOSYNC clean up +// // Send children added event to entity +// const auto addEntityChange = QPropertyNodeAddedChangePtr::create(dummyFrontendEntity.id(), &dummyFrontendEntityChild); +// entity.sceneChangeEvent(addEntityChange); // THEN QVERIFY(!entity.componentUuid<Transform>().isNull()); @@ -383,8 +380,7 @@ private slots: QVERIFY(method(&entity).isNull()); // WHEN - const auto addChange = QComponentAddedChangePtr::create(&dummyFrontendEntity, component); - entity.sceneChangeEvent(addChange); + EntityPrivate::get(&entity)->componentAdded(component); // THEN QCOMPARE(method(&entity), component->id()); @@ -392,8 +388,7 @@ private slots: // WHEN renderer.resetDirty(); - const auto removeChange = QComponentRemovedChangePtr::create(&dummyFrontendEntity, component); - entity.sceneChangeEvent(removeChange); + EntityPrivate::get(&entity)->componentRemoved(component); // THEN QVERIFY(method(&entity).isNull()); @@ -438,10 +433,8 @@ private slots: QVERIFY(method(&entity).isEmpty()); // WHEN - for (QComponent *component : components) { - const auto addChange = QComponentAddedChangePtr::create(&dummyFrontendEntity, component); - entity.sceneChangeEvent(addChange); - } + for (QComponent *component : components) + EntityPrivate::get(&entity)->componentAdded(component); // THEN QCOMPARE(method(&entity).size(), components.size()); @@ -452,8 +445,7 @@ private slots: // WHEN renderer.resetDirty(); - const auto removeChange = QComponentRemovedChangePtr::create(&dummyFrontendEntity, components.first()); - entity.sceneChangeEvent(removeChange); + EntityPrivate::get(&entity)->componentRemoved(components.first()); // THEN QCOMPARE(method(&entity).size(), components.size() - 1); @@ -470,8 +462,8 @@ private slots: Qt3DCore::QEntity frontendEntityA, frontendEntityB, frontendEntityC; auto backendA = createEntity(renderer, nodeManagers, frontendEntityA); - auto backendB = createEntity(renderer, nodeManagers, frontendEntityB); - auto backendC = createEntity(renderer, nodeManagers, frontendEntityC); + createEntity(renderer, nodeManagers, frontendEntityB); + createEntity(renderer, nodeManagers, frontendEntityC); auto sendParentChange = [&nodeManagers](const Qt3DCore::QEntity &entity) { Entity *backendEntity = nodeManagers.renderNodesManager()->getOrCreateResource(entity.id()); @@ -505,8 +497,8 @@ private slots: frontendEntityC.setEnabled(false); auto backendA = createEntity(renderer, nodeManagers, frontendEntityA); - auto backendB = createEntity(renderer, nodeManagers, frontendEntityB); - auto backendC = createEntity(renderer, nodeManagers, frontendEntityC); + createEntity(renderer, nodeManagers, frontendEntityB); + createEntity(renderer, nodeManagers, frontendEntityC); auto sendParentChange = [&nodeManagers](const Qt3DCore::QEntity &entity) { Entity *backendEntity = nodeManagers.renderNodesManager()->getOrCreateResource(entity.id()); @@ -546,8 +538,8 @@ private slots: frontendEntityC.setEnabled(false); auto backendA = createEntity(renderer, nodeManagers, frontendEntityA); - auto backendB = createEntity(renderer, nodeManagers, frontendEntityB); - auto backendC = createEntity(renderer, nodeManagers, frontendEntityC); + createEntity(renderer, nodeManagers, frontendEntityB); + createEntity(renderer, nodeManagers, frontendEntityC); auto sendParentChange = [&nodeManagers](const Qt3DCore::QEntity &entity) { Entity *backendEntity = nodeManagers.renderNodesManager()->getOrCreateResource(entity.id()); diff --git a/tests/auto/render/filterkey/tst_filterkey.cpp b/tests/auto/render/filterkey/tst_filterkey.cpp index c998cc603..6a08bc539 100644 --- a/tests/auto/render/filterkey/tst_filterkey.cpp +++ b/tests/auto/render/filterkey/tst_filterkey.cpp @@ -31,7 +31,6 @@ #include <Qt3DRender/qfilterkey.h> #include <Qt3DRender/private/qfilterkey_p.h> #include <Qt3DRender/private/filterkey_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp index 4ad1ce6f5..770f7e72d 100644 --- a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp +++ b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp @@ -30,7 +30,6 @@ #include <QtTest/QTest> #include <Qt3DRender/private/managers_p.h> #include <Qt3DRender/private/nodemanagers_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include "testrenderer.h" #include "qbackendnodetester.h" diff --git a/tests/auto/render/geometry/tst_geometry.cpp b/tests/auto/render/geometry/tst_geometry.cpp index 54a28e776..09dbb8eb3 100644 --- a/tests/auto/render/geometry/tst_geometry.cpp +++ b/tests/auto/render/geometry/tst_geometry.cpp @@ -32,8 +32,6 @@ #include <Qt3DRender/qgeometry.h> #include <Qt3DRender/qattribute.h> #include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DCore/private/qbackendnode_p.h> #include "testrenderer.h" #include "testpostmanarbiter.h" diff --git a/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp b/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp index db997a5e5..0f6af16db 100644 --- a/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp +++ b/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp @@ -32,9 +32,6 @@ #include <Qt3DRender/private/geometryrenderermanager_p.h> #include <Qt3DRender/qgeometry.h> #include <Qt3DRender/qgeometryfactory.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include "testrenderer.h" class TestFactory : public Qt3DRender::QGeometryFactory diff --git a/tests/auto/render/joint/tst_joint.cpp b/tests/auto/render/joint/tst_joint.cpp index c08d36725..0388f4a80 100644 --- a/tests/auto/render/joint/tst_joint.cpp +++ b/tests/auto/render/joint/tst_joint.cpp @@ -32,10 +32,6 @@ #include <Qt3DCore/qjoint.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/private/qpropertyupdatedchangebase_p.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <QtGui/qmatrix4x4.h> #include <QtGui/qvector3d.h> #include <qbackendnodetester.h> @@ -153,43 +149,36 @@ private Q_SLOTS: backendJoint.setRenderer(&renderer); backendJoint.setJointManager(nodeManagers.jointManager()); backendJoint.setSkeletonManager(nodeManagers.skeletonManager()); - Qt3DCore::QPropertyUpdatedChangePtr updateChange; + QJoint joint; + simulateInitializationSync(&joint, &backendJoint); // WHEN - updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setPropertyName("enabled"); - updateChange->setValue(true); - backendJoint.sceneChangeEvent(updateChange); + joint.setEnabled(false); + backendJoint.syncFromFrontEnd(&joint, false); // THEN - QCOMPARE(backendJoint.isEnabled(), true); + QCOMPARE(backendJoint.isEnabled(), false); // WHEN const QVector3D newTranslation = QVector3D(1.0f, 2.0f, 3.0f); - updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setPropertyName("translation"); - updateChange->setValue(newTranslation); - backendJoint.sceneChangeEvent(updateChange); + joint.setTranslation(newTranslation); + backendJoint.syncFromFrontEnd(&joint, false); // THEN QCOMPARE(backendJoint.translation(), newTranslation); // WHEN const QQuaternion newRotation = QQuaternion::fromAxisAndAngle(1.0f, 0.0f, 0.0f, 45.0f); - updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setPropertyName("rotation"); - updateChange->setValue(newRotation); - backendJoint.sceneChangeEvent(updateChange); + joint.setRotation(newRotation); + backendJoint.syncFromFrontEnd(&joint, false); // THEN QCOMPARE(backendJoint.rotation(), newRotation); // WHEN const QVector3D newScale = QVector3D(1.5f, 2.5f, 3.5f); - updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setPropertyName("scale"); - updateChange->setValue(newScale); - backendJoint.sceneChangeEvent(updateChange); + joint.setScale(newScale); + backendJoint.syncFromFrontEnd(&joint, false); // THEN QCOMPARE(backendJoint.scale(), newScale); @@ -197,44 +186,34 @@ private Q_SLOTS: // WHEN QMatrix4x4 newInverseBind; newInverseBind.scale(5.4f); - updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - updateChange->setPropertyName("inverseBindMatrix"); - updateChange->setValue(newInverseBind); - backendJoint.sceneChangeEvent(updateChange); + joint.setInverseBindMatrix(newInverseBind); + backendJoint.syncFromFrontEnd(&joint, false); // THEN QCOMPARE(backendJoint.inverseBindMatrix(), newInverseBind); // WHEN QVector<QJoint *> childJoints; - QPropertyNodeAddedChangePtr nodeAddedChange; for (int i = 0; i < 10; ++i) { const auto childJoint = new QJoint(); childJoints.push_back(childJoint); - - nodeAddedChange.reset(new QPropertyNodeAddedChange(QNodeId(), childJoint)); - nodeAddedChange->setPropertyName("childJoint"); - backendJoint.sceneChangeEvent(nodeAddedChange); + joint.addChildJoint(childJoint); } + backendJoint.syncFromFrontEnd(&joint, false); // THEN - for (int i = 0; i < childJoints.size(); ++i) { + for (int i = 0; i < childJoints.size(); ++i) QCOMPARE(backendJoint.childJointIds()[i], childJoints[i]->id()); - } - QPropertyNodeRemovedChangePtr nodeRemovedChange; for (int i = 0; i < 10; ++i) { // WHEN const auto childJoint = childJoints.takeLast(); - - nodeRemovedChange.reset(new QPropertyNodeRemovedChange(QNodeId(), childJoint)); - nodeRemovedChange->setPropertyName("childJoint"); - backendJoint.sceneChangeEvent(nodeAddedChange); + joint.removeChildJoint(childJoint); + backendJoint.syncFromFrontEnd(&joint, false); // THEN - for (int i = 0; i < childJoints.size(); ++i) { + for (int i = 0; i < childJoints.size(); ++i) QCOMPARE(backendJoint.childJointIds()[i], childJoints[i]->id()); - } } } @@ -314,9 +293,8 @@ private Q_SLOTS: backendJoint.syncFromFrontEnd(&joint, false); // THEN - for (int i = 0; i < childJoints.size(); ++i) { - QCOMPARE(backendJoint.childJointIds()[i], childJoints[i]->id()); - } + for (int j = 0; j < childJoints.size(); ++j) + QCOMPARE(backendJoint.childJointIds()[j], childJoints[j]->id()); } } }; diff --git a/tests/auto/render/levelofdetail/tst_levelofdetail.cpp b/tests/auto/render/levelofdetail/tst_levelofdetail.cpp index 2285cc5ff..5005ca2d1 100644 --- a/tests/auto/render/levelofdetail/tst_levelofdetail.cpp +++ b/tests/auto/render/levelofdetail/tst_levelofdetail.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/QLevelOfDetailBoundingSphere> #include <Qt3DRender/private/levelofdetail_p.h> #include <Qt3DRender/private/qlevelofdetail_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qbackendnode_p.h> #include "testpostmanarbiter.h" #include "testrenderer.h" diff --git a/tests/auto/render/loadscenejob/tst_loadscenejob.cpp b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp index 66c9271f7..044c3e0f4 100644 --- a/tests/auto/render/loadscenejob/tst_loadscenejob.cpp +++ b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp @@ -148,27 +148,9 @@ private Q_SLOTS: loadSceneJob.run(); // THEN - QCOMPARE(arbiter.events.count(), 4); - auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None); - - change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Loading); - - change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "scene"); - QVERIFY(change->value().value<Qt3DCore::QEntity *>() != nullptr); - delete change->value().value<Qt3DCore::QEntity *>(); - - change = arbiter.events.at(3).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Ready); + Qt3DRender::Render::LoadSceneJobPrivate *dJob = static_cast<decltype(dJob)>(Qt3DCore::QAspectJobPrivate::get(&loadSceneJob)); + QCOMPARE(dJob->m_status, Qt3DRender::QSceneLoader::Ready); + QVERIFY(dJob->m_sceneSubtree != nullptr); } void checkEmptySource() @@ -192,21 +174,9 @@ private Q_SLOTS: loadSceneJob.run(); // THEN - QCOMPARE(arbiter.events.count(), 3); - auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None); - - change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "scene"); - QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr); - - change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None); + Qt3DRender::Render::LoadSceneJobPrivate *dJob = static_cast<decltype(dJob)>(Qt3DCore::QAspectJobPrivate::get(&loadSceneJob)); + QCOMPARE(dJob->m_status, Qt3DRender::QSceneLoader::None); + QVERIFY(dJob->m_sceneSubtree == nullptr); } void checkRunValidSourceUnsupportedFormat() @@ -233,21 +203,9 @@ private Q_SLOTS: loadSceneJob.run(); // THEN - QCOMPARE(arbiter.events.count(), 3); - auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None); - - change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "scene"); - QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr); - - change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Error); + Qt3DRender::Render::LoadSceneJobPrivate *dJob = static_cast<decltype(dJob)>(Qt3DCore::QAspectJobPrivate::get(&loadSceneJob)); + QCOMPARE(dJob->m_status, Qt3DRender::QSceneLoader::Error); + QVERIFY(dJob->m_sceneSubtree == nullptr); } void checkRunErrorAtLoading() @@ -271,22 +229,10 @@ private Q_SLOTS: loadSceneJob.run(); // THEN - QCOMPARE(arbiter.events.count(), 3); - auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None); - - change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "scene"); - QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr); - delete change->value().value<Qt3DCore::QEntity *>(); - - change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->subjectId(), scene->peerId()); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Error); + // THEN + Qt3DRender::Render::LoadSceneJobPrivate *dJob = static_cast<decltype(dJob)>(Qt3DCore::QAspectJobPrivate::get(&loadSceneJob)); + QCOMPARE(dJob->m_status, Qt3DRender::QSceneLoader::Error); + QVERIFY(dJob->m_sceneSubtree == nullptr); } }; diff --git a/tests/auto/render/material/tst_material.cpp b/tests/auto/render/material/tst_material.cpp index e47eaea34..4e66f7e30 100644 --- a/tests/auto/render/material/tst_material.cpp +++ b/tests/auto/render/material/tst_material.cpp @@ -33,9 +33,6 @@ #include <Qt3DRender/QMaterial> #include <Qt3DRender/QParameter> #include <Qt3DRender/QEffect> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> #include "testrenderer.h" using namespace Qt3DCore; diff --git a/tests/auto/render/memorybarrier/tst_memorybarrier.cpp b/tests/auto/render/memorybarrier/tst_memorybarrier.cpp index 708659e4e..0b1c581e4 100644 --- a/tests/auto/render/memorybarrier/tst_memorybarrier.cpp +++ b/tests/auto/render/memorybarrier/tst_memorybarrier.cpp @@ -31,7 +31,6 @@ #include <Qt3DRender/qmemorybarrier.h> #include <Qt3DRender/private/qmemorybarrier_p.h> #include <Qt3DRender/private/memorybarrier_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/auto/render/parameter/tst_parameter.cpp b/tests/auto/render/parameter/tst_parameter.cpp index 44e7b7020..625256fc4 100644 --- a/tests/auto/render/parameter/tst_parameter.cpp +++ b/tests/auto/render/parameter/tst_parameter.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/parameter_p.h> #include <Qt3DRender/private/uniform_p.h> #include <Qt3DRender/private/stringtoint_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" @@ -53,6 +52,7 @@ private Q_SLOTS: QCOMPARE(backendParameter.name(), QString()); QCOMPARE(backendParameter.uniformValue(), Qt3DRender::Render::UniformValue()); QCOMPARE(backendParameter.nameId(), -1); + QCOMPARE(backendParameter.backendValue(), QVariant()); } void checkCleanupState() @@ -74,6 +74,7 @@ private Q_SLOTS: QCOMPARE(backendParameter.name(), QString()); QCOMPARE(backendParameter.uniformValue(), Qt3DRender::Render::UniformValue()); QCOMPARE(backendParameter.nameId(), -1); + QCOMPARE(backendParameter.backendValue(), QVariant()); } void checkInitializeFromPeer() @@ -156,6 +157,7 @@ private Q_SLOTS: // THEN QCOMPARE(backendParameter.uniformValue(), newValue); + QCOMPARE(backendParameter.backendValue(), value); QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::ParameterDirty); renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty); } diff --git a/tests/auto/render/proximityfilter/tst_proximityfilter.cpp b/tests/auto/render/proximityfilter/tst_proximityfilter.cpp index 88059e31a..52537d457 100644 --- a/tests/auto/render/proximityfilter/tst_proximityfilter.cpp +++ b/tests/auto/render/proximityfilter/tst_proximityfilter.cpp @@ -31,7 +31,6 @@ #include <Qt3DRender/qproximityfilter.h> #include <Qt3DRender/private/qproximityfilter_p.h> #include <Qt3DRender/private/proximityfilter_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" @@ -103,7 +102,7 @@ private Q_SLOTS: // WHEN const bool newValue = false; proximityFilter.setEnabled(newValue); - backendProximityFilter.syncFromFrontEnd(&proximityFilter, &backendProximityFilter); + backendProximityFilter.syncFromFrontEnd(&proximityFilter, false); // THEN QCOMPARE(backendProximityFilter.isEnabled(), newValue); @@ -114,7 +113,7 @@ private Q_SLOTS: // WHEN const float newValue = 383.0f; proximityFilter.setDistanceThreshold(newValue); - backendProximityFilter.syncFromFrontEnd(&proximityFilter, &backendProximityFilter); + backendProximityFilter.syncFromFrontEnd(&proximityFilter, false); // THEN @@ -126,7 +125,7 @@ private Q_SLOTS: // WHEN Qt3DCore::QEntity e; proximityFilter.setEntity(&e); - backendProximityFilter.syncFromFrontEnd(&proximityFilter, &backendProximityFilter); + backendProximityFilter.syncFromFrontEnd(&proximityFilter, false); // THEN QCOMPARE(backendProximityFilter.entityId(), e.id()); diff --git a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp index 6db8d20f5..a1973176e 100644 --- a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp +++ b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp @@ -829,13 +829,11 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - auto change = arbiter.events.last().staticCast<Qt3DCore::QPropertyNodeAddedChange>(); - QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(change->propertyName(), "textureImage"); - QCOMPARE(change->addedNodeId(), image.id()); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); } } @@ -854,13 +852,11 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 1); - auto change = arbiter.events.last().staticCast<Qt3DCore::QPropertyNodeRemovedChange>(); - QCOMPARE(change->type(), Qt3DCore::PropertyValueRemoved); - QCOMPARE(change->propertyName(), "textureImage"); - QCOMPARE(change->removedNodeId(), image.id()); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); } } diff --git a/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp b/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp index a5e31b949..6bd742dad 100644 --- a/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp +++ b/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qabstracttextureimage_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qcamera/tst_qcamera.cpp b/tests/auto/render/qcamera/tst_qcamera.cpp index 229dff565..0dcbce63f 100644 --- a/tests/auto/render/qcamera/tst_qcamera.cpp +++ b/tests/auto/render/qcamera/tst_qcamera.cpp @@ -36,7 +36,6 @@ #include <Qt3DCore/QEntity> #include <Qt3DCore/private/qaspectjobmanager_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qtransform.h> diff --git a/tests/auto/render/qcameralens/tst_qcameralens.cpp b/tests/auto/render/qcameralens/tst_qcameralens.cpp index c4f684d5f..131c3a9d5 100644 --- a/tests/auto/render/qcameralens/tst_qcameralens.cpp +++ b/tests/auto/render/qcameralens/tst_qcameralens.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qcameralens_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp b/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp index 4494e773b..505229d5c 100644 --- a/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp +++ b/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qcomputecommand_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp b/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp index 7d1a36f11..c4bed3a83 100644 --- a/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp +++ b/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qdispatchcompute_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qeffect/tst_qeffect.cpp b/tests/auto/render/qeffect/tst_qeffect.cpp index 955b58a1e..cc4889b8f 100644 --- a/tests/auto/render/qeffect/tst_qeffect.cpp +++ b/tests/auto/render/qeffect/tst_qeffect.cpp @@ -34,9 +34,6 @@ #include <Qt3DRender/private/qeffect_p.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" diff --git a/tests/auto/render/qfilterkey/tst_qfilterkey.cpp b/tests/auto/render/qfilterkey/tst_qfilterkey.cpp index 33691690e..f4c31c89e 100644 --- a/tests/auto/render/qfilterkey/tst_qfilterkey.cpp +++ b/tests/auto/render/qfilterkey/tst_qfilterkey.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qfilterkey_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qgeometry/tst_qgeometry.cpp b/tests/auto/render/qgeometry/tst_qgeometry.cpp index b82c53de1..017314ecf 100644 --- a/tests/auto/render/qgeometry/tst_qgeometry.cpp +++ b/tests/auto/render/qgeometry/tst_qgeometry.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QtTest/QTest> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> @@ -36,9 +37,6 @@ #include <Qt3DRender/qattribute.h> #include <Qt3DRender/qbuffer.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> #include <QSignalSpy> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp index b03d48663..28574d3c5 100644 --- a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp +++ b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp @@ -38,10 +38,6 @@ #include <Qt3DRender/qbuffer.h> #include <Qt3DRender/private/qgeometryrenderer_p.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" class TestFactory : public Qt3DRender::QGeometryFactory diff --git a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp index 4bc766b58..648a1d104 100644 --- a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp +++ b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp @@ -30,8 +30,6 @@ #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DRender/qlayer.h> #include <Qt3DRender/qlayerfilter.h> diff --git a/tests/auto/render/qmaterial/tst_qmaterial.cpp b/tests/auto/render/qmaterial/tst_qmaterial.cpp index 501d50556..994b11d43 100644 --- a/tests/auto/render/qmaterial/tst_qmaterial.cpp +++ b/tests/auto/render/qmaterial/tst_qmaterial.cpp @@ -27,9 +27,6 @@ ****************************************************************************/ #include <QtTest/QTest> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DRender/private/qrenderstate_p.h> diff --git a/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp b/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp index 3be43f677..41fdd8428 100644 --- a/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp +++ b/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qmemorybarrier_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qmesh/tst_qmesh.cpp b/tests/auto/render/qmesh/tst_qmesh.cpp index 49679e29e..0df96dd24 100644 --- a/tests/auto/render/qmesh/tst_qmesh.cpp +++ b/tests/auto/render/qmesh/tst_qmesh.cpp @@ -240,28 +240,6 @@ private Q_SLOTS: } - void checkStatusUpdate() - { - // GIVEN - qRegisterMetaType<Qt3DRender::QMesh::Status>("Status"); - MyQMesh mesh; - QSignalSpy spy(&mesh, SIGNAL(statusChanged(Status))); - - // THEN - QCOMPARE(mesh.status(), Qt3DRender::QMesh::None); - - // WHEN - const Qt3DRender::QMesh::Status newStatus = Qt3DRender::QMesh::Error; - Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(mesh.id())); - e->setPropertyName("status"); - e->setValue(QVariant::fromValue(newStatus)); - mesh.sceneChangeEvent(e); - - // THEN - QCOMPARE(mesh.status(), newStatus); - QCOMPARE(spy.count(), 1); - } - void checkGeometryFactoryIsAccessibleEvenWithNoScene() // QTBUG-65506 { // GIVEN diff --git a/tests/auto/render/qparameter/tst_qparameter.cpp b/tests/auto/render/qparameter/tst_qparameter.cpp index 77f9daae8..3df09cff4 100644 --- a/tests/auto/render/qparameter/tst_qparameter.cpp +++ b/tests/auto/render/qparameter/tst_qparameter.cpp @@ -31,7 +31,6 @@ #include <Qt3DRender/private/qparameter_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qentity.h> diff --git a/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp b/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp index aa6be3143..10a532454 100644 --- a/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp +++ b/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp @@ -31,7 +31,6 @@ #include <Qt3DRender/private/qproximityfilter_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qentity.h> diff --git a/tests/auto/render/qraycaster/tst_qraycaster.cpp b/tests/auto/render/qraycaster/tst_qraycaster.cpp index c7f819a34..720c372de 100644 --- a/tests/auto/render/qraycaster/tst_qraycaster.cpp +++ b/tests/auto/render/qraycaster/tst_qraycaster.cpp @@ -30,6 +30,7 @@ #include <QtTest/QSignalSpy> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qpropertynodeaddedchange.h> #include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DRender/QRayCaster> diff --git a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp index b9cb2230f..9ed7651fc 100644 --- a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp +++ b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp @@ -29,6 +29,7 @@ #include <QtTest/QTest> #include <QtTest/QSignalSpy> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DRender/QRenderCapture> diff --git a/tests/auto/render/qrenderpass/tst_qrenderpass.cpp b/tests/auto/render/qrenderpass/tst_qrenderpass.cpp index ce9c6581b..81f949064 100644 --- a/tests/auto/render/qrenderpass/tst_qrenderpass.cpp +++ b/tests/auto/render/qrenderpass/tst_qrenderpass.cpp @@ -36,7 +36,6 @@ #include <Qt3DRender/private/qrenderpass_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qpropertynodeaddedchange.h> #include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> diff --git a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp index f08846ba3..d12f04e33 100644 --- a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp +++ b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp @@ -37,10 +37,6 @@ #include <Qt3DRender/qparameter.h> #include <Qt3DRender/qfilterkey.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" class tst_QRenderPassFilter: public QObject diff --git a/tests/auto/render/qrendersettings/tst_qrendersettings.cpp b/tests/auto/render/qrendersettings/tst_qrendersettings.cpp index 224996579..b58ab0947 100644 --- a/tests/auto/render/qrendersettings/tst_qrendersettings.cpp +++ b/tests/auto/render/qrendersettings/tst_qrendersettings.cpp @@ -33,7 +33,6 @@ #include <Qt3DRender/private/qrendersettings_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp index 9eb97ce93..39f0c3c72 100644 --- a/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp +++ b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp @@ -37,10 +37,6 @@ #include <Qt3DRender/qrenderstate.h> #include <Qt3DRender/private/qrenderstateset_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> - #include "testpostmanarbiter.h" class MyStateSet; diff --git a/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp b/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp index 1004921d8..a30617781 100644 --- a/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp +++ b/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp @@ -33,7 +33,6 @@ #include <Qt3DRender/qrendersurfaceselector.h> #include <Qt3DRender/private/qrendersurfaceselector_p.h> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qrendertarget/tst_qrendertarget.cpp b/tests/auto/render/qrendertarget/tst_qrendertarget.cpp index ffb17faea..ad9d5f329 100644 --- a/tests/auto/render/qrendertarget/tst_qrendertarget.cpp +++ b/tests/auto/render/qrendertarget/tst_qrendertarget.cpp @@ -32,8 +32,6 @@ #include <Qt3DRender/private/qrendertarget_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp b/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp index d501bc4e5..55733f0f3 100644 --- a/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp +++ b/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp @@ -34,7 +34,6 @@ #include <Qt3DRender/qabstracttexture.h> #include <Qt3DRender/qtexture.h> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qscene2d/tst_qscene2d.cpp b/tests/auto/render/qscene2d/tst_qscene2d.cpp index 5ea2dd110..583da6eaf 100644 --- a/tests/auto/render/qscene2d/tst_qscene2d.cpp +++ b/tests/auto/render/qscene2d/tst_qscene2d.cpp @@ -32,7 +32,6 @@ #include <private/qscene2d_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qsceneloader/tst_qsceneloader.cpp b/tests/auto/render/qsceneloader/tst_qsceneloader.cpp index 381960c42..79ca6a291 100644 --- a/tests/auto/render/qsceneloader/tst_qsceneloader.cpp +++ b/tests/auto/render/qsceneloader/tst_qsceneloader.cpp @@ -31,7 +31,6 @@ #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> -#include <Qt3DCore/QPropertyUpdatedChange> #include <Qt3DCore/qtransform.h> #include <Qt3DRender/qsceneloader.h> @@ -137,59 +136,6 @@ private Q_SLOTS: arbiter.dirtyNodes.clear(); } - // DEPRECATED -// void checkStatusPropertyUpdate() -// { -// // GIVEN -// qRegisterMetaType<Qt3DRender::QSceneLoader::Status>("Status"); -// TestArbiter arbiter; -// QScopedPointer<Qt3DRender::QSceneLoader> sceneLoader(new Qt3DRender::QSceneLoader()); -// arbiter.setArbiterOnNode(sceneLoader.data()); -// QSignalSpy spy(sceneLoader.data(), SIGNAL(statusChanged(Status))); - - -// // WHEN -// const Qt3DRender::QSceneLoader::Status newStatus = Qt3DRender::QSceneLoader::Ready; -// sceneLoader->setStatus(newStatus); - -// // THEN -// QVERIFY(arbiter.events.empty()); -// QCOMPARE(spy.count(), 1); - -// spy.clear(); -// } - - void checkPropertyChanges() - { - // GIVEN - Qt3DCore::QScene scene; - Qt3DCore::QEntity rootEntity; - QScopedPointer<Qt3DRender::QSceneLoader> sceneLoader(new Qt3DRender::QSceneLoader()); - Qt3DCore::QNodePrivate::get(&rootEntity)->setScene(&scene); - Qt3DCore::QNodePrivate::get(sceneLoader.data())->setScene(&scene); - rootEntity.addComponent(sceneLoader.data()); - - // WHEN - Qt3DCore::QEntity backendCreatedSubtree; - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("scene"); - valueChange->setValue(QVariant::fromValue(&backendCreatedSubtree)); - sceneLoader->sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(static_cast<Qt3DRender::QSceneLoaderPrivate *>(Qt3DCore::QNodePrivate::get(sceneLoader.data()))->m_subTreeRoot, &backendCreatedSubtree); - - // WHEN - const Qt3DRender::QSceneLoader::Status newStatus = Qt3DRender::QSceneLoader::Ready; - valueChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId()); - valueChange->setPropertyName("status"); - valueChange->setValue(QVariant::fromValue(newStatus)); - sceneLoader->sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(sceneLoader->status(), newStatus); - } - void checkEntities() { // GIVEN diff --git a/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp b/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp index 60f386dd9..2fe515436 100644 --- a/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp +++ b/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp @@ -30,8 +30,6 @@ #include <QtTest/QSignalSpy> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DRender/QScreenRayCaster> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qshaderimage/tst_qshaderimage.cpp b/tests/auto/render/qshaderimage/tst_qshaderimage.cpp index 67c9ca39b..436d81192 100644 --- a/tests/auto/render/qshaderimage/tst_qshaderimage.cpp +++ b/tests/auto/render/qshaderimage/tst_qshaderimage.cpp @@ -43,7 +43,6 @@ #include <Qt3DRender/private/qshaderimage_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp b/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp index 8402f86bd..4011eeea6 100644 --- a/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp +++ b/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qtexture_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qtechnique/tst_qtechnique.cpp b/tests/auto/render/qtechnique/tst_qtechnique.cpp index 1e7e4b440..40d763ad4 100644 --- a/tests/auto/render/qtechnique/tst_qtechnique.cpp +++ b/tests/auto/render/qtechnique/tst_qtechnique.cpp @@ -37,9 +37,6 @@ #include <Qt3DRender/private/qtechnique_p.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" diff --git a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp index 648fbd5ce..37f0ba9a7 100644 --- a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp +++ b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp @@ -37,10 +37,6 @@ #include <Qt3DRender/qparameter.h> #include <Qt3DRender/qfilterkey.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include "testpostmanarbiter.h" class tst_QTechniqueFilter: public QObject diff --git a/tests/auto/render/qtextureimage/tst_qtextureimage.cpp b/tests/auto/render/qtextureimage/tst_qtextureimage.cpp index 8ea656c28..4996c877d 100644 --- a/tests/auto/render/qtextureimage/tst_qtextureimage.cpp +++ b/tests/auto/render/qtextureimage/tst_qtextureimage.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qtextureimage_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qtextureloader/tst_qtextureloader.cpp b/tests/auto/render/qtextureloader/tst_qtextureloader.cpp index eebbf5d41..dd92894da 100644 --- a/tests/auto/render/qtextureloader/tst_qtextureloader.cpp +++ b/tests/auto/render/qtextureloader/tst_qtextureloader.cpp @@ -32,7 +32,6 @@ #include <Qt3DRender/private/qtexture_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/qwaitfence/tst_qwaitfence.cpp b/tests/auto/render/qwaitfence/tst_qwaitfence.cpp index db0618074..801abfcc6 100644 --- a/tests/auto/render/qwaitfence/tst_qwaitfence.cpp +++ b/tests/auto/render/qwaitfence/tst_qwaitfence.cpp @@ -43,7 +43,6 @@ #include <Qt3DRender/private/qwaitfence_p.h> #include <QObject> #include <QSignalSpy> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/qnodecreatedchange.h> #include "testpostmanarbiter.h" diff --git a/tests/auto/render/raycaster/tst_raycaster.cpp b/tests/auto/render/raycaster/tst_raycaster.cpp index 357517f0d..72ef396d7 100644 --- a/tests/auto/render/raycaster/tst_raycaster.cpp +++ b/tests/auto/render/raycaster/tst_raycaster.cpp @@ -106,26 +106,6 @@ private Q_SLOTS: QVERIFY(renderer.dirtyBits() != 0); } } - - void checkBackendPropertyNotifications() - { - // GIVEN - TestArbiter arbiter; - Qt3DRender::Render::RayCaster rayCaster; - Qt3DCore::QBackendNodePrivate::get(&rayCaster)->setArbiter(&arbiter); - Qt3DRender::QAbstractRayCaster::Hits hits; - - // WHEN - rayCaster.dispatchHits(hits); - - // THEN - QCOMPARE(arbiter.events.count(), 2); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "hits"); - QVERIFY(!rayCaster.isEnabled()); - - arbiter.events.clear(); - } }; diff --git a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp index e45ec704e..1ff899936 100644 --- a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp +++ b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp @@ -35,6 +35,9 @@ #include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/private/qaspectjobmanager_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> +#include <Qt3DCore/private/qaspectmanager_p.h> +#include <Qt3DCore/private/qscene_p.h> +#include <Qt3DCore/private/qaspectengine_p.h> #include <QtQuick/qquickwindow.h> #include <Qt3DRender/QCamera> @@ -111,10 +114,18 @@ public: : Qt3DRender::QRenderAspect(Qt3DRender::QRenderAspect::Synchronous) , m_sceneRoot(nullptr) { - QRenderAspect::onRegistered(); - + m_engine = new Qt3DCore::QAspectEngine(this); + m_engine->registerAspect(this); + Q_ASSERT(d_func()->m_aspectManager); + + // do what QAspectEngine::setRootEntity does since we don't want to enter the simulation loop + Qt3DCore::QEntityPtr proot(qobject_cast<Qt3DCore::QEntity *>(root), [](Qt3DCore::QEntity *) { }); + Qt3DCore::QAspectEnginePrivate *aed = Qt3DCore::QAspectEnginePrivate::get(m_engine); + aed->m_root = proot; + aed->initialize(); + aed->initNodeTree(root); const QVector<Qt3DCore::QNode *> nodes = getNodesForCreation(root); - d_func()->setRootAndCreateNodes(qobject_cast<Qt3DCore::QEntity *>(root), nodeTreeChangesForNodes(nodes)); + aed->m_aspectManager->setRootEntity(proot.data(), nodes); Render::Entity *rootEntity = nodeManagers()->lookupResource<Render::Entity, Render::EntityManager>(rootEntityId()); Q_ASSERT(rootEntity); @@ -123,7 +134,17 @@ public: ~TestAspect() { - QRenderAspect::onUnregistered(); + using namespace Qt3DCore; + QNodeVisitor visitor; + visitor.traverse(m_engine->rootEntity().data(), [](QNode *node) { + QNodePrivate *d = QNodePrivate::get(node); + d->m_scene = nullptr; + d->m_changeArbiter = nullptr; + }); + + m_engine->unregisterAspect(this); + delete m_engine; + m_engine = nullptr; } void onRegistered() { QRenderAspect::onRegistered(); } @@ -133,8 +154,10 @@ public: Qt3DRender::Render::FrameGraphNode *frameGraphRoot() const { return d_func()->m_renderer->frameGraphRoot(); } Qt3DRender::Render::RenderSettings *renderSettings() const { return d_func()->m_renderer->settings(); } Qt3DRender::Render::Entity *sceneRoot() const { return m_sceneRoot; } - + Qt3DCore::QAspectManager *aspectManager() const { return d_func()->m_aspectManager; } + Qt3DCore::QChangeArbiter *arbiter() const { return d_func()->m_arbiter; } private: + Qt3DCore::QAspectEngine *m_engine; Render::Entity *m_sceneRoot; }; @@ -146,6 +169,10 @@ namespace { void runRequiredJobs(Qt3DRender::TestAspect *test) { + QCoreApplication::processEvents(); + const auto dn = test->arbiter()->takeDirtyFrontEndNodes(); + Qt3DCore::QAbstractAspectPrivate::get(test)->syncDirtyFrontEndNodes(dn); + Qt3DRender::Render::UpdateWorldTransformJob updateWorldTransform; updateWorldTransform.setRoot(test->sceneRoot()); updateWorldTransform.setManagers(test->nodeManagers()); @@ -233,6 +260,7 @@ private Q_SLOTS: QmlSceneReader sceneReader(source); QScopedPointer<Qt3DCore::QEntity> root(qobject_cast<Qt3DCore::QEntity *>(sceneReader.root())); QVERIFY(root); + QScopedPointer<Qt3DRender::TestAspect> test(new Qt3DRender::TestAspect(root.data())); Qt3DCore::QComponentVector rootComponents = root->components(); Qt3DRender::QRayCaster *rayCaster = nullptr; @@ -245,33 +273,31 @@ private Q_SLOTS: rayCaster->trigger(rayOrigin, rayDirection, rayLength); - QScopedPointer<Qt3DRender::TestAspect> test(new Qt3DRender::TestAspect(root.data())); - TestArbiter arbiter; - // Runs Required jobs runRequiredJobs(test.data()); Qt3DRender::Render::RayCaster *backendRayCaster = test->nodeManagers()->rayCasterManager()->lookupResource(rayCaster->id()); QVERIFY(backendRayCaster); - Qt3DCore::QBackendNodePrivate::get(backendRayCaster)->setArbiter(&arbiter); + Qt3DCore::QBackendNodePrivate::get(backendRayCaster)->setArbiter(test->arbiter()); // WHEN Qt3DRender::Render::RayCastingJob rayCastingJob; initializeJob(&rayCastingJob, test.data()); bool earlyReturn = !rayCastingJob.runHelper(); + rayCastingJob.postFrame(test->aspectManager()); + QCoreApplication::processEvents(); // THEN QVERIFY(!earlyReturn); QVERIFY(!backendRayCaster->isEnabled()); - QCOMPARE(arbiter.events.count(), 2); // hits & disable - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "hits"); - Qt3DRender::QRayCaster::Hits hits = change->value().value<Qt3DRender::QRayCaster::Hits>(); - QCOMPARE(hits.size(), numIntersections); + QVERIFY(!rayCaster->isEnabled()); + auto dirtyNodes = test->arbiter()->takeDirtyFrontEndNodes(); + QCOMPARE(dirtyNodes.count(), 1); // hits & disable + QCOMPARE(rayCaster->hits().size(), numIntersections); if (numIntersections) - QVERIFY(hits.first().entityId()); + QVERIFY(rayCaster->hits().first().entityId()); } void screenSpaceRayCaster_data() @@ -294,6 +320,7 @@ private Q_SLOTS: QmlSceneReader sceneReader(source); QScopedPointer<Qt3DCore::QEntity> root(qobject_cast<Qt3DCore::QEntity *>(sceneReader.root())); QVERIFY(root); + QScopedPointer<Qt3DRender::TestAspect> test(new Qt3DRender::TestAspect(root.data())); Qt3DCore::QComponentVector rootComponents = root->components(); Qt3DRender::QScreenRayCaster *rayCaster = nullptr; @@ -306,33 +333,31 @@ private Q_SLOTS: rayCaster->trigger(rayPosition); - QScopedPointer<Qt3DRender::TestAspect> test(new Qt3DRender::TestAspect(root.data())); - TestArbiter arbiter; - // Runs Required jobs runRequiredJobs(test.data()); Qt3DRender::Render::RayCaster *backendRayCaster = test->nodeManagers()->rayCasterManager()->lookupResource(rayCaster->id()); QVERIFY(backendRayCaster); - Qt3DCore::QBackendNodePrivate::get(backendRayCaster)->setArbiter(&arbiter); + Qt3DCore::QBackendNodePrivate::get(backendRayCaster)->setArbiter(test->arbiter()); // WHEN Qt3DRender::Render::RayCastingJob rayCastingJob; initializeJob(&rayCastingJob, test.data()); bool earlyReturn = !rayCastingJob.runHelper(); + rayCastingJob.postFrame(test->aspectManager()); + QCoreApplication::processEvents(); // THEN QVERIFY(!earlyReturn); QVERIFY(!backendRayCaster->isEnabled()); - QCOMPARE(arbiter.events.count(), 2); // hits & disable - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "hits"); - Qt3DRender::QScreenRayCaster::Hits hits = change->value().value<Qt3DRender::QScreenRayCaster::Hits>(); - QCOMPARE(hits.size(), numIntersections); + QVERIFY(!rayCaster->isEnabled()); + auto dirtyNodes = test->arbiter()->takeDirtyFrontEndNodes(); + QCOMPARE(dirtyNodes.count(), 1); // hits & disable + QCOMPARE(rayCaster->hits().size(), numIntersections); if (numIntersections) - QVERIFY(hits.first().entityId()); + QVERIFY(rayCaster->hits().first().entityId()); } }; diff --git a/tests/auto/render/rendercapture/tst_rendercapture.cpp b/tests/auto/render/rendercapture/tst_rendercapture.cpp index 194c5cd24..3ad3668c9 100644 --- a/tests/auto/render/rendercapture/tst_rendercapture.cpp +++ b/tests/auto/render/rendercapture/tst_rendercapture.cpp @@ -31,7 +31,6 @@ #include <Qt3DRender/private/rendercapture_p.h> #include <Qt3DRender/qrendercapture.h> #include <Qt3DCore/private/qbackendnode_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "testpostmanarbiter.h" #include "testrenderer.h" diff --git a/tests/auto/render/renderpass/tst_renderpass.cpp b/tests/auto/render/renderpass/tst_renderpass.cpp index 136e2755d..39ff1c06e 100644 --- a/tests/auto/render/renderpass/tst_renderpass.cpp +++ b/tests/auto/render/renderpass/tst_renderpass.cpp @@ -30,10 +30,6 @@ #include <qbackendnodetester.h> #include <Qt3DRender/private/renderpass_p.h> -#include <Qt3DCore/QPropertyUpdatedChange> -#include <Qt3DCore/QPropertyNodeAddedChange> -#include <Qt3DCore/QPropertyNodeRemovedChange> - #include <Qt3DRender/QFilterKey> #include <Qt3DRender/QRenderPass> #include <Qt3DRender/QShaderProgram> diff --git a/tests/auto/render/rendertarget/tst_rendertarget.cpp b/tests/auto/render/rendertarget/tst_rendertarget.cpp index cd7b0978a..31eee6ec5 100644 --- a/tests/auto/render/rendertarget/tst_rendertarget.cpp +++ b/tests/auto/render/rendertarget/tst_rendertarget.cpp @@ -32,9 +32,6 @@ #include <Qt3DRender/qrendertargetoutput.h> #include <Qt3DRender/private/qrendertarget_p.h> #include <Qt3DRender/private/rendertarget_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/auto/render/renderviewbuilder/tst_renderviewbuilder.cpp b/tests/auto/render/renderviewbuilder/tst_renderviewbuilder.cpp index 22a461e4a..96d51a3a9 100644 --- a/tests/auto/render/renderviewbuilder/tst_renderviewbuilder.cpp +++ b/tests/auto/render/renderviewbuilder/tst_renderviewbuilder.cpp @@ -27,7 +27,6 @@ ****************************************************************************/ #include <QtTest/QTest> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qaspectjobmanager_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> #include <Qt3DCore/private/qnode_p.h> diff --git a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp index cf0c25d10..6d349f994 100644 --- a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp +++ b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp @@ -34,7 +34,7 @@ #include <Qt3DRender/private/managers_p.h> #include <Qt3DRender/private/stringtoint_p.h> #include <Qt3DRender/qshaderdata.h> - +#include "testrenderer.h" #include "testpostmanarbiter.h" class tst_RenderViewUtils : public Qt3DCore::QBackendNodeTester @@ -54,20 +54,22 @@ private Q_SLOTS: void shouldNotifyDynamicPropertyChanges(); private: - void initBackendShaderData(Qt3DRender::QShaderData *frontend, + void initBackendShaderData(Qt3DRender::Render::AbstractRenderer *renderer, + Qt3DRender::QShaderData *frontend, Qt3DRender::Render::ShaderDataManager *manager) { // Create children first for (QObject *c : frontend->children()) { Qt3DRender::QShaderData *cShaderData = qobject_cast<Qt3DRender::QShaderData *>(c); if (cShaderData) - initBackendShaderData(cShaderData, manager); + initBackendShaderData(renderer, cShaderData, manager); } // Create backend element for frontend one Qt3DRender::Render::ShaderData *backend = manager->getOrCreateResource(frontend->id()); // Init the backend element - simulateInitialization(frontend, backend); + backend->setRenderer(renderer); + simulateInitializationSync(frontend, backend); } void initBackendTexture(Qt3DRender::QAbstractTexture *frontend, @@ -345,13 +347,14 @@ private: void tst_RenderViewUtils::topLevelScalarValueNoUniforms() { // GIVEN + TestRenderer renderer; QScopedPointer<ScalarShaderData> shaderData(new ScalarShaderData()); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager()); QScopedPointer<Qt3DRender::Render::TextureManager> textureManager(new Qt3DRender::Render::TextureManager()); // WHEN shaderData->setScalar(883.0f); - initBackendShaderData(shaderData.data(), manager.data()); + initBackendShaderData(&renderer, shaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -373,13 +376,14 @@ void tst_RenderViewUtils::topLevelScalarValueNoUniforms() void tst_RenderViewUtils::topLevelScalarValue() { // GIVEN + TestRenderer renderer; QScopedPointer<ScalarShaderData> shaderData(new ScalarShaderData()); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager()); QScopedPointer<Qt3DRender::Render::TextureManager> textureManager(new Qt3DRender::Render::TextureManager()); // WHEN shaderData->setScalar(883.0f); - initBackendShaderData(shaderData.data(), manager.data()); + initBackendShaderData(&renderer, shaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -413,6 +417,7 @@ void tst_RenderViewUtils::topLevelScalarValue() void tst_RenderViewUtils::topLevelTextureValueNoUniforms() { // GIVEN + TestRenderer renderer; QScopedPointer<TextureShaderData> shaderData(new TextureShaderData); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager); QScopedPointer<Qt3DRender::QAbstractTexture> texture(new Qt3DRender::QTexture2D); @@ -420,7 +425,7 @@ void tst_RenderViewUtils::topLevelTextureValueNoUniforms() // WHEN shaderData->setTexture(texture.data()); - initBackendShaderData(shaderData.data(), manager.data()); + initBackendShaderData(&renderer, shaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -442,6 +447,7 @@ void tst_RenderViewUtils::topLevelTextureValueNoUniforms() void tst_RenderViewUtils::topLevelTextureValue() { // GIVEN + TestRenderer renderer; QScopedPointer<TextureShaderData> shaderData(new TextureShaderData); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager); QScopedPointer<Qt3DRender::QAbstractTexture> texture(new Qt3DRender::QTexture2D); @@ -450,7 +456,7 @@ void tst_RenderViewUtils::topLevelTextureValue() // WHEN initBackendTexture(texture.data(), textureManager.data()); shaderData->setTexture(texture.data()); - initBackendShaderData(shaderData.data(), manager.data()); + initBackendShaderData(&renderer, shaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -484,6 +490,7 @@ void tst_RenderViewUtils::topLevelTextureValue() void tst_RenderViewUtils::topLevelArrayValue() { // GIVEN + TestRenderer renderer; QScopedPointer<ArrayShaderData> shaderData(new ArrayShaderData()); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager()); QScopedPointer<Qt3DRender::Render::TextureManager> textureManager(new Qt3DRender::Render::TextureManager()); @@ -491,7 +498,7 @@ void tst_RenderViewUtils::topLevelArrayValue() // WHEN QVariantList arrayValues = QVariantList() << 454 << 350 << 383 << 427 << 552; shaderData->setArray(arrayValues); - initBackendShaderData(shaderData.data(), manager.data()); + initBackendShaderData(&renderer, shaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -525,6 +532,7 @@ void tst_RenderViewUtils::topLevelArrayValue() void tst_RenderViewUtils::nestedShaderDataValue() { // GIVEN + TestRenderer renderer; QScopedPointer<ArrayShaderData> arrayShaderData(new ArrayShaderData()); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager()); QScopedPointer<Qt3DRender::Render::TextureManager> textureManager(new Qt3DRender::Render::TextureManager()); @@ -549,7 +557,7 @@ void tst_RenderViewUtils::nestedShaderDataValue() // WHEN const QVariantList arrayValues = QVariantList() << QVariant::fromValue(id1) << QVariant::fromValue(id2) << QVariant::fromValue(id3); arrayShaderData->setArray(arrayValues); - initBackendShaderData(arrayShaderData.data(), manager.data()); + initBackendShaderData(&renderer, arrayShaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendArrayShaderData = manager->lookupResource(arrayShaderData->id()); @@ -624,13 +632,14 @@ void tst_RenderViewUtils::topLevelStructValue_data() void tst_RenderViewUtils::topLevelStructValue() { // GIVEN + TestRenderer renderer; QFETCH(StructShaderData *, shaderData); QFETCH(QString, blockName); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager()); QScopedPointer<Qt3DRender::Render::TextureManager> textureManager(new Qt3DRender::Render::TextureManager()); // WHEN - initBackendShaderData(shaderData, manager.data()); + initBackendShaderData(&renderer, shaderData, manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -665,6 +674,7 @@ void tst_RenderViewUtils::topLevelStructValue() void tst_RenderViewUtils::topLevelDynamicProperties() { // GIVEN + TestRenderer renderer; QScopedPointer<Qt3DRender::QShaderData> shaderData(new Qt3DRender::QShaderData()); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager()); QScopedPointer<Qt3DRender::QAbstractTexture> texture(new Qt3DRender::QTexture2D); @@ -675,7 +685,7 @@ void tst_RenderViewUtils::topLevelDynamicProperties() shaderData->setProperty("scalar", 883.0f); shaderData->setProperty("array", QVariantList() << 454 << 350 << 383 << 427 << 552); shaderData->setProperty("texture", QVariant::fromValue(texture.data())); - initBackendShaderData(shaderData.data(), manager.data()); + initBackendShaderData(&renderer, shaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -709,6 +719,7 @@ void tst_RenderViewUtils::transformedProperties() // GIVEN QScopedPointer<Qt3DRender::QShaderData> shaderData(new Qt3DRender::QShaderData()); QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager()); + TestRenderer renderer; // WHEN const Vector3D position = Vector3D(15.0f, -5.0f, 10.0f); @@ -733,7 +744,7 @@ void tst_RenderViewUtils::transformedProperties() shaderData->setProperty("position1Transformed", Qt3DRender::Render::ShaderData::ModelToEye); shaderData->setProperty("position2Transformed", Qt3DRender::Render::ShaderData::ModelToWorld); shaderData->setProperty("position3Transformed", Qt3DRender::Render::ShaderData::ModelToWorldDirection); - initBackendShaderData(shaderData.data(), manager.data()); + initBackendShaderData(&renderer, shaderData.data(), manager.data()); // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); @@ -751,7 +762,7 @@ void tst_RenderViewUtils::transformedProperties() const QVariant position0Value = backendShaderData->getTransformedProperty(QStringLiteral("position0"), viewMatrix); // THEN - QCOMPARE(position0Value, QVariant()); + QCOMPARE(position0Value, positionQt); QCOMPARE(position1Value, viewMatrix * worldMatrix * position); QCOMPARE(position2Value, worldMatrix * position); QCOMPARE(position3Value, Vector3D((worldMatrix * Vector4D(position, 0.0f)))); diff --git a/tests/auto/render/sceneloader/tst_sceneloader.cpp b/tests/auto/render/sceneloader/tst_sceneloader.cpp index e5ea8b6c1..d146abfcc 100644 --- a/tests/auto/render/sceneloader/tst_sceneloader.cpp +++ b/tests/auto/render/sceneloader/tst_sceneloader.cpp @@ -130,51 +130,6 @@ private Q_SLOTS: QCOMPARE(sceneLoader.isEnabled(), false); } - void checkSubtreeTransmission() - { - // GIVEN - TestRenderer renderer; - TestArbiter arbiter; - Qt3DRender::Render::Scene sceneLoader; - - Qt3DCore::QBackendNodePrivate::get(&sceneLoader)->setArbiter(&arbiter); - sceneLoader.setRenderer(&renderer); - - // WHEN - Qt3DCore::QEntity subtree; - sceneLoader.setSceneSubtree(&subtree); - - // THEN - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(arbiter.events.count(), 1); - QCOMPARE(change->propertyName(), "scene"); - QCOMPARE(change->value().value<Qt3DCore::QEntity *>(), &subtree); - - arbiter.events.clear(); - } - - void checkStatusTransmission() - { - // GIVEN - TestRenderer renderer; - TestArbiter arbiter; - Qt3DRender::Render::Scene sceneLoader; - - Qt3DCore::QBackendNodePrivate::get(&sceneLoader)->setArbiter(&arbiter); - sceneLoader.setRenderer(&renderer); - - // WHEN - sceneLoader.setStatus(Qt3DRender::QSceneLoader::Ready); - - // THEN - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(arbiter.events.count(), 1); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Ready); - - arbiter.events.clear(); - } - void checkProcessEmptyPath() { // GIVEN diff --git a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp index c9a290dbd..7a9e0fac4 100644 --- a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp +++ b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp @@ -28,6 +28,7 @@ #include <QtTest/QTest> #include <qbackendnodetester.h> +#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/qbackendnode_p.h> #include <Qt3DRender/private/shaderbuilder_p.h> #include <Qt3DRender/qshaderprogram.h> diff --git a/tests/auto/render/shaderimage/tst_shaderimage.cpp b/tests/auto/render/shaderimage/tst_shaderimage.cpp index 6b2fc8ad7..0771f1fe0 100644 --- a/tests/auto/render/shaderimage/tst_shaderimage.cpp +++ b/tests/auto/render/shaderimage/tst_shaderimage.cpp @@ -41,7 +41,6 @@ #include <Qt3DRender/qshaderimage.h> #include <Qt3DRender/private/qshaderimage_p.h> #include <Qt3DRender/private/shaderimage_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DRender/qtexture.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/auto/render/skeleton/tst_skeleton.cpp b/tests/auto/render/skeleton/tst_skeleton.cpp index 17996470c..6af055fb0 100644 --- a/tests/auto/render/skeleton/tst_skeleton.cpp +++ b/tests/auto/render/skeleton/tst_skeleton.cpp @@ -178,43 +178,6 @@ private Q_SLOTS: QCOMPARE(backendSkeleton.source(), newSource); } - void checkStatusPropertyBackendNotification() - { - // GIVEN - TestRenderer renderer; - NodeManagers nodeManagers; - renderer.setNodeManagers(&nodeManagers); - TestArbiter arbiter; - Skeleton backendSkeleton; - backendSkeleton.setRenderer(&renderer); - backendSkeleton.setSkeletonManager(nodeManagers.skeletonManager()); - backendSkeleton.setEnabled(true); - Qt3DCore::QBackendNodePrivate::get(&backendSkeleton)->setArbiter(&arbiter); - - // WHEN - backendSkeleton.setStatus(QSkeletonLoader::Error); - - // THEN - QCOMPARE(backendSkeleton.status(), QSkeletonLoader::Error); - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "status"); - QCOMPARE(change->value().value<QSkeletonLoader::Status>(), backendSkeleton.status()); - QCOMPARE(Qt3DCore::QPropertyUpdatedChangeBasePrivate::get(change.data())->m_isIntermediate, - false); - - arbiter.events.clear(); - - // WHEN - backendSkeleton.setStatus(QSkeletonLoader::Error); - - // THEN - QCOMPARE(backendSkeleton.status(), QSkeletonLoader::Error); - QCOMPARE(arbiter.events.count(), 0); - - arbiter.events.clear(); - } - void checkCreateFrontendJoint_data() { QTest::addColumn<QMatrix4x4>("inverseBindMatrix"); @@ -257,30 +220,6 @@ private Q_SLOTS: QTest::newRow("inverseBind") << m << localPose << name << joint; } - void checkCreateFrontendJoint() - { - // GIVEN - Skeleton backendSkeleton; - QFETCH(QMatrix4x4, inverseBindMatrix); - QFETCH(Qt3DCore::Sqt, localPose); - QFETCH(QString, jointName); - QFETCH(QJoint *, expectedJoint); - - // WHEN - const QJoint *actualJoint = backendSkeleton.createFrontendJoint(jointName, localPose, inverseBindMatrix); - - // THEN - QCOMPARE(actualJoint->scale(), expectedJoint->scale()); - QCOMPARE(actualJoint->rotation(), expectedJoint->rotation()); - QCOMPARE(actualJoint->translation(), expectedJoint->translation()); - QCOMPARE(actualJoint->inverseBindMatrix(), expectedJoint->inverseBindMatrix()); - QCOMPARE(actualJoint->name(), expectedJoint->name()); - - // Cleanup - delete actualJoint; - delete expectedJoint; - } - void checkCreateFrontendJoints_data() { QTest::addColumn<SkeletonData>("skeletonData"); @@ -344,46 +283,6 @@ private Q_SLOTS: QTest::newRow("deep") << skeletonData << rootJoint; } - - void checkCreateFrontendJoints() - { - // GIVEN - Skeleton backendSkeleton; - QFETCH(SkeletonData, skeletonData); - QFETCH(QJoint *, expectedRootJoint); - - // WHEN - QJoint *actualRootJoint = backendSkeleton.createFrontendJoints(skeletonData); - - // THEN - if (skeletonData.joints.isEmpty()) { - QVERIFY(actualRootJoint == expectedRootJoint); // nullptr - return; - } - - // Linearise the tree of joints and check them against the skeletonData - QVector<QJoint *> joints = linearizeTree(actualRootJoint); - QCOMPARE(joints.size(), skeletonData.joints.size()); - for (int i = 0; i < joints.size(); ++i) { - // Check the translations match - QCOMPARE(joints[i]->translation(), skeletonData.localPoses[i].translation); - } - - // Now we know the order of Joints match. Check the parents match too - for (int i = 0; i < joints.size(); ++i) { - // Get parent index from joint info - const int parentIndex = skeletonData.joints[i].parentIndex; - if (parentIndex == -1) { - QVERIFY(joints[i]->parent() == nullptr); - } else { - QCOMPARE(joints[i]->parent(), joints[parentIndex]); - } - } - - // Cleanup - delete actualRootJoint; - delete expectedRootJoint; - } }; QTEST_APPLESS_MAIN(tst_Skeleton) diff --git a/tests/auto/render/sortpolicy/tst_sortpolicy.cpp b/tests/auto/render/sortpolicy/tst_sortpolicy.cpp index a4811d82c..5552a1760 100644 --- a/tests/auto/render/sortpolicy/tst_sortpolicy.cpp +++ b/tests/auto/render/sortpolicy/tst_sortpolicy.cpp @@ -29,7 +29,6 @@ #include <QtTest/QTest> #include <qbackendnodetester.h> #include <Qt3DRender/private/sortpolicy_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "testrenderer.h" class tst_SortPolicy : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/render/technique/tst_technique.cpp b/tests/auto/render/technique/tst_technique.cpp index 2ed39e315..5b6fdb4a4 100644 --- a/tests/auto/render/technique/tst_technique.cpp +++ b/tests/auto/render/technique/tst_technique.cpp @@ -39,9 +39,6 @@ #include <Qt3DRender/private/managers_p.h> #include <Qt3DRender/private/filterkey_p.h> #include <Qt3DRender/private/techniquemanager_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp index a51f082a7..aec79bbbd 100644 --- a/tests/auto/render/texture/tst_texture.cpp +++ b/tests/auto/render/texture/tst_texture.cpp @@ -28,9 +28,6 @@ #include <QtTest/QTest> #include <qbackendnodetester.h> -#include <Qt3DCore/qdynamicpropertyupdatedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> #include <Qt3DRender/private/texture_p.h> #include "testpostmanarbiter.h" @@ -209,25 +206,21 @@ void tst_RenderTexture::checkFrontendPropertyNotifications() texture.addTextureImage(&img); // THEN - QCOMPARE(arbiter.events.size(), 1); - const auto addedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>(); - QCOMPARE(addedChange->propertyName(), "textureImage"); - QCOMPARE(addedChange->addedNodeId(), img.id()); - QCOMPARE(addedChange->type(), Qt3DCore::PropertyValueAdded); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), &texture); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); // WHEN texture.removeTextureImage(&img); // THEN - QCOMPARE(arbiter.events.size(), 1); - const auto removedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>(); - QCOMPARE(removedChange->propertyName(), "textureImage"); - QCOMPARE(removedChange->removedNodeId(), img.id()); - QCOMPARE(removedChange->type(), Qt3DCore::PropertyValueRemoved); + QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes.front(), &texture); - arbiter.events.clear(); + arbiter.dirtyNodes.clear(); } template <typename FrontendTextureType, Qt3DRender::QAbstractTexture::Target Target> @@ -458,9 +451,8 @@ void tst_RenderTexture::checkPropertyChanges() // WHEN Qt3DRender::QTextureImage img; - const auto imageAddChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &img); - imageAddChange->setPropertyName("textureImage"); - backend.sceneChangeEvent(imageAddChange); + frontend.addTextureImage(&img); + backend.syncFromFrontEnd(&frontend, false); // THEN QCOMPARE(backend.textureImageIds().size(), 1); diff --git a/tests/auto/render/textures/tst_textures.cpp b/tests/auto/render/textures/tst_textures.cpp index 725ddc269..555bd09a3 100644 --- a/tests/auto/render/textures/tst_textures.cpp +++ b/tests/auto/render/textures/tst_textures.cpp @@ -207,7 +207,6 @@ class tst_RenderTextures : public Qt3DCore::QBackendNodeTester texImgBackend->setRenderer(renderer); simulateInitializationSync(texImgFrontend, texImgBackend); } - backend->addTextureImage(texImgFrontend->id()); } return backend; diff --git a/tests/auto/render/transform/tst_transform.cpp b/tests/auto/render/transform/tst_transform.cpp index 3238da2fe..476c47393 100644 --- a/tests/auto/render/transform/tst_transform.cpp +++ b/tests/auto/render/transform/tst_transform.cpp @@ -31,6 +31,7 @@ #include <Qt3DCore/qtransform.h> #include <Qt3DCore/private/qtransform_p.h> #include <Qt3DRender/private/transform_p.h> +#include <Qt3DRender/private/updateworldtransformjob_p.h> #include <Qt3DCore/qpropertyupdatedchange.h> #include <private/qbackendnode_p.h> #include "qbackendnodetester.h" @@ -179,31 +180,6 @@ private Q_SLOTS: renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty); } } - - void checkWorldTransformUpdate() - { - // GIVEN - TestArbiter arbiter; - Qt3DRender::Render::Transform backend; - - Qt3DCore::QBackendNodePrivate::get(&backend)->setArbiter(&arbiter); - - // WHEN - const QMatrix4x4 expectedNewWorldMatrix(1.0f, 2.0f, 3.0f, 4.0f, - 5.0f, 6.0f, 7.0f, 8.0f, - 9.0f, 10.0f, 11.0f, 12.0f, - 13.0f, 14.0f, 15.0f, 16.0f); - Matrix4x4 newWorldMatrix(expectedNewWorldMatrix); - backend.notifyWorldTransformChanged(newWorldMatrix); - - // THEN - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(arbiter.events.count(), 1); - QCOMPARE(change->propertyName(), "worldMatrix"); - QCOMPARE(change->value().value<QMatrix4x4>(), expectedNewWorldMatrix); - - arbiter.events.clear(); - } }; QTEST_MAIN(tst_Transform) diff --git a/tests/auto/render/updatemeshtrianglelistjob/tst_updatemeshtrianglelistjob.cpp b/tests/auto/render/updatemeshtrianglelistjob/tst_updatemeshtrianglelistjob.cpp index df24a5ca6..ae2218739 100644 --- a/tests/auto/render/updatemeshtrianglelistjob/tst_updatemeshtrianglelistjob.cpp +++ b/tests/auto/render/updatemeshtrianglelistjob/tst_updatemeshtrianglelistjob.cpp @@ -36,8 +36,6 @@ #include <Qt3DRender/private/loadgeometryjob_p.h> #include <Qt3DRender/qrenderaspect.h> #include <Qt3DRender/private/qrenderaspect_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> #include "qmlscenereader.h" diff --git a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp index 492aa0fde..b2d0b612c 100644 --- a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp +++ b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp @@ -207,11 +207,11 @@ private Q_SLOTS: // THEN QCOMPARE(backendShaderData->properties().size(), 3); - QVERIFY(backendShaderData->properties().contains(QLatin1String("eyePosition"))); - QVERIFY(backendShaderData->properties().contains(QLatin1String("eyePositionTransformed"))); + QVERIFY(backendShaderData->properties().contains(QStringLiteral("eyePosition"))); + QVERIFY(backendShaderData->properties().contains(QStringLiteral("eyePositionTransformed"))); - QCOMPARE(backendShaderData->properties()[QLatin1String("eyePosition")].value<QVector3D>(), QVector3D(1.0f, 1.0f, 1.0f)); - QCOMPARE(backendShaderData->properties()[QLatin1String("eyePositionTransformed")].toInt(), int(Qt3DRender::Render::ShaderData::ModelToEye)); + QCOMPARE(backendShaderData->properties()[QStringLiteral("eyePosition")].value.value<QVector3D>(), QVector3D(1.0f, 1.0f, 1.0f)); + QCOMPARE(backendShaderData->properties()[QStringLiteral("eyePositionTransformed")].value.toInt(), int(Qt3DRender::Render::ShaderData::ModelToEye)); // WHEN Qt3DRender::Render::UpdateShaderDataTransformJob backendUpdateShaderDataTransformJob; @@ -220,7 +220,7 @@ private Q_SLOTS: // THEN // See scene file to find translation - QCOMPARE(backendShaderData->getTransformedProperty(QLatin1String("eyePosition"), Matrix4x4(camera->viewMatrix())).value<Vector3D>(), + QCOMPARE(backendShaderData->getTransformedProperty(QStringLiteral("eyePosition"), Matrix4x4(camera->viewMatrix())).value<Vector3D>(), Matrix4x4(camera->viewMatrix()) * (Vector3D(1.0f, 1.0f, 1.0f) + Vector3D(0.0f, 5.0f, 0.0f))); } @@ -248,11 +248,11 @@ private Q_SLOTS: // THEN QCOMPARE(backendShaderData->properties().size(), 3); - QVERIFY(backendShaderData->properties().contains(QLatin1String("position"))); - QVERIFY(backendShaderData->properties().contains(QLatin1String("positionTransformed"))); + QVERIFY(backendShaderData->properties().contains(QStringLiteral("position"))); + QVERIFY(backendShaderData->properties().contains(QStringLiteral("positionTransformed"))); - QCOMPARE(backendShaderData->properties()[QLatin1String("position")].value<QVector3D>(), QVector3D(1.0f, 1.0f, 1.0f)); - QCOMPARE(backendShaderData->properties()[QLatin1String("positionTransformed")].toInt(), int(Qt3DRender::Render::ShaderData::ModelToWorld)); + QCOMPARE(backendShaderData->properties()[QStringLiteral("position")].value.value<QVector3D>(), QVector3D(1.0f, 1.0f, 1.0f)); + QCOMPARE(backendShaderData->properties()[QStringLiteral("positionTransformed")].value.toInt(), int(Qt3DRender::Render::ShaderData::ModelToWorld)); // WHEN Qt3DRender::Render::UpdateShaderDataTransformJob backendUpdateShaderDataTransformJob; @@ -261,7 +261,7 @@ private Q_SLOTS: // THEN // See scene file to find translation - QCOMPARE(backendShaderData->getTransformedProperty(QLatin1String("position"), Matrix4x4(camera->viewMatrix())).value<Vector3D>(), + QCOMPARE(backendShaderData->getTransformedProperty(QStringLiteral("position"), Matrix4x4(camera->viewMatrix())).value<Vector3D>(), Vector3D(1.0f, 1.0f, 1.0f) + Vector3D(5.0f, 5.0f, 5.0f)); } }; diff --git a/tests/auto/render/waitfence/tst_waitfence.cpp b/tests/auto/render/waitfence/tst_waitfence.cpp index e27e4ae19..26f473f45 100644 --- a/tests/auto/render/waitfence/tst_waitfence.cpp +++ b/tests/auto/render/waitfence/tst_waitfence.cpp @@ -43,7 +43,6 @@ #include <Qt3DRender/qwaitfence.h> #include <Qt3DRender/private/qwaitfence_p.h> #include <Qt3DRender/private/waitfence_p.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include "qbackendnodetester.h" #include "testrenderer.h" diff --git a/tests/manual/tessellation-modes/tessellatedquadmesh.cpp b/tests/manual/tessellation-modes/tessellatedquadmesh.cpp index 5fd1aedb2..8e9a09d98 100644 --- a/tests/manual/tessellation-modes/tessellatedquadmesh.cpp +++ b/tests/manual/tessellation-modes/tessellatedquadmesh.cpp @@ -61,7 +61,7 @@ public: TessellatedGeometry(Qt3DCore::QNode *parent = nullptr) : Qt3DRender::QGeometry(parent) , m_positionAttribute(new Qt3DRender::QAttribute(this)) - , m_vertexBuffer(new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, this)) + , m_vertexBuffer(new Qt3DRender::QBuffer(this)) { const float positionData[] = { -0.8f, -0.8f, 0.0f, |