diff options
author | Christian Stenger <christian.stenger@digia.com> | 2013-11-21 14:23:33 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@digia.com> | 2013-11-29 13:56:17 +0100 |
commit | b2ff8d87957d269d24251fe9602c6e3549a1325f (patch) | |
tree | 521b2da62cff582343fbfb1efb101eb3f97faeca /tests/system/suite_general/tst_create_proj_wizard/test.py | |
parent | 3e8f02e2f471d37ef54d4d03b3cfa355a331b882 (diff) | |
download | qt-creator-b2ff8d87957d269d24251fe9602c6e3549a1325f.tar.gz |
Squish: Fix tst_create_proj_wizard
Replace waiting for signal textChanged() and handle new Qt Quick wizards.
Change-Id: Id452703fe21b3162800671db59f722821e7dd3fa
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Diffstat (limited to 'tests/system/suite_general/tst_create_proj_wizard/test.py')
-rw-r--r-- | tests/system/suite_general/tst_create_proj_wizard/test.py | 103 |
1 files changed, 54 insertions, 49 deletions
diff --git a/tests/system/suite_general/tst_create_proj_wizard/test.py b/tests/system/suite_general/tst_create_proj_wizard/test.py index 77fee043a2..deab7eb5be 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -33,7 +33,7 @@ import re def main(): global tmpSettingsDir - global textChanged + quickCombinations = [[1,False], [2,False], [2,True]] sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection") qmlFile = os.path.join("qml", "textselection.qml") if not neededFilePresent(os.path.join(sourceExample, qmlFile)): @@ -42,9 +42,6 @@ def main(): startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - overrideInstallLazySignalHandler() - installLazySignalHandler(":frame.templateDescription_QTextBrowser", - "textChanged()","__handleTextChanged__") kits = getConfiguredKits() test.log("Collecting potential project types...") availableProjectTypes = [] @@ -71,59 +68,67 @@ def main(): for template in dumpItems(templatesView.model(), templatesView.rootIndex()): template = template.replace(".", "\\.") # skip non-configurable - if not (template in ("Qt Quick 1 UI", "Qt Quick 2 UI", "Qt Quick 2 UI with Controls") - or "(CMake Build)" in template or "(Qbs Build)" in template): + if (template != "Qt Quick UI" and "(CMake Build)" not in template + and "(Qbs Build)" not in template): availableProjectTypes.append({category:template}) clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}")) for current in availableProjectTypes: category = current.keys()[0] template = current.values()[0] - invokeMenuItem("File", "New File or Project...") - selectFromCombo(waitForObject(":New.comboBox_QComboBox"), "All Templates") - categoriesView = waitForObject(":New.templateCategoryView_QTreeView") - clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton) - templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}") - test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", "."))) - textChanged = False - clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) - waitFor("textChanged", 2000) - text = waitForObject(":frame.templateDescription_QTextBrowser").plainText - displayedPlatforms = __getSupportedPlatforms__(str(text), template, True)[0] - clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}")) - # don't check because project could exist - __createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False) + displayedPlatforms = __createProject__(category, template) + if template == "Qt Quick Application": + for counter, qComb in enumerate(quickCombinations): + requiredQtVersion = __createProjectHandleQtQuickSelection__(qComb[0], qComb[1]) + __modifyAvailableTargets__(displayedPlatforms, requiredQtVersion, True) + verifyKitCheckboxes(kits, displayedPlatforms) + # FIXME: if QTBUG-35203 is fixed replace by triggering the shortcut for Back + clickButton(waitForObject("{type='QPushButton' text='Cancel'}")) + # are there more Quick combinations - then recreate this project + if counter < len(quickCombinations) - 1: + displayedPlatforms = __createProject__(category, template) + continue try: waitForObject("{name='mainQmlFileGroupBox' title='Main HTML File' type='QGroupBox' visible='1'}", 1000) clickButton(waitForObject(":Next_QPushButton")) except LookupError: - try: - waitForObject("{text='Select Existing QML file' type='QLabel' visible='1'}", 1000) - baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}") - type(baseLineEd, os.path.join(templateDir, qmlFile)) - clickButton(waitForObject(":Next_QPushButton")) - except LookupError: - pass - waitForObject("{type='QLabel' unnamed='1' visible='1' text='Kit Selection'}") - availableCheckboxes = filter(visibleCheckBoxExists, kits.keys()) - # verification whether expected, found and configured match - for t in kits: - if t in displayedPlatforms: - if t in availableCheckboxes: - test.passes("Found expected kit '%s' on 'Kit Selection' page." % t) - availableCheckboxes.remove(t) - else: - test.fail("Expected kit '%s' missing on 'Kit Selection' page." % t) - else: - if t in availableCheckboxes: - test.fail("Kit '%s' found on 'Kit Selection' page - but was not expected!" % t) - else: - test.passes("Irrelevant kit '%s' not found on 'Kit Selection' page." % t) - if len(availableCheckboxes) != 0: - test.fail("Found unexpected additional kit(s) %s on 'Kit Selection' page." - % str(availableCheckboxes)) - clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}")) + pass + verifyKitCheckboxes(kits, displayedPlatforms) + clickButton(waitForObject("{type='QPushButton' text='Cancel'}")) invokeMenuItem("File", "Exit") -def __handleTextChanged__(*args): - global textChanged - textChanged = True +def verifyKitCheckboxes(kits, displayedPlatforms): + waitForObject("{type='QLabel' unnamed='1' visible='1' text='Kit Selection'}") + availableCheckboxes = filter(visibleCheckBoxExists, kits.keys()) + # verification whether expected, found and configured match + for t in kits: + if t in displayedPlatforms: + if t in availableCheckboxes: + test.passes("Found expected kit '%s' on 'Kit Selection' page." % t) + availableCheckboxes.remove(t) + else: + test.fail("Expected kit '%s' missing on 'Kit Selection' page." % t) + else: + if t in availableCheckboxes: + test.fail("Kit '%s' found on 'Kit Selection' page - but was not expected!" % t) + else: + test.passes("Irrelevant kit '%s' not found on 'Kit Selection' page." % t) + if len(availableCheckboxes) != 0: + test.fail("Found unexpected additional kit(s) %s on 'Kit Selection' page." + % str(availableCheckboxes)) + +def __createProject__(category, template): + invokeMenuItem("File", "New File or Project...") + selectFromCombo(waitForObject(":New.comboBox_QComboBox"), "All Templates") + categoriesView = waitForObject(":New.templateCategoryView_QTreeView") + clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton) + templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}") + test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", "."))) + textBrowser = findObject(":frame.templateDescription_QTextBrowser") + origTxt = str(textBrowser.plainText) + clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) + waitFor("origTxt != str(textBrowser.plainText)", 2000) + displayedPlatforms = __getSupportedPlatforms__(str(textBrowser.plainText), template, True)[0] + clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}")) + # don't check because project could exist + __createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False) + return displayedPlatforms |