Remove printf calls from warnings selftest

The warnings selftest verifies that qtestlib correctly handles output
sent via qDebug() and friends.  The test had a number of printf calls
that were used to tell the user what output they should expect to see
next, but by bypassing testlib's logging, these made the testlog differ
depending on whether the test log was directed to the console or a file.

The printf calls are no longer needed, as any regressions in qDebug will
be detected by tst_selftests, which compares the output of the warnings
test with a reference copy of the expected output.

Change-Id: I8c3a3237463141fa494c50ca02062760cb583090
Reviewed-on: http://codereview.qt-project.org/5200
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2011-09-20 17:19:26 +10:00 committed by Qt by Nokia
parent 1363d5b9eb
commit 1fcc6ba3d9
2 changed files with 1 additions and 18 deletions

View File

@ -1,18 +1,10 @@
********* Start testing of tst_Warnings *********
Config: Using QTest library 4.1.0, Qt 4.1.0
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : tst_Warnings::initTestCase()
testWarnings 1: next line prints "Warning"
QWARN : tst_Warnings::testWarnings() Warning
testWarnings 2: next line prints nothing
testWarnings 3: next line prints "Warning"
QWARN : tst_Warnings::testWarnings() Warning
testWarnings 4: over
testWarnings 5: next line prints "Debug"
QDEBUG : tst_Warnings::testWarnings() Debug
testWarnings 6: next line prints nothing
testWarnings 7: next line prints "Debug"
QDEBUG : tst_Warnings::testWarnings() Debug
testWarnings 8: next comes "Baba" twice
QDEBUG : tst_Warnings::testWarnings() Baba
QDEBUG : tst_Warnings::testWarnings() Baba
PASS : tst_Warnings::testWarnings()

View File

@ -53,33 +53,24 @@ private slots:
void tst_Warnings::testWarnings()
{
printf("testWarnings 1: next line prints \"Warning\"\n");
qWarning("Warning");
printf("testWarnings 2: next line prints nothing\n");
QTest::ignoreMessage(QtWarningMsg, "Warning");
qWarning("Warning");
printf("testWarnings 3: next line prints \"Warning\"\n");
qWarning("Warning");
printf("testWarnings 4: over\n");
printf("testWarnings 5: next line prints \"Debug\"\n");
qDebug("Debug");
printf("testWarnings 6: next line prints nothing\n");
QTest::ignoreMessage(QtDebugMsg, "Debug");
qDebug("Debug");
printf("testWarnings 7: next line prints \"Debug\"\n");
qDebug("Debug");
printf("testWarnings 8: next comes \"Baba\" twice\n");
QTest::ignoreMessage(QtDebugMsg, "Bubu");
qDebug("Baba");
qDebug("Bubu");
qDebug("Baba");
}
void tst_Warnings::testMissingWarnings()