diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-04-28 11:56:04 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2016-04-29 16:22:28 +0000 |
commit | f40de11aa8d4d43bffdf2541f6935e06e0b38ad3 (patch) | |
tree | a07f607dfc16162334b5c6cffd57c93bb10aff3c /tests/auto/render/qmaterial | |
parent | 948d0357850918596b56f38a6dc6e25cd186f5a0 (diff) |
QNodeCreation overhaul
When a node has its parent set from NULL to some valid parent
it sends a QNodeCreatedChange. The new parent also subsequently receives a
QNodeAddedChange telling him that a child was added to its children property.
When a node with a valid parent changes parent to another valid parent, it
sends a QNodeRemovedChange to the old parent and a QNodeAddedChange to the new parent.
When a node with a valid parent has its parent set to NULL, it first sends a
QNodeRemovedChange to the old parent followed by a QNodeDestroyed change.
When a node is destroyed, prior to destruction it sets its parent to NULL,
which sends notifications as explained above.
Change-Id: Id99727542367797577c2bbb108580dfca902e776
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests/auto/render/qmaterial')
-rw-r--r-- | tests/auto/render/qmaterial/tst_qmaterial.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/render/qmaterial/tst_qmaterial.cpp b/tests/auto/render/qmaterial/tst_qmaterial.cpp index 638f774e3..86556fd36 100644 --- a/tests/auto/render/qmaterial/tst_qmaterial.cpp +++ b/tests/auto/render/qmaterial/tst_qmaterial.cpp @@ -81,6 +81,7 @@ public: tst_QMaterial() : QObject() { + qRegisterMetaType<Qt3DCore::QNode*>(); qRegisterMetaType<Qt3DRender::QEffect*>("Qt3DRender::QEffect*"); } @@ -266,11 +267,16 @@ private Q_SLOTS: QScopedPointer<TestMaterial> material2(new TestMaterial()); TestArbiter arbiter2(material2.data()); + QCoreApplication::processEvents(); + // Clear events trigger by child generation of TestMnterial + arbiter2.events.clear(); + // WHEN material2->setEffect(&effect); QCoreApplication::processEvents(); // THEN + qDebug() << Q_FUNC_INFO << arbiter2.events.size(); QCOMPARE(arbiter2.events.size(), 1); change = arbiter2.events.first().staticCast<Qt3DCore::QNodePropertyChange>(); QCOMPARE(change->propertyName(), "effect"); @@ -284,6 +290,10 @@ private Q_SLOTS: TestMaterial *material = new TestMaterial(); TestArbiter arbiter(material); + QCoreApplication::processEvents(); + // Clear events trigger by child generation of TestMnterial + arbiter.events.clear(); + // WHEN (add parameter to material) Qt3DRender::QParameter *param = new Qt3DRender::QParameter("testParamMaterial", QVariant::fromValue(383.0f)); material->addParameter(param); @@ -347,6 +357,10 @@ private Q_SLOTS: TestMaterial *material = new TestMaterial(); TestArbiter arbiter(material); + QCoreApplication::processEvents(); + // Clear events trigger by child generation of TestMnterial + arbiter.events.clear(); + // WHEN const QByteArray vertexCode = QByteArrayLiteral("new vertex shader code"); material->m_shaderProgram->setVertexShaderCode(vertexCode); |