Squish: Updated tst_create_proj_wizard

Change-Id: I04bfd317ce85f764f97d341b46b20264976ef9bd
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
Robert Loehning
2013-07-18 17:34:27 +02:00
parent 531cba5812
commit 3897137b0a
3 changed files with 13 additions and 14 deletions

View File

@@ -80,6 +80,7 @@
:Kits_Or_Compilers_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'} :Kits_Or_Compilers_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'}
:Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' occurrence='4' type='QComboBox' unnamed='1' visible='1'} :Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' occurrence='4' type='QComboBox' unnamed='1' visible='1'}
:Locals and Expressions_Debugger::Internal::WatchTreeView {container=':DebugModeWidget.Locals and Expressions_QDockWidget' name='WatchWindow' type='Debugger::Internal::WatchTreeView' visible='1' windowTitle='Locals and Expressions'} :Locals and Expressions_Debugger::Internal::WatchTreeView {container=':DebugModeWidget.Locals and Expressions_QDockWidget' name='WatchWindow' type='Debugger::Internal::WatchTreeView' visible='1' windowTitle='Locals and Expressions'}
:New.comboBox_QComboBox {name='comboBox' type='QComboBox' visible='1' window=':New_Core::Internal::NewDialog'}
:New.frame_QFrame {name='frame' type='QFrame' visible='1' window=':New_Core::Internal::NewDialog'} :New.frame_QFrame {name='frame' type='QFrame' visible='1' window=':New_Core::Internal::NewDialog'}
:New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'} :New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'}
:New_Core::Internal::NewDialog {name='Core__Internal__NewDialog' type='Core::Internal::NewDialog' visible='1' windowTitle='New'} :New_Core::Internal::NewDialog {name='Core__Internal__NewDialog' type='Core::Internal::NewDialog' visible='1' windowTitle='New'}

View File

@@ -116,7 +116,7 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
text = waitForObject("{type='QTextBrowser' name='templateDescription' visible='1'}").plainText text = waitForObject("{type='QTextBrowser' name='templateDescription' visible='1'}").plainText
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}")) clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
return __getSupportedPlatforms__(str(text))[0] return __getSupportedPlatforms__(str(text), template)[0]
def __createProjectSetNameAndPath__(path, projectName = None, checks = True): def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
directoryEdit = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}") directoryEdit = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
@@ -469,7 +469,7 @@ def resetApplicationContextToCreator():
# configured Qt versions and Toolchains and cannot be looked up the same way # configured Qt versions and Toolchains and cannot be looked up the same way
# if you set getAsStrings to True this function returns a list of strings instead # if you set getAsStrings to True this function returns a list of strings instead
# of the constants defined in Targets # of the constants defined in Targets
def __getSupportedPlatforms__(text, getAsStrings=False): def __getSupportedPlatforms__(text, templateName, getAsStrings=False):
reqPattern = re.compile("requires qt (?P<version>\d+\.\d+(\.\d+)?)", re.IGNORECASE) reqPattern = re.compile("requires qt (?P<version>\d+\.\d+(\.\d+)?)", re.IGNORECASE)
res = reqPattern.search(text) res = reqPattern.search(text)
if res: if res:
@@ -491,7 +491,7 @@ def __getSupportedPlatforms__(text, getAsStrings=False):
result.append(Targets.HARMATTAN) result.append(Targets.HARMATTAN)
if 'Maemo/Fremantle' in supports: if 'Maemo/Fremantle' in supports:
result.append(Targets.MAEMO5) result.append(Targets.MAEMO5)
if not re.search("custom Qt Creator plugin", text): if not ("BlackBerry" in templateName or re.search("custom Qt Creator plugin", text)):
result.append(Targets.SIMULATOR) result.append(Targets.SIMULATOR)
elif 'Platform independent' in text: elif 'Platform independent' in text:
# MAEMO5 and HARMATTAN could be wrong here - depends on having Madde plugin enabled or not # MAEMO5 and HARMATTAN could be wrong here - depends on having Madde plugin enabled or not

