OSDN Git Service

Squish: Merged variations of createNewQtQuickApplication()
authorRobert Loehning <robert.loehning@nokia.com>
Fri, 7 Oct 2011 13:05:55 +0000 (15:05 +0200)
committerChristian Stenger <christian.stenger@nokia.com>
Fri, 7 Oct 2011 13:17:38 +0000 (15:17 +0200)
Change-Id: I5c2f88e18630922a34dbb52894ce6ef26697c28b
Reviewed-on: http://codereview.qt-project.org/6180
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
tests/system/shared/project.py
tests/system/shared/qtcreator.py
tests/system/suite_qtquick/tst_qml_editor/test.py
tests/system/suite_qtquick/tst_qml_indent/test.py
tests/system/suite_qtquick/tst_qtquick_creation/test.py
tests/system/suite_qtquick/tst_qtquick_creation2/test.py

index 5fa719a..21194ca 100644 (file)
@@ -127,3 +127,36 @@ def createProject_Qt_GUI(path, projectName, qtVersion, checks):
         test.verify(os.path.exists(h_path), "Checking if '" + h_path + "' was created")
         test.verify(os.path.exists(ui_path), "Checking if '" + ui_path + "' was created")
         test.verify(os.path.exists(pro_path), "Checking if '" + pro_path + "' was created")
+
+def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None, destination = QtQuickConstants.Destinations.DESKTOP):
+    invokeMenuItem("File", "New File or Project...")
+    clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton)
+    clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
+    clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
+    if projectName!=None:
+        baseLineEd = waitForObject("{name='nameLineEdit' visible='1' "
+                                   "type='Utils::ProjectNameValidatingLineEdit'}", 20000)
+        replaceEditorContent(baseLineEd, projectName)
+    baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
+    replaceEditorContent(baseLineEd, workingDir)
+    stateLabel = findObject("{type='QLabel' name='stateLabel'}")
+    labelCheck = stateLabel.text=="" and stateLabel.styleSheet == ""
+    test.verify(labelCheck, "Project name and base directory without warning or error")
+    # make sure this is not set as default location
+    cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000)
+    if cbDefaultLocation.checked:
+        clickButton(cbDefaultLocation)
+    nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)
+    clickButton(nextButton)
+    if (templateFile==None):
+        chooseComponents()
+    else:
+        chooseComponents(QtQuickConstants.Components.EXISTING_QML)
+        # define the existing qml file to import
+        baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
+        type(baseLineEd, templateFile)
+    clickButton(nextButton)
+    chooseDestination(destination)
+    snooze(1)
+    clickButton(nextButton)
+    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
index 97b7877..418f696 100644 (file)
@@ -15,8 +15,8 @@ testSettings.logScreenshotOnFail = True
 
 source("../../shared/utils.py")
 source("../../shared/build_utils.py")
-source("../../shared/project.py")
 source("../../shared/qtquick.py")
+source("../../shared/project.py")
 source("../../shared/editor_utils.py")
 
 def waitForCleanShutdown(timeOut=10):
index 6caed8d..4c7edff 100644 (file)
@@ -12,7 +12,7 @@ def main():
     # using a temporary directory won't mess up an eventually exisiting
     workingDir = tempDir()
     prepareTemplate(sourceExample)
-    createNewQtQuickApplication()
+    createNewQtQuickApplication(workingDir, "untitled", templateDir + "/qml/focus.qml")
     # wait for parsing to complete
     waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
     testRenameId()
@@ -25,39 +25,6 @@ def prepareTemplate(sourceExample):
     templateDir = os.path.abspath(templateDir + "/template")
     shutil.copytree(sourceExample, templateDir)
 
-def createNewQtQuickApplication():
-    global workingDir,templateDir
-    invokeMenuItem("File", "New File or Project...")
-    clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000),
-              "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton)
-    clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000),
-              "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
-    clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
-    baseLineEd = waitForObject("{name='nameLineEdit' visible='1' "
-                               "type='Utils::ProjectNameValidatingLineEdit'}", 20000)
-    replaceEditorContent(baseLineEd, "untitled")
-    baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
-    replaceEditorContent(baseLineEd, workingDir)
-    stateLabel = findObject("{type='QLabel' name='stateLabel'}")
-    labelCheck = stateLabel.text=="" and stateLabel.styleSheet == ""
-    test.verify(labelCheck, "Project name and base directory without warning or error")
-    # make sure this is not set as default location
-    cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000)
-    if cbDefaultLocation.checked:
-        clickButton(cbDefaultLocation)
-    # now there's the 'untitled' project inside a temporary directory - step forward...!
-    nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)
-    clickButton(nextButton)
-    chooseComponents(QtQuickConstants.Components.EXISTING_QML)
-    # define the existing qml file to import
-    baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
-    type(baseLineEd, templateDir+"/qml/focus.qml")
-    clickButton(nextButton)
-    chooseDestination()
-    snooze(1)
-    clickButton(nextButton)
-    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
 def testRenameId():
     test.log("Testing rename of id")
     navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
