diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-28 05:21:36 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-28 05:21:36 (GMT) |
commit | 57d2291b2e0533d23bd52e9814faf6a5727a4e96 (patch) | |
tree | 5c045bfdd7fed1df3449ff7f8bda824e1a20a91a /tests/auto/declarative/qmlecmascript | |
parent | d42846123ec17641d1e8a8082fab0d04ce93e8a1 (diff) | |
download | Qt-57d2291b2e0533d23bd52e9814faf6a5727a4e96.zip Qt-57d2291b2e0533d23bd52e9814faf6a5727a4e96.tar.gz Qt-57d2291b2e0533d23bd52e9814faf6a5727a4e96.tar.bz2 |
Test for QT-2373
Ensure that transient binding errors are not displayed.
Diffstat (limited to 'tests/auto/declarative/qmlecmascript')
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlecmascript/data/NestedTypeTransientErrors.qml b/tests/auto/declarative/qmlecmascript/data/NestedTypeTransientErrors.qml new file mode 100644 index 0000000..e19bf24 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/NestedTypeTransientErrors.qml @@ -0,0 +1,11 @@ +import Qt 4.6 + +Object { + property int b: obj.prop.a + + property var prop; + prop: Object { + property int a: 10 + } +} + diff --git a/tests/auto/declarative/qmlecmascript/data/transientErrors.qml b/tests/auto/declarative/qmlecmascript/data/transientErrors.qml new file mode 100644 index 0000000..4e123c6 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/transientErrors.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Object { + property var obj: nested + + property var obj2 + obj2: NestedTypeTransientErrors { + id: nested + } +} diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 67a98b1..48c2249 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -66,6 +66,7 @@ private slots: void signalTriggeredBindings(); void listProperties(); void exceptionClearsOnReeval(); + void transientErrors(); private: QmlEngine engine; @@ -847,6 +848,28 @@ void tst_qmlecmascript::exceptionClearsOnReeval() QCOMPARE(object->property("test").toBool(), true); } +static int transientErrorsMsgCount = 0; +static void transientErrorsMsgHandler(QtMsgType, const char *) +{ + ++transientErrorsMsgCount; +} + +// Check that transient binding errors are not displayed +void tst_qmlecmascript::transientErrors() +{ + QmlComponent component(&engine, TEST_FILE("transientErrors.qml")); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + QObject *object = component.create(); + QVERIFY(object != 0); + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); +} + QTEST_MAIN(tst_qmlecmascript) #include "tst_qmlecmascript.moc" |