qmltest: Perform extra checks after each data row is executed.
authorJason McDonald <jason.mcdonald@nokia.com>
Tue, 7 Feb 2012 05:09:44 +0000 (15:09 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 8 Feb 2012 23:31:00 +0000 (00:31 +0100)
Add calls to the new function QTestResult::finishedCurrentTestData() to
verify that expected failures and expected messages have been produced.

Change-Id: Ia139a962c705a5f47be992b7f2e81775aa2e2f28
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
src/imports/testlib/TestCase.qml
src/qmltest/quicktest.cpp
src/qmltest/quicktestresult.cpp
src/qmltest/quicktestresult_p.h

index 5b853cb..a1ab85c 100644 (file)
@@ -486,6 +486,7 @@ Item {
         if (!qtest_results.skipped) {
             qtest_results.functionType = TestResult.Func
             qtest_runInternal(prop, arg)
+            qtest_results.finishTestData()
             qtest_results.functionType = TestResult.CleanupFunc
             qtest_runInternal("cleanup")
         }
@@ -510,7 +511,9 @@ Item {
                 else
                     qtest_results.startBenchmark(TestResult.RunOnce, qtest_results.dataTag)
                 while (!qtest_results.isBenchmarkDone()) {
-                    if (!qtest_runInternal(prop, arg))
+                    var success = qtest_runInternal(prop, arg)
+                    qtest_results.finishTestData()
+                    if (!success)
                         break
                     qtest_results.nextBenchmark()
                 }
index b1b9897..ed5fa7b 100644 (file)
@@ -173,6 +173,7 @@ template <class View> void handleCompileErrors(const QFileInfo &fi, const View &
     // Fail with error 0.
     results.fail(errors.at(0).description(),
                  errors.at(0).url(), errors.at(0).line());
+    results.finishTestData();
     results.finishTestFunction();
     results.setFunctionName(QString());
     results.setFunctionType(QuickTestResult::NoWhere);
index bd47064..c1c5368 100644 (file)
@@ -355,6 +355,11 @@ void QuickTestResult::clearTestTable()
     d->table = 0;
 }
 
+void QuickTestResult::finishTestData()
+{
+    QTestResult::finishedCurrentTestData();
+}
+
 void QuickTestResult::finishTestFunction()
 {
     QTestResult::finishedCurrentTestFunction();
index 26e1591..2c37fab 100644 (file)
@@ -122,6 +122,7 @@ public Q_SLOTS:
     void initTestTable();
     void clearTestTable();
 
+    void finishTestData();
     void finishTestFunction();
 
     void fail(const QString &message, const QUrl &location, int line);