diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-10-07 05:42:53 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-10-07 05:42:53 (GMT) |
commit | 8b0cac9179de4d1cb34b9f17932d34cef3cd4f5b (patch) | |
tree | a99c2054c967322293e720ed9a4bcd99f35781b2 | |
parent | 07b3465405ccd59dc5c447cffc47cc1a17f674f0 (diff) | |
download | Qt-8b0cac9179de4d1cb34b9f17932d34cef3cd4f5b.zip Qt-8b0cac9179de4d1cb34b9f17932d34cef3cd4f5b.tar.gz Qt-8b0cac9179de4d1cb34b9f17932d34cef3cd4f5b.tar.bz2 |
Get two of those new autotests to pass.
The third will not pass until QT-2240 is fixed.
4 files changed, 19 insertions, 21 deletions
diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml index 58ca26e..b26d6e1 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml +++ b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml @@ -1,5 +1,5 @@ -import Qt.Test 1.0 +import Qt.test 1.0 MyQmlObject{ - objectName: "desolateObject" + objectName: "objectTwo" } diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml index f3eb75f..ef39590 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml +++ b/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml @@ -5,7 +5,7 @@ MyQmlObject{ objectName: "obj" function createOne() { - obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"emptyObject"}', obj); + obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"objectOne"}', obj); } function createTwo() diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml index 618723f..ba87b32 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml +++ b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml @@ -8,13 +8,13 @@ MyQmlObject{ obj.objectProperty = createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"emptyObject"}', obj); } - function killIt(wait) + function killOther() { - if(obj.objectProperty == undefined || obj.objectProperty == null) - return; - if(wait > 0) - obj.objectProperty.destroy(wait); - else - obj.objectProperty.destroy(); + obj.objectProperty.destroy(100); + } + + function killMe() + { + obj.destroy();//Must not segfault } } diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 778b37f..3f01192 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -550,12 +550,12 @@ void tst_qmlecmascript::dynamicCreation() QMetaObject::invokeMethod(object, "createOne"); createdQmlObject = object->objectProperty(); QVERIFY(createdQmlObject); - QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); + QCOMPARE(createdQmlObject->objectName(), QString("objectOne")); QMetaObject::invokeMethod(object, "createTwo"); createdComponent = object->objectProperty(); QVERIFY(createdComponent); - QCOMPARE(createdQmlObject->objectName(), QString("desolateObject")); + QCOMPARE(createdComponent->objectName(), QString("objectTwo")); } /* @@ -564,7 +564,7 @@ void tst_qmlecmascript::dynamicCreation() void tst_qmlecmascript::dynamicDestruction() { QmlComponent component(&engine, TEST_FILE("dynamicDeletion.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QGuard<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create()); QVERIFY(object != 0); QGuard<QObject> createdQmlObject = 0; @@ -573,19 +573,17 @@ void tst_qmlecmascript::dynamicDestruction() QVERIFY(createdQmlObject); QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); - QMetaObject::invokeMethod(object, "killIt", Q_ARG(int, 0)); - QVERIFY(createdQmlObject); - QTest::qWait(0); - QVERIFY(!createdQmlObject); - - QMetaObject::invokeMethod(object, "create"); - QVERIFY(createdQmlObject); - QMetaObject::invokeMethod(object, "killIt", Q_ARG(int, 100)); + QMetaObject::invokeMethod(object, "killOther"); QVERIFY(createdQmlObject); QTest::qWait(0); QVERIFY(createdQmlObject); QTest::qWait(100); QVERIFY(!createdQmlObject); + + QMetaObject::invokeMethod(object, "killMe"); + QVERIFY(object); + QTest::qWait(0); + QVERIFY(!object); } /* |