Remove warning messages from TestCase.qml
authorCharles Yin <charles.yin@nokia.com>
Mon, 24 Oct 2011 23:40:37 +0000 (09:40 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 25 Oct 2011 02:17:36 +0000 (04:17 +0200)
qtest_run should be called only when the whole TestCase is completely
loaded.

Task-number:QTBUG-22299
Change-Id: Id2874ed2493ccea72a4f17e6cb61aeb58ae4fa31
Reviewed-by: Charles Yin <charles.yin@nokia.com>
src/imports/testlib/TestCase.qml

index bb97481..5887ece 100644 (file)
@@ -74,6 +74,7 @@ Item {
     // Internal private state.  Identifiers prefixed with qtest are reserved.
     property bool qtest_prevWhen: true
     property int qtest_testId: -1
+    property bool qtest_componentCompleted : false
     property variant qtest_testCaseResult
     property variant qtest_results: qtest_results_normal
     TestResult { id: qtest_results_normal }
@@ -659,7 +660,7 @@ Item {
     onWhenChanged: {
         if (when != qtest_prevWhen) {
             qtest_prevWhen = when
-            if (when && !completed && !running)
+            if (when && !completed && !running && qtest_componentCompleted)
                 qtest_run()
         }
     }
@@ -685,6 +686,7 @@ Item {
 
     Component.onCompleted: {
         qtest.hasTestCase = true;
+        qtest_componentCompleted = true;
 
         if (util.printAvailableFunctions) {
             var testList = []
@@ -714,4 +716,4 @@ Item {
         if (when && !completed && !running)
             qtest_run()
     }
-}
+}
\ No newline at end of file