OSDN Git Service

Squish: Let one function handle last page of all project wizards
authorRobert Loehning <robert.loehning@nokia.com>
Fri, 14 Oct 2011 14:29:46 +0000 (16:29 +0200)
committerRobert Löhning <robert.loehning@nokia.com>
Mon, 17 Oct 2011 16:09:25 +0000 (18:09 +0200)
Change-Id: I74e2c2f0c50a3131ad66fbde5e4a7fe004b7ebff
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
tests/system/objects.map
tests/system/shared/project.py
tests/system/suite_debugger/tst_build_new_project/test.py

index 523991e..467640f 100644 (file)
 :Project Setup.scrollArea_QScrollArea  {name='scrollArea' type='QScrollArea' visible='1' window=':Project Setup_Qt4ProjectManager::Internal::ProjectLoadWizard'}
 :Project Setup_Qt4ProjectManager::Internal::ProjectLoadWizard  {type='Qt4ProjectManager::Internal::ProjectLoadWizard' unnamed='1' visible='1' windowTitle='Project Setup'}
 :Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
+:Qt Creator.ReRun_QToolButton  {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator.Stop_QToolButton   {text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'}
 :Qt Creator_Core::Internal::OutputPaneToggleButton     {occurrence='3' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_CppEditor::Internal::CPPEditorWidget       {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:Qt Creator.ReRun_QToolButton  {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_Utils::IconButton  {occurrence='2' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_Utils::NavigationTreeView  {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:Qt Gui Application.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' unnamed='1' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'}
 :Qt Gui Application.Form file:_QLabel  {name='formLabel' text='Form file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'}
 :Qt Gui Application.Header file:_QLabel        {name='headerLabel' text='Header file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'}
 :Qt Gui Application.Next_QPushButton   {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'}
index 7d55736..387f775 100644 (file)
@@ -53,6 +53,17 @@ def shadowBuildDir(path, project, qtVersion, debugVersion):
     else:
         return buildDir + "_Release"
 
+def createProjectHandleLastPage(expectedFiles = None):
+    if expectedFiles != None:
+        summary = str(waitForObject(":scrollArea.Files to be added").text)
+        lastIndex = 0
+        for filename in expectedFiles:
+            index = summary.find(filename)
+            test.verify(index > lastIndex, "'" + filename + "' found at index " + str(index))
+            lastIndex = index
+    selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>")
+    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
+
 def createProject_Qt_GUI(path, projectName, qtVersion, checks):
     invokeMenuItem("File", "New File or Project...")
     waitForObjectItem(":New.templateCategoryView_QTreeView", "Projects.Qt Widget Project")
@@ -97,23 +108,10 @@ def createProject_Qt_GUI(path, projectName, qtVersion, checks):
 
     clickButton(verifyEnabled(":Qt Gui Application.Next_QPushButton"))
 
+    expectedFiles = None
     if checks:
-        summary = str(waitForObject(":scrollArea.Files to be added").text)
-
-        path_found = summary.find(os.path.join(path, projectName))
-        cpp_found = summary.find(cpp_file)
-        h_found = summary.find(h_file)
-        ui_found = summary.find(ui_file)
-        pro_found = summary.find(pro_file)
-
-        test.verify(path_found > 0, "'" + path + "' found at index " + str(path_found))
-        test.verify(cpp_found > path_found, "'" + cpp_file + "' found at index " + str(cpp_found))
-        test.verify(h_found > cpp_found, "'" + h_file + "' found at index " + str(h_found))
-        test.verify(ui_found > cpp_found, "'" + ui_file + "' found at index " + str(ui_found))
-        test.verify(pro_found > ui_found, "'" + pro_file + "' found at index " + str(pro_found))
-
-    selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>")
-    clickButton(waitForObject(":Qt Gui Application.Finish_QPushButton"))
+        expectedFiles = [os.path.join(path, projectName), cpp_file, h_file, ui_file, pro_file]
+    createProjectHandleLastPage(expectedFiles)
 
     if checks:
         waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 20000)
@@ -160,8 +158,7 @@ def createNewQtQuickApplication(workingDir, projectName = None, templateFile = N
     chooseTargets(targets)
     snooze(1)
     clickButton(nextButton)
-    selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>")
-    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
+    createProjectHandleLastPage()
 
 def createNewQtQuickUI(workingDir):
     invokeMenuItem("File", "New File or Project...")
@@ -181,8 +178,7 @@ def createNewQtQuickUI(workingDir):
         clickButton(cbDefaultLocation)
     # now there's the 'untitled' project inside a temporary directory - step forward...!
     clickButton(waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000))
-    selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>")
-    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
+    createProjectHandleLastPage()
 
 def createNewQmlExtension(workingDir):
     invokeMenuItem("File", "New File or Project...")
@@ -212,5 +208,4 @@ def createNewQmlExtension(workingDir):
                               "type='QLineEdit' unnamed='1' visible='1'}", 20000)
     replaceEditorContent(uriLineEd, "com.nokia.test.qmlcomponents")
     clickButton(nextButton)
-    selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>")
-    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
+    createProjectHandleLastPage()
index 2799e91..2da3f55 100644 (file)
@@ -5,7 +5,7 @@ project = "SquishProject"
 
 def main():
     startApplication("qtcreator" + SettingsPath)
-    createProject_Qt_GUI(projectsPath, project, defaultQtVersion, 1)
+    createProject_Qt_GUI(projectsPath, project, defaultQtVersion, True)
     clickButton(verifyEnabled(":*Qt Creator.Run_Core::Internal::FancyToolButton"))
     waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
     playButton = verifyEnabled(":Qt Creator.ReRun_QToolButton", False)