diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-12-06 15:06:26 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-12-06 15:06:26 +1000 |
commit | 88321ef275cdca5936b2a96dd89ca1fc69fe77d5 (patch) | |
tree | 803a91e5beba4d57fee8e80389de6a5a406e32ad | |
parent | 2962830c5b38a0ed8bb3992f9b8b935043cc6442 (diff) |
Add ignoreWarning() helper function
-rw-r--r-- | doc/testcases.txt | 4 | ||||
-rw-r--r-- | src/imports/testlib/TestCase.qml | 6 | ||||
-rw-r--r-- | src/quicktestlib/qdeclarativetestresult.cpp | 5 | ||||
-rw-r--r-- | src/quicktestlib/qdeclarativetestresult_p.h | 1 |
4 files changed, 16 insertions, 0 deletions
diff --git a/doc/testcases.txt b/doc/testcases.txt index 7d34af7..c2a459c 100644 --- a/doc/testcases.txt +++ b/doc/testcases.txt @@ -92,6 +92,10 @@ A number of helper functions are available to assist with writing tests: warn(msg) - Similar to QWARN in C++ + ignoreWarning(msg) + - Ignore warning message + - Similar to QTest::ignoreMessage(QtWarningMsg, msg) + The "msg" parameters can be omitted if there is no particular message that should be displayed other than "FAIL" or "SKIP". diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index f6a026f..f3ce66c 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -155,6 +155,12 @@ Item { results.warn(msg); } + function ignoreWarning(msg) { + if (!msg) + msg = "" + results.ignoreWarning(msg) + } + // Functions that can be overridden in subclasses for init/cleanup duties. function initTestCase() {} function cleanupTestCase() {} diff --git a/src/quicktestlib/qdeclarativetestresult.cpp b/src/quicktestlib/qdeclarativetestresult.cpp index 691b4a9..1ecf43c 100644 --- a/src/quicktestlib/qdeclarativetestresult.cpp +++ b/src/quicktestlib/qdeclarativetestresult.cpp @@ -425,6 +425,11 @@ void QDeclarativeTestResult::warn(const QString &message) QTestLog::warn(message.toLatin1().constData()); } +void QDeclarativeTestResult::ignoreWarning(const QString &message) +{ + QTestResult::ignoreMessage(QtWarningMsg, message.toLatin1().constData()); +} + namespace QTest { void qtest_qParseArgs(int argc, char *argv[]); }; diff --git a/src/quicktestlib/qdeclarativetestresult_p.h b/src/quicktestlib/qdeclarativetestresult_p.h index 508a6de..1905b4c 100644 --- a/src/quicktestlib/qdeclarativetestresult_p.h +++ b/src/quicktestlib/qdeclarativetestresult_p.h @@ -122,6 +122,7 @@ public Q_SLOTS: bool expectFailContinue(const QString &tag, const QString &comment); void warn(const QString &message); + void ignoreWarning(const QString &message); public: // Helper functions for the C++ main() shell. |