From 584a8f016ebc61b584b3ca696328b03586cb231e Mon Sep 17 00:00:00 2001 From: Robert Loehning <robert.loehning@nokia.com> Date: Thu, 13 Oct 2011 14:29:51 +0200 Subject: [PATCH] Squish: Moved remaining functions for creating projects to project.py Change-Id: I92b56ed9401be41d0a54dd32c623b55b7d1e4f71 Reviewed-by: Christian Stenger <christian.stenger@nokia.com> --- tests/system/shared/project.py | 52 +++++++++++++++++++ .../tst_qtquick_creation3/test.py | 22 +------- .../tst_qtquick_creation4/test.py | 32 +----------- 3 files changed, 54 insertions(+), 52 deletions(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 4f1b41ed588..7d557360331 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -162,3 +162,55 @@ def createNewQtQuickApplication(workingDir, projectName = None, templateFile = N clickButton(nextButton) selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>") clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000)) + +def createNewQtQuickUI(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 UI", 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) + if workingDir == None: + workingDir = tempDir() + 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...! + clickButton(waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)) + selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>") + clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000)) + +def createNewQmlExtension(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), "Custom QML Extension Plugin", 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) + if workingDir == None: + workingDir = tempDir() + 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) + chooseTargets() + clickButton(nextButton) + nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} " + "type='QLineEdit' unnamed='1' visible='1'}", 20000) + replaceEditorContent(nameLineEd, "TestItem") + uriLineEd = waitForObject("{buddy={type='QLabel' text='URI:' unnamed='1' visible='1'} " + "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)) diff --git a/tests/system/suite_qtquick/tst_qtquick_creation3/test.py b/tests/system/suite_qtquick/tst_qtquick_creation3/test.py index e7c191f74c2..e5506016771 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation3/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation3/test.py @@ -7,32 +7,12 @@ def main(): startApplication("qtcreator" + SettingsPath) # using a temporary directory won't mess up an eventually exisiting workingDir = tempDir() - createNewQtQuickUI() + createNewQtQuickUI(workingDir) test.log("Running project") if runAndCloseQtQuickUI(): logApplicationOutput() invokeMenuItem("File", "Exit") -def createNewQtQuickUI(): - 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 UI", 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...! - clickButton(waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)) - selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>") - 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 diff --git a/tests/system/suite_qtquick/tst_qtquick_creation4/test.py b/tests/system/suite_qtquick/tst_qtquick_creation4/test.py index f2cd06a675c..b3d45fd64d4 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(): startApplication("qtcreator" + SettingsPath) # using a temporary directory won't mess up an eventually exisiting workingDir = tempDir() - createNewQmlExtension() + createNewQmlExtension(workingDir) # wait for parsing to complete waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000) test.log("Building project") @@ -17,36 +17,6 @@ def main(): checkLastBuild() invokeMenuItem("File", "Exit") -def createNewQmlExtension(): - 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), "Custom QML Extension Plugin", 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) - chooseTargets() - clickButton(nextButton) - nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} " - "type='QLineEdit' unnamed='1' visible='1'}", 20000) - replaceEditorContent(nameLineEd, "TestItem") - uriLineEd = waitForObject("{buddy={type='QLabel' text='URI:' unnamed='1' visible='1'} " - "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)) - def cleanup(): global workingDir # waiting for a clean exit - for a full-remove of the temp directory -- GitLab