Squish: Update lib creation

Fixes tst_APTW03

Change-Id: Ifa1bcf5334773b68b8b0027ca03a016d5ba92cb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Loehning
2019-07-17 22:58:22 +02:00
parent b3d9647582
commit c1a83b2a88

View File

@@ -97,7 +97,7 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}")) clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
return __getSupportedPlatforms__(str(text), template)[0] return __getSupportedPlatforms__(str(text), template)[0]
def __createProjectSetNameAndPath__(path, projectName = None, checks = True, libType = None): def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
directoryEdit = waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' " directoryEdit = waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' "
"toolTip?='Full path: *'}") "toolTip?='Full path: *'}")
replaceEditorContent(directoryEdit, path) replaceEditorContent(directoryEdit, path)
@@ -113,10 +113,6 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True, lib
test.verify(labelCheck, "Project name and base directory without warning or error") test.verify(labelCheck, "Project name and base directory without warning or error")
# make sure this is not set as default location # make sure this is not set as default location
ensureChecked("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", False) ensureChecked("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", False)
if libType != None:
selectFromCombo(waitForObject("{leftWidget={text='Type' type='QLabel' unnamed='1' "
"visible='1'} type='QComboBox' unnamed='1' visible='1'}"),
LibType.getStringForLib(libType))
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
return str(projectName) return str(projectName)
@@ -365,22 +361,28 @@ def createNewCPPLib(projectDir, projectName, className, target, isStatic):
libType = LibType.SHARED libType = LibType.SHARED
if projectDir == None: if projectDir == None:
projectDir = tempDir() projectDir = tempDir()
projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, libType) projectName = __createProjectSetNameAndPath__(projectDir, projectName, False)
__chooseTargets__(target, available) __handleBuildSystem__(None)
snooze(1) selectFromCombo(waitForObject("{name='Type' type='QComboBox' visible='1' "
clickButton(waitForObject(":Next_QPushButton")) "window=':New_ProjectExplorer::JsonWizard'}"),
__createProjectHandleModuleSelection__(["QtCore"]) LibType.getStringForLib(libType))
__createProjectHandleModuleSelection__("Core")
className = __createProjectHandleClassInformation__(className) className = __createProjectHandleClassInformation__(className)
__chooseTargets__(target, available)
clickButton(waitForObject(":Next_QPushButton"))
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return projectName, className return projectName, className
def createNewQtPlugin(projectDir, projectName, className, target, baseClass="QGenericPlugin"): def createNewQtPlugin(projectDir, projectName, className, target, baseClass="QGenericPlugin"):
available = __createProjectOrFileSelectType__(" Library", "C++ Library", False, True) available = __createProjectOrFileSelectType__(" Library", "C++ Library", False, True)
projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, LibType.QT_PLUGIN) projectName = __createProjectSetNameAndPath__(projectDir, projectName, False)
__chooseTargets__(target, available) __handleBuildSystem__(None)
snooze(1) selectFromCombo(waitForObject("{name='Type' type='QComboBox' visible='1' "
clickButton(waitForObject(":Next_QPushButton")) "window=':New_ProjectExplorer::JsonWizard'}"),
LibType.getStringForLib(LibType.QT_PLUGIN))
className = __createProjectHandleClassInformation__(className, baseClass) className = __createProjectHandleClassInformation__(className, baseClass)
__chooseTargets__(target, available)
clickButton(waitForObject(":Next_QPushButton"))
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return projectName, className return projectName, className
@@ -422,36 +424,18 @@ def __chooseTargets__(targets, availableTargets=None, additionalFunc=None):
test.warning("Target '%s' is not set up correctly." % Targets.getStringForTarget(current)) test.warning("Target '%s' is not set up correctly." % Targets.getStringForTarget(current))
return checkedTargets return checkedTargets
def __createProjectHandleModuleSelection__(modules): def __createProjectHandleModuleSelection__(module):
modulesPage = waitForObject("{type='QmakeProjectManager::Internal::ModulesPage' unnamed='1' " selectFromCombo(waitForObject("{name='LibraryQtModule' type='QComboBox' visible='1' "
"visible='1'}") "window=':New_ProjectExplorer::JsonWizard'}"), module)
chckBoxes = filter(lambda x: className(x) == 'QCheckBox', object.children(modulesPage))
chckBoxLabels = set([str(cb.text) for cb in chckBoxes])
if not set(modules).issubset(chckBoxLabels):
test.fatal("You want to check module(s) not available at 'Module Selection' page.",
"Not available: %s" % str(set(modules).difference(chckBoxLabels)))
for checkBox in chckBoxes:
test.log("(Un)Checking module checkbox '%s'" % str(checkBox.text))
ensureChecked(checkBox, str(checkBox.text) in modules, 3000)
clickButton(waitForObject(":Next_QPushButton"))
def __createProjectHandleClassInformation__(className, baseClass=None): def __createProjectHandleClassInformation__(className, baseClass=None):
if baseClass: if baseClass:
selectFromCombo("{name='baseClassComboBox' type='QComboBox' visible='1'}", baseClass) selectFromCombo("{name='BaseClassInfo' type='QComboBox' visible='1' "
classLineEd = waitForObject("{name='classLineEdit' type='Utils::ClassNameValidatingLineEdit' " "window=':New_ProjectExplorer::JsonWizard'}", baseClass)
"visible='1'}") replaceEditorContent(waitForObject("{name='Class' type='Utils::FancyLineEdit' visible='1' "
result = str(classLineEd.text) "window=':New_ProjectExplorer::JsonWizard'}"), className)
if className:
replaceEditorContent(classLineEd, className)
try:
waitForObject("{text='The class name contains invalid characters.' type='QLabel' "
"unnamed='1' visible='1'}", 1000)
test.fatal("Class name contains invalid characters - using default.")
replaceEditorContent(classLineEd, result)
except:
result = className
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
return result return className
def waitForProcessRunning(running=True): def waitForProcessRunning(running=True):
outputButton = waitForObject(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") outputButton = waitForObject(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")