diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-05-16 09:20:43 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-05-22 16:13:12 +0200 |
commit | 0570d73b615983b861eedcfced755d20114d1bc0 (patch) | |
tree | e1829639f11efa8cb092bb2d5df645bf11e662e5 /tests/auto/core/nodes/tst_nodes.cpp | |
parent | c5395497a72805bd4dd9f092f52cc9bfebeb922b (diff) |
Eradicate Q_FOREACH loops and mark the module clean
The only noteworth change is where a loop around spy.events modified
the container using takeFirst(). There was no reason to do so, so it
was changed to use the loop variable instead of the result of taking.
Change-Id: I02c62a7c2efc5d042c6e669fe5daddd7da7e85d2
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto/core/nodes/tst_nodes.cpp')
-rw-r--r-- | tests/auto/core/nodes/tst_nodes.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp index dad66c5d5..d8ffbc361 100644 --- a/tests/auto/core/nodes/tst_nodes.cpp +++ b/tests/auto/core/nodes/tst_nodes.cpp @@ -1054,23 +1054,22 @@ void tst_Nodes::removingMultipleChildNodesFromNode() // WHEN spy.events.clear(); - Q_FOREACH (QObject *c, root->children()) - delete c; + qDeleteAll(root->children()); // THEN QVERIFY(root->children().count() == 0); QCOMPARE(spy.events.size(), 20); int i = 0; - Q_FOREACH (const ObserverSpy::ChangeRecord &r, spy.events) { + for (const ObserverSpy::ChangeRecord &r : qAsConst(spy.events)) { QVERIFY(r.wasLocked()); const Qt3DCore::QNodeId childId = childIds.at(i / 2); if (i % 2 == 0) { - Qt3DCore::QPropertyNodeRemovedChangePtr additionEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeRemovedChange>(); + Qt3DCore::QPropertyNodeRemovedChangePtr additionEvent = r.change().dynamicCast<Qt3DCore::QPropertyNodeRemovedChange>(); QCOMPARE(additionEvent->subjectId(), root->id()); QCOMPARE(additionEvent->removedNodeId(), childId); QCOMPARE(additionEvent->metaObject(), &MyQNode::staticMetaObject); } else { - const Qt3DCore::QNodeDestroyedChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>(); + const Qt3DCore::QNodeDestroyedChangePtr event = r.change().dynamicCast<Qt3DCore::QNodeDestroyedChange>(); QCOMPARE(event->subjectId(), childId); QCOMPARE(event->subtreeIdsAndTypes().count(), 1); QCOMPARE(event->subtreeIdsAndTypes().first().id, childId); |