diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2012-12-18 11:41:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-20 21:38:38 +0100 |
commit | 5fd1c5fbaf13195fed16ca171f4eac81be125e2b (patch) | |
tree | ec6a445f2f0367f7a5298274950750ad56e23c68 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | |
parent | 920b949e5185258baabfb3f738b660b3c0f002e3 (diff) |
Quick tests: Introduce QQmlMessageHandler.
Add QQmlMessageHandler class that can be used to record messages
into a QStringList. It also makes sure that the old message
handler is reinstalled if the test fails.
Task-number: QTBUG-28611
Change-Id: I0fff7bc11e188cf47178d9573e5f2eead693bc10
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index af628dff63..51ce74ef40 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -259,18 +259,10 @@ private: } #endif - static void errorMsgHandler(QtMsgType, const QMessageLogContext &, const QString &) - { - ++m_errorCount; - } - QQuickView *m_view; QString testForView; - static int m_errorCount; }; -int tst_QQuickListView::m_errorCount = 0; - class TestObject : public QObject { Q_OBJECT @@ -6785,8 +6777,7 @@ void tst_QQuickListView::parentBinding() { QQuickView *window = createView(); - m_errorCount = 0; - QtMessageHandler old = qInstallMessageHandler(errorMsgHandler); + QQmlTestMessageHandler messageHandler; window->setSource(testFileUrl("parentBinding.qml")); window->show(); @@ -6805,9 +6796,7 @@ void tst_QQuickListView::parentBinding() QCOMPARE(item->height(), listview->height()/12); // there should be no transient binding error - QVERIFY(!m_errorCount); - - qInstallMessageHandler(old); + QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); delete window; } |