qt5base-lts/tests/auto/corelib/io
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
..
qabstractfileengine Windows: Fix qabstractfilenengine-test. 2011-12-01 22:37:31 +01:00
qbuffer Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
qdatastream Retire QTest::pixmapsAreEqual(). 2011-12-20 06:17:42 +01:00
qdebug Prevent qDebug test bypassing the testlib message handler. 2011-12-30 04:14:53 +01:00
qdir Fix QDir::removeRecursively so it doesn't follow symlinks to directories. 2011-12-19 20:48:16 +01:00
qdiriterator Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
qfile Cleanup corelib autotests. 2011-12-28 04:48:11 +01:00
qfileinfo Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
qfilesystementry Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
qfilesystemwatcher Change test to use new QTRY_COMPARE/QTRY_VERIFY macros. 2011-12-30 00:18:24 +01:00
qiodevice Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
qprocess Cleanup corelib autotests. 2011-12-28 04:48:11 +01:00
qprocessenvironment Don't depend on moc to disable test functions. 2011-11-18 01:51:57 +01:00
qresourceengine Update .gitignore for tests/auto/corelib/io/qresourceengine 2011-12-12 12:51:02 +01:00
qsettings Improve QSettings autotest 2011-12-25 20:19:46 +01:00
qstandardpaths Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
qtemporarydir Fixes for tst_QTemporary(File|Dir)::nonWritableCurrentDir 2011-12-09 14:15:37 +01:00
qtemporaryfile Fixes for tst_QTemporary(File|Dir)::nonWritableCurrentDir 2011-12-09 14:15:37 +01:00
qtextstream Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
qurl Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
io.pro New class QTemporaryDir. 2011-12-02 21:04:34 +01:00