summaryrefslogtreecommitdiffstats
path: root/tests/auto/core
diff options
context:
space:
mode:
authorJim Albamont <jim.albamont@kdab.com>2019-09-17 14:37:50 -0700
committerJim Albamont <jim.albamont@kdab.com>2019-09-17 23:05:35 -0700
commit1ee9ba20d5c4156bdbb22ee23a94174c8e1f4053 (patch)
tree63150053cdc56aef3a89544c6c0fff4f31022a06 /tests/auto/core
parent9b794f07b4ee210c6952936d1fd19c5bbe743189 (diff)
Fix test for parenting QEntity to QNode
The purpose of this test is to make sure when parenting a QEntity to a QNode, the backend entity will receive notification and be able to correctly resolve it's parent entity. Update the test to check that the QEntity node is marked dirty in the arbiter and has the correct parent and parent entity. Change-Id: I8f2c8aa1c8b5b6bbabd956bbfdef36fafcd05f8d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests/auto/core')
-rw-r--r--tests/auto/core/nodes/tst_nodes.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp
index 8f3299201..76c66604c 100644
--- a/tests/auto/core/nodes/tst_nodes.cpp
+++ b/tests/auto/core/nodes/tst_nodes.cpp
@@ -1392,11 +1392,15 @@ 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());
+ // The arbiter's dirtyNodes should contain the childEntity and
+ // - the dirty node's parent should be childNode
+ // - the dirty node's parent entity should be the subTreeRoot
+ QCOMPARE(spy.dirtyNodes.size(), 1);
+ const auto dirtyEntity = qobject_cast<Qt3DCore::QEntity*>(spy.dirtyNodes.takeFirst());
+ QVERIFY(dirtyEntity);
+ QCOMPARE(dirtyEntity, childEntity);
+ QCOMPARE(dirtyEntity->parent(), childNode);
+ QCOMPARE(dirtyEntity->parentEntity(), subTreeRoot);
}
void tst_Nodes::checkConstructionWithParent()