From c8984dc58adb48ce82a2794fe713d945f1d4f3ec Mon Sep 17 00:00:00 2001
From: Robert Loehning <robert.loehning@digia.com>
Date: Thu, 25 Apr 2013 19:08:55 +0200
Subject: [PATCH] Squish: Using progressBarWait() instead of waitForSignal()

Change-Id: Ia87569c080f3b54dd8f78b023408de76eb3c574c
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
---
 tests/system/shared/build_utils.py                       | 3 +--
 tests/system/shared/project.py                           | 6 +++---
 tests/system/shared/utils.py                             | 4 ++--
 tests/system/suite_CSUP/tst_CSUP04/test.py               | 2 +-
 tests/system/suite_CSUP/tst_CSUP05/test.py               | 2 +-
 tests/system/suite_WELP/tst_WELP02/test.py               | 6 ++----
 tests/system/suite_editors/tst_basic_cpp_support/test.py | 3 +--
 tests/system/suite_general/tst_build_speedcrunch/test.py | 2 +-
 tests/system/suite_general/tst_cmake_speedcrunch/test.py | 2 +-
 tests/system/suite_general/tst_openqt_creator/test.py    | 4 ++--
 tests/system/suite_qtquick/tst_qtquick_creation4/test.py | 2 +-
 11 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py
index 491c4bb7df2..859131d8039 100644
--- a/tests/system/shared/build_utils.py
+++ b/tests/system/shared/build_utils.py
@@ -163,8 +163,7 @@ def selectBuildConfig(targetCount, currentTarget, configName):
     switchViewTo(ViewConstants.PROJECTS)
     switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
     if selectFromCombo(":scrollArea.Edit build configuration:_QComboBox", configName):
-        waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}",
-                      "sourceFilesRefreshed(QStringList)")
+        progressBarWait(30000)
     return getQtInformationForBuildSettings(targetCount, True, ViewConstants.EDIT)
 
 # This will not trigger a rebuild. If needed, caller has to do this.
diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index 95ea4988656..99fa6c76fea 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -175,7 +175,7 @@ def createProject_Qt_GUI(path, projectName, checks = True):
         expectedFiles.extend(__sortFilenamesOSDependent__(["main.cpp", cpp_file, h_file, ui_file, pro_file]))
     __createProjectHandleLastPage__(expectedFiles)
 
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 20000)
+    progressBarWait(20000)
     __verifyFileCreation__(path, expectedFiles)
     return checkedTargets
 
@@ -199,7 +199,7 @@ def createProject_Qt_Console(path, projectName, checks = True):
         expectedFiles.extend(__sortFilenamesOSDependent__([cpp_file, pro_file]))
     __createProjectHandleLastPage__(expectedFiles)
 
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 10000)
+    progressBarWait(10000)
     __verifyFileCreation__(path, expectedFiles)
     return checkedTargets
 
@@ -224,7 +224,7 @@ def createNewQtQuickApplication(workingDir, projectName = None, templateFile = N
     clickButton(nextButton)
     __createProjectHandleLastPage__()
 
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 10000)
+    progressBarWait(10000)
     return checkedTargets, projectName
 
 def createNewQtQuickUI(workingDir):
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 4bb0e36ef8f..b1f55dc5a64 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -609,9 +609,9 @@ def checkIfObjectExists(name, shouldExist = True, timeout = 3000, verboseOnFail
     return result
 
 # wait for progress bar(s) to appear and disappear
-def progressBarWait():
+def progressBarWait(timeout=60000):
     checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", True, 2000)
-    checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", False, 60000)
+    checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", False, timeout)
 
 def readFile(filename):
     f = open(filename, "r")
diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py
index 405c5955181..05c7d5e4a69 100644
--- a/tests/system/suite_CSUP/tst_CSUP04/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP04/test.py
@@ -19,7 +19,7 @@ def main():
     openQmakeProject(examplePath)
     installLazySignalHandler("{type='Core::FutureProgress' unnamed='1'}", "finished()", "__handleFutureProgress__")
     # wait for parsing to complete
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
     # open .cpp file in editor
     if not openDocument("propertyanimation.Sources.main\\.cpp"):
         test.fatal("Could not open main.cpp")
diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py
index 97dec22d1e3..174759e7da5 100644
--- a/tests/system/suite_CSUP/tst_CSUP05/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP05/test.py
@@ -17,7 +17,7 @@ def main():
     # open example project
     openQmakeProject(examplePath)
     # wait for parsing to complete
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
     # open .cpp file in editor
     if not openDocument("propertyanimation.Sources.main\\.cpp"):
         test.fatal("Could not open main.cpp")
diff --git a/tests/system/suite_WELP/tst_WELP02/test.py b/tests/system/suite_WELP/tst_WELP02/test.py
index a68f7554866..d8b359b0704 100644
--- a/tests/system/suite_WELP/tst_WELP02/test.py
+++ b/tests/system/suite_WELP/tst_WELP02/test.py
@@ -28,8 +28,7 @@ def main():
     # select "Create Project" and try to create a new project.
     # create Qt Quick application from "Welcome" page -> "Develop" tab
     createNewQtQuickApplication(tempDir(), "SampleApp", fromWelcome = True)
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}",
-                  "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
     test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
                                     " text~='SampleApp( \(.*\))?' type='QModelIndex'}"),
                 "Verifying: The project is opened in 'Edit' mode after configuring.")
