summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2011-11-08 10:45:18 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-08 17:20:39 +0100
commit124044613dde9a9596312102ca377bc74ed08165 (patch)
tree8407d0d8676ab32c67bda2f6878d6f3884eec7fc /tests/auto/corelib
parenta4f446704e7e02e25c02edb9d316513a482bae9a (diff)
QGlobal: Define a default message handler
Currently, qInstallMsgHandler() does not return the handle to the default message handler. This patch defines a default message handler. This is returned by qInstallMsgHandler() when called for the first time. A call to qInstallMsgHandler(0) will restore the default message handler as was the case previously. Change-Id: I42f06654d45fb0e633f3c6d912fc8f05c23249aa Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 772fd9fd04..f33a7eef5a 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -54,6 +54,7 @@ private slots:
void debugWithQBool() const;
void veryLongWarningMessage() const;
void qDebugQStringRef() const;
+ void defaultMessagehandler() const;
};
void tst_QDebug::assignment() const
@@ -154,5 +155,16 @@ void tst_QDebug::qDebugQStringRef() const
}
}
+void tst_QDebug::defaultMessagehandler() const
+{
+ QtMsgHandler defaultMessageHandler1 = qInstallMsgHandler(0);
+ QtMsgHandler defaultMessageHandler2 = qInstallMsgHandler(myMessageHandler);
+ bool same = (*defaultMessageHandler1 == *defaultMessageHandler2);
+ QVERIFY(same);
+ QtMsgHandler messageHandler = qInstallMsgHandler(0);
+ same = (*messageHandler == *myMessageHandler);
+ QVERIFY(same);
+}
+
QTEST_MAIN(tst_QDebug);
#include "tst_qdebug.moc"