diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-22 05:01:02 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-27 01:56:45 (GMT) |
commit | ddc7fcee9c3602bcbb79a6b8538315a633fa3db4 (patch) | |
tree | 90b7669402ff1e4d2e8bbe9e98762f772a53fdba /tests/auto/declarative/qdeclarativeecmascript | |
parent | 46cf45c5c9dc74bf2cbe42c8a57be194ea9cf8cd (diff) | |
download | Qt-ddc7fcee9c3602bcbb79a6b8538315a633fa3db4.zip Qt-ddc7fcee9c3602bcbb79a6b8538315a633fa3db4.tar.gz Qt-ddc7fcee9c3602bcbb79a6b8538315a633fa3db4.tar.bz2 |
Autotests
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 20 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml new file mode 100644 index 0000000..9c46c3f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml @@ -0,0 +1,10 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyDeferredObject { + value: undefined // error is resolved before complete + objectProperty: undefined // immediate error + objectProperty2: QtObject { + Component.onCompleted: value = 10 + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 97fced4..d0a2f7c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -89,6 +89,7 @@ private slots: void contextPropertiesTriggerReeval(); void objectPropertiesTriggerReeval(); void deferredProperties(); + void deferredPropertiesErrors(); void extensionObjects(); void overrideExtensionProperties(); void attachedProperties(); @@ -543,6 +544,25 @@ void tst_qdeclarativeecmascript::deferredProperties() QCOMPARE(qmlObject->value(), 19); } +// Check errors on deferred properties are correctly emitted +void tst_qdeclarativeecmascript::deferredPropertiesErrors() +{ + QDeclarativeComponent component(&engine, TEST_FILE("deferredPropertiesErrors.qml")); + MyDeferredObject *object = + qobject_cast<MyDeferredObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->value(), 0); + QVERIFY(object->objectProperty() == 0); + QVERIFY(object->objectProperty2() == 0); + + QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QObject*"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); + + qmlExecuteDeferred(object); + + delete object; +} + void tst_qdeclarativeecmascript::extensionObjects() { QDeclarativeComponent component(&engine, TEST_FILE("extensionObjects.qml")); |