diff options
author | Mike Krus <mike.krus@kdab.com> | 2019-12-10 09:38:00 +0000 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-01-13 16:34:16 +0000 |
commit | 65ed4fa2ff95b54eacd82a7fb91f213464796756 (patch) | |
tree | 9273720e8d16e87e001664cb5ef7ba6d03e2489a /tests/auto/core | |
parent | f1eff5648d9cb40216b04b78f9b2b5a34fb5ce62 (diff) |
Use animation rather than event to drive simulation
Using events can be problematic as they contribute to flooding
of the event queue leading to issues with running animations.
So we now use an actual animation which runs in a loop and triggers
every 1ms (rendering still vsync locked though).
If animation have not been enabled for the qt build, we fall back
to using events as before.
Tests were changes since frame progress is no longer driven by
events, so processEvents does not trigger a frame update.
Change-Id: I89b11862ef432dffae0c3dfb140eedd61754697e
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests/auto/core')
-rw-r--r-- | tests/auto/core/nodes/tst_nodes.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp index b5291cab7..43d9f7778 100644 --- a/tests/auto/core/nodes/tst_nodes.cpp +++ b/tests/auto/core/nodes/tst_nodes.cpp @@ -944,6 +944,7 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() // GIVEN ObserverSpy spy; Qt3DCore::QAspectEngine engine; + engine.setRunMode(Qt3DCore::QAspectEngine::Manual); QScopedPointer<MyQEntity> root(new MyQEntity()); root->setArbiterAndEngine(&spy, &engine); auto aspect = new TestAspect; @@ -953,6 +954,7 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() MyQNode *child2(new MyQNode(root.data())); QCoreApplication::processEvents(); + engine.processFrame(); // Due to the way we create root, it has a backend QVERIFY(Qt3DCore::QNodePrivate::get(root.data())->m_hasBackendNode == true); @@ -983,6 +985,7 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() // WHEN QCoreApplication::processEvents(); + engine.processFrame(); // THEN QCOMPARE(spy.events.size(), 2); @@ -1059,6 +1062,7 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() // WHEN QCoreApplication::processEvents(); + engine.processFrame(); // THEN QCOMPARE(spy.events.size(), 2); @@ -1237,6 +1241,7 @@ void tst_Nodes::checkAllBackendCreationDoneInSingleFrame() // GIVEN ObserverSpy spy; Qt3DCore::QAspectEngine engine; + engine.setRunMode(Qt3DCore::QAspectEngine::Manual); auto aspect = new TestAspect; engine.registerAspect(aspect); @@ -1269,6 +1274,7 @@ void tst_Nodes::checkAllBackendCreationDoneInSingleFrame() // WHEN QCoreApplication::processEvents(); + engine.processFrame(); // THEN - both children have their backend nodes actually created. QCOMPARE(aspect->events.count(), 2); |