diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-07 13:33:32 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-08 03:25:50 (GMT) |
commit | 60a5afb67efcefa74cf452379dcef46b83daa265 (patch) | |
tree | 322711feaaad46c8c1945e6fab99f2b5ba805f4d /tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | |
parent | d07270161ef3d1c4b3ed29110a16eaff54333fd5 (diff) | |
download | Qt-60a5afb67efcefa74cf452379dcef46b83daa265.zip Qt-60a5afb67efcefa74cf452379dcef46b83daa265.tar.gz Qt-60a5afb67efcefa74cf452379dcef46b83daa265.tar.bz2 |
Self deleting binding test
Diffstat (limited to 'tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp')
-rw-r--r-- | tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 51f1ce7..6bc88c0 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -59,6 +59,7 @@ private slots: void dynamicCreation(); void dynamicDestruction(); void objectToString(); + void selfDeletingBinding(); private: QmlEngine engine; @@ -686,6 +687,28 @@ void tst_qmlecmascript::objectToString() QVERIFY(object->stringProperty().endsWith(", \"objName\")")); } +/* +Tests bindings that indirectly cause their own deletion work. + +This test is best run under valgrind to ensure no invalid memory access occur. +*/ +void tst_qmlecmascript::selfDeletingBinding() +{ + { + QmlComponent component(&engine, TEST_FILE("selfDeletingBinding.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + object->setProperty("triggerDelete", true); + } + + { + QmlComponent component(&engine, TEST_FILE("selfDeletingBinding.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + object->setProperty("triggerDelete", true); + } +} + QTEST_MAIN(tst_qmlecmascript) #include "tst_qmlecmascript.moc" |