diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2015-01-22 16:36:54 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-01-28 11:47:02 +0000 |
commit | 1b9308fe6bf2a0bc0e6f9b807732d95bbca50e7d (patch) | |
tree | aa5f216e213f80e9c338c27703ad915d66f72a05 /tests | |
parent | 474ad03e4977116c12e7cd87c26295c8590b1f60 (diff) |
Cleanup entities component lists on destruction
Change-Id: I1e5f006b612a69e6b5cc98aecb6c8fdc3d6281b0
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/core/qaspectengine/tst_qaspectengine.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp index 8a6adc8b2..729df74b2 100644 --- a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp +++ b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include <Qt3DCore/qaspectengine.h> #include <Qt3DCore/qentity.h> +#include <Qt3DCore/qtransform.h> using namespace Qt3D; @@ -55,6 +56,7 @@ public: private slots: void constructionDestruction(); void setRootEntity(); + void shouldNotCrashOnShutdownWhenComponentIsCreatedWithParentBeforeItsEntity(); // TODO: Add more QAspectEngine tests }; @@ -83,6 +85,27 @@ void tst_QAspectEngine::setRootEntity() delete engine; } +void tst_QAspectEngine::shouldNotCrashOnShutdownWhenComponentIsCreatedWithParentBeforeItsEntity() +{ + // GIVEN + QEntity *root = new QEntity; + // A component parented to an entity... + QComponent *component = new Qt3D::QTransform(root); + // ... created *before* the entity it will be added to. + QEntity *entity = new QEntity(root); + entity->addComponent(component); + + // An initialized engine (so that the arbiter has been fed) + QAspectEngine engine; + engine.initialize(); + + // WHEN + engine.setRootEntity(root); + + // THEN + // Nothing particular happen on exit, especially no crash +} + QTEST_MAIN(tst_QAspectEngine) #include "tst_qaspectengine.moc" |