qt5base-lts/tests/auto
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
..
bic Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
compilerwarnings/data Remove uilib and QtUiTools from QtBase 2011-09-13 20:11:40 +02:00
corelib Prevent qDebug test bypassing the testlib message handler. 2011-12-30 04:14:53 +01:00
dbus Fix crashes and non-portable functionality in QDBusDemarshaller QByteArray extraction 2011-12-25 21:58:57 +01:00
gui Fix printerPaperSize and some tst_qprinter test failures 2011-12-29 13:18:20 +01:00
guiapplauncher Update the documentation after moving examples. 2011-07-05 21:19:08 +02:00
network Remove mention of Trolltech in QHttp autotest. 2011-12-28 02:56:02 +01:00
opengl Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
other Accessibility: childAt returns interface 2011-12-19 12:27:45 +01:00
sql Check driver validity before using it 2011-12-12 10:43:44 +01:00
testlib QTestLib-selftest: Unblock on Windows. 2011-12-22 15:11:32 +01:00
tools Revert "Revert "Add QObject::objectNameChanged(con... signal"" 2011-12-20 11:15:21 +01:00
v8 qtbase tests: Fix some warnings 2011-11-21 09:58:23 +01:00
widgets Remove mention of Trolltech from QGraphicsScene autotest. 2011-12-28 04:48:01 +01:00
xml Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
auto.pro Re-enable 'check' target for tests/auto/gui on Mac OS X 2011-12-09 02:39:06 +01:00
network-settings.h Fix sanity check of network test server 2011-11-28 08:13:41 +01:00
platformquirks.h Remove unused PlatformQuirks functions. 2011-11-05 02:31:07 +01:00
test.pl Update licenseheader text in source files for qtbase Qt module 2011-05-24 12:34:08 +03:00