Make QTest::qWarn() use __FILE__ and __LINE__.
This change makes QTest::qWarn() consistent with similar testlib functions, which take __FILE__ and __LINE__. Change-Id: I12977cb30672899ab38877b4a656f0cc0c7ea02c Reviewed-on: http://codereview.qt-project.org/3559 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
24b99f819c
commit
cb57d36f45
@ -1963,9 +1963,9 @@ bool QTest::qExpectFail(const char *dataIndex, const char *comment,
|
|||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
*/
|
*/
|
||||||
void QTest::qWarn(const char *message)
|
void QTest::qWarn(const char *message, const char *file, int line)
|
||||||
{
|
{
|
||||||
QTestLog::warn(message);
|
QTestLog::warn(message, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -109,7 +109,7 @@ do {\
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define QWARN(msg)\
|
#define QWARN(msg)\
|
||||||
QTest::qWarn(msg)
|
QTest::qWarn(msg, __FILE__, __LINE__)
|
||||||
|
|
||||||
class QObject;
|
class QObject;
|
||||||
class QTestData;
|
class QTestData;
|
||||||
@ -139,7 +139,7 @@ namespace QTest
|
|||||||
Q_TESTLIB_EXPORT void qSkip(const char *message, SkipMode mode, const char *file, int line);
|
Q_TESTLIB_EXPORT void qSkip(const char *message, SkipMode mode, const char *file, int line);
|
||||||
Q_TESTLIB_EXPORT bool qExpectFail(const char *dataIndex, const char *comment, TestFailMode mode,
|
Q_TESTLIB_EXPORT bool qExpectFail(const char *dataIndex, const char *comment, TestFailMode mode,
|
||||||
const char *file, int line);
|
const char *file, int line);
|
||||||
Q_TESTLIB_EXPORT void qWarn(const char *message);
|
Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = 0, int line = 0);
|
||||||
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message);
|
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message);
|
||||||
|
|
||||||
Q_TESTLIB_EXPORT void *qData(const char *tagName, int typeId);
|
Q_TESTLIB_EXPORT void *qData(const char *tagName, int typeId);
|
||||||
|
@ -385,12 +385,12 @@ bool QTestLog::loggerUsingStdout()
|
|||||||
return QTest::loggerUsingStdout;
|
return QTest::loggerUsingStdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLog::warn(const char *msg)
|
void QTestLog::warn(const char *msg, const char *file, int line)
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(msg);
|
QTEST_ASSERT(msg);
|
||||||
|
|
||||||
if (QTest::TestLoggers::loggerCount() > 0)
|
if (QTest::TestLoggers::loggerCount() > 0)
|
||||||
QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, msg);
|
QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, msg, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLog::info(const char *msg, const char *file, int line)
|
void QTestLog::info(const char *msg, const char *file, int line)
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
static int unhandledIgnoreMessages();
|
static int unhandledIgnoreMessages();
|
||||||
static void printUnhandledIgnoreMessages();
|
static void printUnhandledIgnoreMessages();
|
||||||
|
|
||||||
static void warn(const char *msg);
|
static void warn(const char *msg, const char *file, int line);
|
||||||
static void info(const char *msg, const char *file, int line);
|
static void info(const char *msg, const char *file, int line);
|
||||||
|
|
||||||
static void startLogging();
|
static void startLogging();
|
||||||
|
@ -2,24 +2,25 @@
|
|||||||
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
|
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
|
||||||
PASS : tst_Xunit::initTestCase()
|
PASS : tst_Xunit::initTestCase()
|
||||||
WARNING: tst_Xunit::testFunc1() just a QWARN() !
|
WARNING: tst_Xunit::testFunc1() just a QWARN() !
|
||||||
|
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(67)]
|
||||||
PASS : tst_Xunit::testFunc1()
|
PASS : tst_Xunit::testFunc1()
|
||||||
QDEBUG : tst_Xunit::testFunc2() a qDebug() call with comment-ending stuff -->
|
QDEBUG : tst_Xunit::testFunc2() a qDebug() call with comment-ending stuff -->
|
||||||
FAIL! : tst_Xunit::testFunc2() Compared values are not the same
|
FAIL! : tst_Xunit::testFunc2() Compared values are not the same
|
||||||
Actual (2): 2
|
Actual (2): 2
|
||||||
Expected (3): 3
|
Expected (3): 3
|
||||||
Loc: [/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp(74)]
|
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(74)]
|
||||||
SKIP : tst_Xunit::testFunc3() skipping this function!
|
SKIP : tst_Xunit::testFunc3() skipping this function!
|
||||||
Loc: [/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp(79)]
|
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(79)]
|
||||||
FAIL! : tst_Xunit::testFunc4() a forced failure!
|
FAIL! : tst_Xunit::testFunc4() a forced failure!
|
||||||
Loc: [/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp(84)]
|
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(84)]
|
||||||
XFAIL : tst_Xunit::testFunc5() this failure is expected
|
XFAIL : tst_Xunit::testFunc5() this failure is expected
|
||||||
Loc: [/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp(98)]
|
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(98)]
|
||||||
PASS : tst_Xunit::testFunc5()
|
PASS : tst_Xunit::testFunc5()
|
||||||
XFAIL : tst_Xunit::testFunc6() this failure is also expected
|
XFAIL : tst_Xunit::testFunc6() this failure is also expected
|
||||||
Loc: [/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp(104)]
|
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(104)]
|
||||||
PASS : tst_Xunit::testFunc6()
|
PASS : tst_Xunit::testFunc6()
|
||||||
XPASS : tst_Xunit::testFunc7() 'true' returned FALSE. ()
|
XPASS : tst_Xunit::testFunc7() 'true' returned FALSE. ()
|
||||||
Loc: [/local/user_builds/qt/4.6/tests/auto/selftests/xunit/tst_xunit.cpp(110)]
|
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(110)]
|
||||||
PASS : tst_Xunit::cleanupTestCase()
|
PASS : tst_Xunit::cleanupTestCase()
|
||||||
Totals: 5 passed, 3 failed, 1 skipped
|
Totals: 5 passed, 3 failed, 1 skipped
|
||||||
********* Finished testing of tst_Xunit *********
|
********* Finished testing of tst_Xunit *********
|
||||||
|
Loading…
x
Reference in New Issue
Block a user