summaryrefslogtreecommitdiffstats
path: root/tests/auto/core
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2019-08-06 15:30:01 +0100
committerJim Albamont <jim.albamont@kdab.com>2019-09-17 22:17:26 -0700
commitc8c49f2a1750906af122ad08aeaa67c644007552 (patch)
treebbc66783e3de9696624c9e33546b7085bf7e1315 /tests/auto/core
parent6681ce72f513448bb4610e9de1399b1591fda4d7 (diff)
Update QEntity to use direct sync mode
Change-Id: I9fa6e67607baa66250789b8bf618f30bd45aad98 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'tests/auto/core')
-rw-r--r--tests/auto/core/common/qbackendnodetester.cpp1
-rw-r--r--tests/auto/core/common/qbackendnodetester.h16
-rw-r--r--tests/auto/core/nodes/tst_nodes.cpp13
3 files changed, 20 insertions, 10 deletions
diff --git a/tests/auto/core/common/qbackendnodetester.cpp b/tests/auto/core/common/qbackendnodetester.cpp
index 5d4a10b81..a2685f556 100644
--- a/tests/auto/core/common/qbackendnodetester.cpp
+++ b/tests/auto/core/common/qbackendnodetester.cpp
@@ -36,7 +36,6 @@
#include "qbackendnodetester.h"
#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnode.h>
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/core/common/qbackendnodetester.h b/tests/auto/core/common/qbackendnodetester.h
index a9738dff0..a0b89e503 100644
--- a/tests/auto/core/common/qbackendnodetester.h
+++ b/tests/auto/core/common/qbackendnodetester.h
@@ -41,13 +41,13 @@
#include <Qt3DCore/qnodeid.h>
#include <Qt3DCore/qscenechange.h>
#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DCore/qnode.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QBackendNode;
-class QNode;
class QBackendNodeTester : public QObject
{
@@ -57,9 +57,21 @@ public:
// Proxies to allow test classes to call private methods on QBackendNode
void setPeerId(QBackendNode *backend, QNodeId id);
- void simulateInitialization(QNode *frontend, QBackendNode *backend);
void sceneChangeEvent(QBackendNode *backend, const Qt3DCore::QSceneChangePtr &e);
Qt3DCore::QNodeCreatedChangeBasePtr creationChange(QNode *frontend) const;
+
+ template<class Backend>
+ void simulateInitializationSync(QNode *frontend, Backend *backend)
+ {
+ Q_ASSERT(frontend);
+ Q_ASSERT(backend);
+
+ backend->setPeerId(frontend->id());
+ backend->setEnabled(frontend->isEnabled());
+ backend->syncFromFrontEnd(frontend, true);
+ }
+
+ void simulateInitialization(QNode *frontend, QBackendNode *backend);
};
} // namespace Qt3DCore
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp
index 150df3ef0..8dbee66ab 100644
--- a/tests/auto/core/nodes/tst_nodes.cpp
+++ b/tests/auto/core/nodes/tst_nodes.cpp
@@ -1170,8 +1170,7 @@ void tst_Nodes::checkParentingQEntityToQNode()
// THEN we should get
// - one child removed change for childEntity->subTreeRoot,
// - one child added change for childEntity->childNode,
- // - and one property updated event specifying the correct QEntity parent (subTreeRoot)
- QCOMPARE(spy.events.size(), 3);
+ QCOMPARE(spy.events.size(), 2);
const auto removedEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeRemovedChange>();
QVERIFY(!removedEvent.isNull());
@@ -1181,11 +1180,11 @@ void tst_Nodes::checkParentingQEntityToQNode()
QVERIFY(!addedEvent.isNull());
QCOMPARE(addedEvent->subjectId(), childNode->id());
- const auto parentChangeEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyUpdatedChange>();
- QVERIFY(!parentChangeEvent.isNull());
- QCOMPARE(parentChangeEvent->subjectId(), childEntity->id());
- QCOMPARE(parentChangeEvent->propertyName(), "parentEntityUpdated");
- QCOMPARE(parentChangeEvent->value().value<Qt3DCore::QNodeId>(), subTreeRoot->id());
+// const auto parentChangeEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyUpdatedChange>();
+// QVERIFY(!parentChangeEvent.isNull());
+// QCOMPARE(parentChangeEvent->subjectId(), childEntity->id());
+// QCOMPARE(parentChangeEvent->propertyName(), "parentEntityUpdated");
+// QCOMPARE(parentChangeEvent->value().value<Qt3DCore::QNodeId>(), subTreeRoot->id());
}
void tst_Nodes::checkConstructionWithParent()