From 0ccd69cd51c7e067fbb26f6c47270c03f5c0568c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 29 Oct 2009 18:09:38 +1000 Subject: Testcase for warnings at shutdown --- .../declarative/qmlecmascript/data/shutdownErrors.qml | 13 +++++++++++++ .../declarative/qmlecmascript/tst_qmlecmascript.cpp | 17 +++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/shutdownErrors.qml diff --git a/tests/auto/declarative/qmlecmascript/data/shutdownErrors.qml b/tests/auto/declarative/qmlecmascript/data/shutdownErrors.qml new file mode 100644 index 0000000..398489a --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/shutdownErrors.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +Item { + property int test: myObject.object.a + + Item { + id: myObject + property Object object; + object: Object { + property int a: 10 + } + } +} diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 48c2249..98e9daf 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -67,6 +67,7 @@ private slots: void listProperties(); void exceptionClearsOnReeval(); void transientErrors(); + void shutdownErrors(); private: QmlEngine engine; @@ -870,6 +871,22 @@ void tst_qmlecmascript::transientErrors() QCOMPARE(transientErrorsMsgCount, 0); } +// Check that errors during shutdown are minimized +void tst_qmlecmascript::shutdownErrors() +{ + QmlComponent component(&engine, TEST_FILE("shutdownErrors.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + delete object; + + qInstallMsgHandler(old); + QCOMPARE(transientErrorsMsgCount, 0); +} + QTEST_MAIN(tst_qmlecmascript) #include "tst_qmlecmascript.moc" -- cgit v0.12