View File

@@ -64,17 +64,14 @@ def performTest(templateDir, qmlFile, isMaddeDisabled):
catModel = categoriesView.model() catModel = categoriesView.model()
projects = catModel.index(0, 0) projects = catModel.index(0, 0)
test.compare("Projects", str(projects.data())) test.compare("Projects", str(projects.data()))
comboBox = findObject("{name='comboBox' type='QComboBox' visible='1' " comboBox = findObject(":New.comboBox_QComboBox")
"window=':New_Core::Internal::NewDialog'}")
targets = zip(*kits.values())[0] targets = zip(*kits.values())[0]
maddeTargets = Targets.getTargetsAsStrings([Targets.MAEMO5, Targets.HARMATTAN]) maddeTargets = Targets.getTargetsAsStrings([Targets.MAEMO5, Targets.HARMATTAN])
maddeInTargets = len(set(targets) & set(maddeTargets)) > 0 maddeInTargets = len(set(targets) & set(maddeTargets)) > 0
test.compare(comboBox.enabled, maddeInTargets, "Verifying whether combox is enabled.") test.verify(comboBox.enabled, "Verifying whether combobox is enabled.")
test.compare(maddeInTargets, not isMaddeDisabled, "Verifying if kits are configured.") test.compare(maddeInTargets, not isMaddeDisabled, "Verifying if kits are configured.")
if maddeInTargets: test.compare(comboBox.currentText, "Desktop Templates")
test.compare(comboBox.currentText, "All Templates") selectFromCombo(comboBox, "All Templates")
else:
test.compare(comboBox.currentText, "Desktop Templates")
for category in [item.replace(".", "\\.") for item in dumpItems(catModel, projects)]: for category in [item.replace(".", "\\.") for item in dumpItems(catModel, projects)]:
# skip non-configurable # skip non-configurable
if "Import" in category: if "Import" in category:
@@ -85,14 +82,15 @@ def performTest(templateDir, qmlFile, isMaddeDisabled):
for template in dumpItems(templatesView.model(), templatesView.rootIndex()): for template in dumpItems(templatesView.model(), templatesView.rootIndex()):
template = template.replace(".", "\\.") template = template.replace(".", "\\.")
# skip non-configurable # skip non-configurable
if template in ("Qt Quick 1 UI", "Qt Quick 2 UI") or "(CMake Build)" in template: if not (template in ("Qt Quick 1 UI", "Qt Quick 2 UI", "Qt Quick 2 UI with Controls")
continue or "(CMake Build)" in template):
availableProjectTypes.append({category:template}) availableProjectTypes.append({category:template})
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}")) clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}"))
for current in availableProjectTypes: for current in availableProjectTypes:
category = current.keys()[0] category = current.keys()[0]
template = current.values()[0] template = current.values()[0]
invokeMenuItem("File", "New File or Project...") invokeMenuItem("File", "New File or Project...")
selectFromCombo(waitForObject(":New.comboBox_QComboBox"), "All Templates")
categoriesView = waitForObject(":New.templateCategoryView_QTreeView") categoriesView = waitForObject(":New.templateCategoryView_QTreeView")
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton) clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}") templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}")
@@ -101,7 +99,7 @@ def performTest(templateDir, qmlFile, isMaddeDisabled):
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
waitFor("textChanged", 2000) waitFor("textChanged", 2000)
text = waitForObject(":frame.templateDescription_QTextBrowser").plainText text = waitForObject(":frame.templateDescription_QTextBrowser").plainText
displayedPlatforms, requiredVersion = __getSupportedPlatforms__(str(text), True) displayedPlatforms, requiredVersion = __getSupportedPlatforms__(str(text), template, True)
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}")) clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
# don't check because project could exist # don't check because project could exist
__createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False) __createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False)