diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2012-02-16 16:00:41 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-17 05:24:46 +0100 |
commit | 64642a4d9768b767c51c7f92dec94f655ba60195 (patch) | |
tree | 15a950162fbfef346cc02c430966920c337f21b4 /src | |
parent | 4121f9df29c85d45e0fe128d237c0009cded7574 (diff) |
testlib: Skip test function if init() fails.
Prior to this commit, the following statement in the qtestlib
documentation was untrue: "If init() fails, the following testfunction
will not be executed, the test will proceed to the next testfunction."
If init() called QSKIP, the test function would be skipped, but if
init() reported a failure, the test function would still be executed
(even though doing so could be unsafe).
This commit makes testlib skip a test function if init() reports a
failure and enhances the selftests to cover skips and fails in both
init() and cleanup().
Task-number: QTBUG-20371
Change-Id: Id1cc8464ae0b8c257ae1b74dbe9189a501f5366b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/testlib/qtestcase.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index c084441f5c..8b9ba6d748 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1500,7 +1500,7 @@ static void qInvokeTestMethodDataEntry(char *slot) bool invokeOk; do { invokeMethod(QTest::currentTestObject, "init()"); - if (QTestResult::skipCurrentTest()) + if (QTestResult::skipCurrentTest() || QTestResult::currentTestFailed()) break; QBenchmarkTestMethodData::current->result = QBenchmarkResult(); |