qt5base-lts/tests/auto/corelib
Jason McDonald 14e139f391 Prevent qDebug test bypassing the testlib message handler.
Several of the test functions in the QDebug autotest call
qInstallMsgHandler() to temporarily use a custom message handler.
Unfortunately, these test functions were then resetting the message
handler back to Qt's default handler at the end of the test.

QTestLib also calls qInstallMsgHandler() to set a message handler that
redirects debug/warning/fatal messages into the test log.  When the test
resets the message handler back to Qt's default handler, testlib's
message handler is bypassed for the rest of the test, preventing any
subsequent debug/warning/fatal messages from being visible in the test
log or subject to testlib's ignoreMessage() function.

This error also caused several of the test functions to fail if they
were run manually.  The "defaultMessagehandler" test would fail if it
was run before any other test function and the "assignment" test would
fail if it was run after any other test function.

This commit fixes these failures by using a helper class to ensure that
the previously active message handler is restored at the end of each
test function, even if the test function fails or throws an exception.

Change-Id: I51376724d164c8ad126e5b9be76890bf3e6a9fb0
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-30 04:14:53 +01:00
..
animation Avoid repeatedly registering the same meta-type 2011-12-28 08:16:47 +01:00
codecs Improve QTextCodec::codecForLocale() test. 2011-12-29 13:27:17 +01:00
concurrent Use QVERIFY2 to output verbose failure messages. 2011-12-30 02:07:50 +01:00
global Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
io Prevent qDebug test bypassing the testlib message handler. 2011-12-30 04:14:53 +01:00
itemmodels Cleanup itemmodel autotests. 2011-12-28 06:34:02 +01:00
kernel Cleanup corelib autotests. 2011-12-28 04:48:11 +01:00
plugin Cleanup corelib autotests. 2011-12-28 04:48:11 +01:00
statemachine Cleanup corelib autotests. 2011-12-28 04:48:11 +01:00
thread Remove mention of trolltech from QThreadStorage test. 2011-12-28 02:56:08 +01:00
tools Cleanup corelib autotests. 2011-12-28 04:48:11 +01:00
xml Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
corelib.pro Move QAbstractItemModel into a separate directory. 2011-12-13 02:23:42 +01:00