index 4c2b7f6..ef7a8a0 100644 (file)
@@ -5,7 +5,7 @@ def main():
     startApplication("qtcreator" + SettingsPath)
     # using a temporary directory won't mess up an eventually exisiting
     workingDir = tempDir()
-    createNewQtQuickApplication()
+    createNewQtQuickApplication(workingDir, "untitled")
     # wait for parsing to complete
     waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 5000)
     if not prepareQmlFile():
@@ -16,36 +16,6 @@ def main():
     invokeMenuItem("File", "Save All")
     invokeMenuItem("File", "Exit")
 
-def createNewQtQuickApplication():
-    global workingDir
-    invokeMenuItem("File", "New File or Project...")
-    clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000),
-              "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton)
-    clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000),
-              "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
-    clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
-    baseLineEd = waitForObject("{name='nameLineEdit' visible='1' "
-                               "type='Utils::ProjectNameValidatingLineEdit'}", 20000)
-    replaceEditorContent(baseLineEd, "untitled")
-    baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
-    replaceEditorContent(baseLineEd, workingDir)
-    stateLabel = findObject("{type='QLabel' name='stateLabel'}")
-    labelCheck = stateLabel.text=="" and stateLabel.styleSheet == ""
-    test.verify(labelCheck, "Project name and base directory without warning or error")
-    # make sure this is not set as default location
-    cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000)
-    if cbDefaultLocation.checked:
-        clickButton(cbDefaultLocation)
-    # now there's the 'untitled' project inside a temporary directory - step forward...!
-    nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)
-    clickButton(nextButton)
-    chooseComponents()
-    clickButton(nextButton)
-    chooseDestination(QtQuickConstants.Destinations.DESKTOP)
-    snooze(1)
-    clickButton(nextButton)
-    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
 def prepareQmlFile():
     # make sure the QML file is opened
     navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
index f92d57e..113c59d 100644 (file)
@@ -7,7 +7,7 @@ def main():
     startApplication("qtcreator" + SettingsPath)
     # using a temporary directory won't mess up an eventually exisiting
     workingDir = tempDir()
-    createNewQtQuickApplication()
+    createNewQtQuickApplication(workingDir)
     # wait for parsing to complete
     waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
     test.log("Building project")
@@ -22,31 +22,6 @@ def main():
             logApplicationOutput()
     invokeMenuItem("File", "Exit")
 
-def createNewQtQuickApplication():
-    global workingDir
-    invokeMenuItem("File", "New File or Project...")
-    clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton)
-    clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
-    clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
-    baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
-    replaceEditorContent(baseLineEd, workingDir)
-    stateLabel = findObject("{type='QLabel' name='stateLabel'}")
-    labelCheck = stateLabel.text=="" and stateLabel.styleSheet == ""
-    test.verify(labelCheck, "Project name and base directory without warning or error")
-    # make sure this is not set as default location
-    cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000)
-    if cbDefaultLocation.checked:
-        clickButton(cbDefaultLocation)
-    # now there's the 'untitled' project inside a temporary directory - step forward...!
-    nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)
-    clickButton(nextButton)
-    chooseComponents()
-    clickButton(nextButton)
-    chooseDestination(QtQuickConstants.Destinations.DESKTOP)
-    snooze(1)
-    clickButton(nextButton)
-    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
 def cleanup():
     global workingDir
     # waiting for a clean exit - for a full-remove of the temp directory
index 1e70ab4..2f84aff 100644 (file)
@@ -12,7 +12,7 @@ def main():
     # using a temporary directory won't mess up an eventually exisiting
     workingDir = tempDir()
     prepareTemplate(sourceExample)
-    createNewQtQuickApplication()
+    createNewQtQuickApplication(workingDir, None, templateDir + "/qml/textselection.qml")
     # wait for parsing to complete
     waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
     test.log("Building project")
@@ -33,34 +33,6 @@ def prepareTemplate(sourceExample):
     templateDir = os.path.abspath(templateDir + "/template")
     shutil.copytree(sourceExample, templateDir)
 
-def createNewQtQuickApplication():
-    global workingDir,templateDir
-    invokeMenuItem("File", "New File or Project...")
-    clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton)
-    clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
-    clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
-    baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
-    replaceEditorContent(baseLineEd, workingDir)
-    stateLabel = findObject("{type='QLabel' name='stateLabel'}")
-    labelCheck = stateLabel.text=="" and stateLabel.styleSheet == ""
-    test.verify(labelCheck, "Project name and base directory without warning or error")
-    # make sure this is not set as default location
-    cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000)
-    if cbDefaultLocation.checked:
-        clickButton(cbDefaultLocation)
-    # now there's the 'untitled' project inside a temporary directory - step forward...!
-    nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)
-    clickButton(nextButton)
-    chooseComponents(QtQuickConstants.Components.EXISTING_QML)
-    # define the existing qml file to import
-    baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
-    type(baseLineEd, templateDir+"/qml/textselection.qml")
-    clickButton(nextButton)
-    chooseDestination()
-    snooze(1)
-    clickButton(nextButton)
-    clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
 def cleanup():
     global workingDir,templateDir
     # waiting for a clean exit - for a full-remove of the temp directory