@@ -42,8 +41,7 @@ def main():
     examplePath = os.path.join(prepareTemplate(sourceExample), "propertyanimation.pro")
     # open example project from "Welcome" page -> "Develop" tab
     openQmakeProject(examplePath, fromWelcome = True)
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}",
-                  "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
     test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
                                     " text~='propertyanimation( \(.*\))?' type='QModelIndex'}"),
                 "Verifying: The project is opened in 'Edit' mode after configuring.")
diff --git a/tests/system/suite_editors/tst_basic_cpp_support/test.py b/tests/system/suite_editors/tst_basic_cpp_support/test.py
index c48332e0e6a..a19b28561e8 100644
--- a/tests/system/suite_editors/tst_basic_cpp_support/test.py
+++ b/tests/system/suite_editors/tst_basic_cpp_support/test.py
@@ -19,9 +19,8 @@ def main():
     overrideInstallLazySignalHandler()
     installLazySignalHandler(":Qt Creator_CppEditor::Internal::CPPEditorWidget", "textChanged()",
                              "__handleTextChanged__")
-    prepareForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
     openQmakeProject(proFile)
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 20000)
+    progressBarWait(20000)
     selectFromLocator("dummy.cpp")
 
 ##   Waiting for a solution from Froglogic to make the below work.
diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py
index 9925be73db4..65b915023ba 100644
--- a/tests/system/suite_general/tst_build_speedcrunch/test.py
+++ b/tests/system/suite_general/tst_build_speedcrunch/test.py
@@ -21,7 +21,7 @@ def main():
     if platform.system() in ('Windows', 'Microsoft'):
         suitableKits |= Targets.DESKTOP_474_MSVC2008
     checkedTargets = openQmakeProject(SpeedCrunchPath, suitableKits)
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
 
     fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
 
diff --git a/tests/system/suite_general/tst_cmake_speedcrunch/test.py b/tests/system/suite_general/tst_cmake_speedcrunch/test.py
index feac26c9e3b..1521611fff5 100644
--- a/tests/system/suite_general/tst_cmake_speedcrunch/test.py
+++ b/tests/system/suite_general/tst_cmake_speedcrunch/test.py
@@ -21,7 +21,7 @@ def main():
         test.fatal("Could not open/create cmake project - leaving test")
         invokeMenuItem("File", "Exit")
         return
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
 
     # Invoke a rebuild of the application
     invokeMenuItem("Build", "Rebuild All")
diff --git a/tests/system/suite_general/tst_openqt_creator/test.py b/tests/system/suite_general/tst_openqt_creator/test.py
index 7993d4b30eb..b6475fd6d9f 100644
--- a/tests/system/suite_general/tst_openqt_creator/test.py
+++ b/tests/system/suite_general/tst_openqt_creator/test.py
@@ -12,10 +12,10 @@ def main():
 
     openQmakeProject(pathSpeedcrunch)
     # Wait for parsing to complete
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
     openQmakeProject(pathCreator)
     # Wait for parsing to complete
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 300000)
+    progressBarWait(300000)
 
     naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s' type='QModelIndex'}"
     compareProjectTree(naviTreeView % "speedcrunch( \(\S+\))?", "projecttree_speedcrunch.tsv")
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation4/test.py b/tests/system/suite_qtquick/tst_qtquick_creation4/test.py
index 3908ec9c423..d8ccecd7cbb 100644
--- a/tests/system/suite_qtquick/tst_qtquick_creation4/test.py
+++ b/tests/system/suite_qtquick/tst_qtquick_creation4/test.py
@@ -7,7 +7,7 @@ def main():
     # using a temporary directory won't mess up a potentially existing
     createNewQmlExtension(tempDir())
     # wait for parsing to complete
-    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
+    progressBarWait(30000)
     test.log("Building project")
     invokeMenuItem("Build","Build All")
     waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
-- 
GitLab