summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-15 06:35:51 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-15 06:35:51 (GMT)
commit30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c (patch)
treebb480e0a908016f24a4e57755b2265ebf5b5ea16 /tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
parent6362d17d5551749618f5975e050c54fca31c408f (diff)
downloadQt-30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c.zip
Qt-30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c.tar.gz
Qt-30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c.tar.bz2
Add Component.onDestruction attached property
This property complements Component.onCompleted. It is emitted before the destruction actually begins (for the most part) so the objects are still alive and accessible. The QtObject.onDestroyed signal is now blocked as it never really worked properly anyway.
Diffstat (limited to 'tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 7c327c2..8feab32 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -113,6 +113,7 @@ private slots:
void i18n();
void i18n_data();
void onCompleted();
+ void onDestruction();
void scriptString();
void defaultPropertyListOrder();
void declaredPropertyValues();
@@ -329,6 +330,7 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false;
QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false;
QTest::newRow("enumTypes") << "enumTypes.qml" << "enumTypes.errors.txt" << false;
+ QTest::newRow("destroyedSignal") << "destroyedSignal.qml" << "destroyedSignal.errors.txt" << false;
}
@@ -1049,6 +1051,20 @@ void tst_qdeclarativelanguage::onCompleted()
QVERIFY(object != 0);
}
+// Check that the Component::onDestruction attached property works
+void tst_qdeclarativelanguage::onDestruction()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("onDestruction.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10");
+ QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10");
+ QTest::ignoreMessage(QtDebugMsg, "Destruction 10 11");
+ delete object;
+}
+
// Check that assignments to QDeclarativeScriptString properties work
void tst_qdeclarativelanguage::scriptString()
{