diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2012-09-13 14:35:42 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-14 14:51:47 +0200 |
commit | 08444bab1bf25e20837ea47b647a5b1216caa05c (patch) | |
tree | 65fc2e90bbf29f22a92deb322bd4a9de939e8e17 /tests/auto/quick | |
parent | 75b9cd92dc5291ce12d8d609c5d721246044ffa0 (diff) |
Autotests: Use qInstallMessageHandler
qInstallMsgHandler got deprecated in Qt 5.
Change-Id: Icb6423c7d9f7e507ba36376b0af5ad183379c494
Reviewed-by: Martin Jones <martin.r.jones@gmail.com>
Diffstat (limited to 'tests/auto/quick')
5 files changed, 18 insertions, 18 deletions
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index f9994a76bc..b9ebb15abb 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -50,11 +50,11 @@ #include <QQmlEngine> #include <QQmlError> -static QtMsgHandler testlibMsgHandler = 0; -void msgHandlerFilter(QtMsgType type, const char *msg) +static QtMessageHandler testlibMsgHandler = 0; +void msgHandlerFilter(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg) { if (type == QtCriticalMsg || type == QtFatalMsg) - (*testlibMsgHandler)(type, msg); + (*testlibMsgHandler)(type, ctxt, msg); } class tst_examples : public QObject @@ -129,13 +129,13 @@ tst_examples::~tst_examples() void tst_examples::init() { if (!qstrcmp(QTest::currentTestFunction(), "sgsnippets")) - testlibMsgHandler = qInstallMsgHandler(msgHandlerFilter); + testlibMsgHandler = qInstallMessageHandler(msgHandlerFilter); } void tst_examples::cleanup() { if (!qstrcmp(QTest::currentTestFunction(), "sgsnippets")) - qInstallMsgHandler(testlibMsgHandler); + qInstallMessageHandler(testlibMsgHandler); } /* diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index a8f92cbfa5..49ea9d03cf 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -662,9 +662,9 @@ void tst_qquickimage::sourceSize_QTBUG_16389() } static int numberOfWarnings = 0; -static void checkWarnings(QtMsgType, const char *msg) +static void checkWarnings(QtMsgType, const QMessageLogContext &, const QString &msg) { - if (!QString(msg).contains("QGLContext::makeCurrent(): Failed.")) + if (!msg.contains("QGLContext::makeCurrent(): Failed.")) numberOfWarnings++; } @@ -679,11 +679,11 @@ void tst_qquickimage::nullPixmapPaint() QTRY_VERIFY(image != 0); image->setSource(SERVER_ADDR + QString("/no-such-file.png")); - QtMsgHandler previousMsgHandler = qInstallMsgHandler(checkWarnings); + QtMessageHandler previousMsgHandler = qInstallMessageHandler(checkWarnings); // used to print "QTransform::translate with NaN called" QPixmap pm = QPixmap::fromImage(window->grabWindow()); - qInstallMsgHandler(previousMsgHandler); + qInstallMessageHandler(previousMsgHandler); QVERIFY(numberOfWarnings == 0); delete image; diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index c2bcd54c48..7c166c5795 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -259,7 +259,7 @@ private: } #endif - static void errorMsgHandler(QtMsgType, const char *) + static void errorMsgHandler(QtMsgType, const QMessageLogContext &, const QString &) { ++m_errorCount; } @@ -6784,7 +6784,7 @@ void tst_QQuickListView::parentBinding() QQuickView *window = createView(); m_errorCount = 0; - QtMsgHandler old = qInstallMsgHandler(errorMsgHandler); + QtMessageHandler old = qInstallMessageHandler(errorMsgHandler); window->setSource(testFileUrl("parentBinding.qml")); window->show(); @@ -6805,7 +6805,7 @@ void tst_QQuickListView::parentBinding() // there should be no transient binding error QVERIFY(!m_errorCount); - qInstallMsgHandler(old); + qInstallMessageHandler(old); delete window; } diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp index 32ec41bb13..247c0d58f8 100644 --- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp @@ -1724,7 +1724,7 @@ void tst_qquickpositioners::test_flow_implicit_resize() QString warningMessage; -void interceptWarnings(QtMsgType type, const char *msg) +void interceptWarnings(QtMsgType type, const QMessageLogContext &, const QString &msg) { Q_UNUSED( type ); warningMessage = msg; @@ -1732,7 +1732,7 @@ void interceptWarnings(QtMsgType type, const char *msg) void tst_qquickpositioners::test_conflictinganchors() { - QtMsgHandler oldMsgHandler = qInstallMsgHandler(interceptWarnings); + QtMessageHandler oldMsgHandler = qInstallMessageHandler(interceptWarnings); QQmlEngine engine; QQmlComponent component(&engine); @@ -1826,7 +1826,7 @@ void tst_qquickpositioners::test_conflictinganchors() item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function.")); - qInstallMsgHandler(oldMsgHandler); + qInstallMessageHandler(oldMsgHandler); delete item; } diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index 977b867705..aea3950f18 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -187,7 +187,7 @@ void tst_QQuickView::resizemodeitem() delete view; } -static void silentErrorsMsgHandler(QtMsgType, const char *) +static void silentErrorsMsgHandler(QtMsgType, const QMessageLogContext &, const QString &) { } @@ -195,9 +195,9 @@ void tst_QQuickView::errors() { QQuickView *view = new QQuickView; QVERIFY(view); - QtMsgHandler old = qInstallMsgHandler(silentErrorsMsgHandler); + QtMessageHandler old = qInstallMessageHandler(silentErrorsMsgHandler); view->setSource(testFileUrl("error1.qml")); - qInstallMsgHandler(old); + qInstallMessageHandler(old); QVERIFY(view->status() == QQuickView::Error); QVERIFY(view->errors().count() == 1); delete view; |