forked from qt-creator/qt-creator
Squish: Refactor selecting configured Kits in project
The design of the Projects mode changed several times. We wrote lots of workarounds to keep even more old code alive because we never had the time for a proper refactoring. This time is now. Leads to more stable code with far less variables flying around. Task-number: QTCREATORBUG-20265 Change-Id: I29e5956ea3279cdb1d6da61bf5b461666de436bc Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -159,7 +159,6 @@
|
||||
:Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView {type='QmlJSEditor::Internal::QmlJSOutlineTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::Internal::QmlJSEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_SystemSettings.Details_Utils::DetailsButton {occurrence='4' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_TextEditor::TextEditorWidget {type='TextEditor::TextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Utils::BuildDirectoryLineEdit {name='shadowBuildDirEditLineEdit' type='Utils::FancyLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
@@ -220,7 +219,6 @@
|
||||
:scrollArea.Edit build configuration:_QComboBox {leftWidget=':scrollArea.Edit build configuration:_QLabel' type='QComboBox' unnamed='1' visible='1'}
|
||||
:scrollArea.Edit build configuration:_QLabel {text='Edit build configuration:' type='QLabel' unnamed='1' visible='1'}
|
||||
:scrollArea.Library not available_QLabel {name='qmlDebuggingWarningText' text?='Library not available*' type='QLabel' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:scrollArea.environment_QTreeView {container=':Qt Creator.scrollArea_QScrollArea' type='QTreeView' unnamed='1' visible='1'}
|
||||
:scrollArea.qmlDebuggingLibraryCheckBox_QCheckBox {name='qmlDebuggingLibraryCheckBox' type='QCheckBox' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:sourceFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Source file:_QLabel' name='sourceFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
|
||||
:splitter.Commit File(s)_VcsBase::QActionPushButton {text~='(Commit .+/.+ File.*)' type='VcsBase::QActionPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
|
@@ -131,15 +131,14 @@ def createTasksFile(buildIssues):
|
||||
file.close()
|
||||
test.log("Written tasks file %s" % outfile)
|
||||
|
||||
# returns a list of pairs each containing the zero based number of a kit
|
||||
# returns a list of pairs each containing the ID of a kit (see class Targets)
|
||||
# and the name of the matching build configuration
|
||||
# param kitCount specifies the number of kits currently defined (must be correct!)
|
||||
# param filter is a regular expression to filter the configuration by their name
|
||||
def iterateBuildConfigs(kitCount, filter = ""):
|
||||
def iterateBuildConfigs(filter = ""):
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
configs = []
|
||||
for currentKit in range(kitCount):
|
||||
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.BUILD)
|
||||
for currentKit in iterateConfiguredKits():
|
||||
switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.BUILD)
|
||||
model = waitForObject(":scrollArea.Edit build configuration:_QComboBox").model()
|
||||
prog = re.compile(filter)
|
||||
# for each row in the model, write its data to a list
|
||||
@@ -151,21 +150,23 @@ def iterateBuildConfigs(kitCount, filter = ""):
|
||||
return configs
|
||||
|
||||
# selects a build configuration for building the current project
|
||||
# param targetCount specifies the number of targets currently defined (must be correct!)
|
||||
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
|
||||
# param wantedKit specifies the ID of the kit to select (see class Targets)
|
||||
# param configName is the name of the configuration that should be selected
|
||||
# param afterSwitchTo the ViewConstant of the mode to switch to after selecting or None
|
||||
# returns information about the selected kit, see getQtInformationForBuildSettings
|
||||
def selectBuildConfig(targetCount, currentTarget, configName, afterSwitchTo=ViewConstants.EDIT):
|
||||
def selectBuildConfig(wantedKit, configName, afterSwitchTo=ViewConstants.EDIT):
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
|
||||
if selectFromCombo(":scrollArea.Edit build configuration:_QComboBox", configName) or targetCount > 1:
|
||||
if any((switchToBuildOrRunSettingsFor(wantedKit, ProjectSettings.BUILD),
|
||||
selectFromCombo(":scrollArea.Edit build configuration:_QComboBox", configName))):
|
||||
progressBarWait(30000)
|
||||
return getQtInformationForBuildSettings(targetCount, True, afterSwitchTo)
|
||||
if afterSwitchTo:
|
||||
if ViewConstants.FIRST_AVAILABLE <= afterSwitchTo <= ViewConstants.LAST_AVAILABLE:
|
||||
switchViewTo(afterSwitchTo)
|
||||
else:
|
||||
test.warning("Don't know where you trying to switch to (%s)" % afterSwitchTo)
|
||||
|
||||
# This will not trigger a rebuild. If needed, caller has to do this.
|
||||
def verifyBuildConfig(targetCount, currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, enableQmlDebug=False):
|
||||
qtInfo = selectBuildConfig(targetCount, currentTarget, configName, None)
|
||||
def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, enableQmlDebug=False):
|
||||
selectBuildConfig(currentTarget, configName, None)
|
||||
ensureChecked(waitForObject(":scrollArea.Details_Utils::DetailsButton"))
|
||||
ensureChecked("{name='shadowBuildCheckBox' type='QCheckBox' visible='1'}", enableShadowBuild)
|
||||
buildCfCombo = waitForObject("{type='QComboBox' name='buildConfigurationComboBox' visible='1' "
|
||||
@@ -203,7 +204,6 @@ def verifyBuildConfig(targetCount, currentTarget, configName, shouldBeDebug=Fals
|
||||
clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000))
|
||||
clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton"))
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
return qtInfo
|
||||
|
||||
# verify if building and running of project was successful
|
||||
def verifyBuildAndRun():
|
||||
@@ -218,15 +218,15 @@ def verifyBuildAndRun():
|
||||
"Verifying if built app started and closed successfully.")
|
||||
|
||||
# run project for debug and release
|
||||
def runVerify(checkedTargets):
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets))
|
||||
def runVerify():
|
||||
availableConfigs = iterateBuildConfigs()
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found build configurations, quitting")
|
||||
invokeMenuItem("File", "Save All")
|
||||
invokeMenuItem("File", "Exit")
|
||||
# select debug configuration
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
selectBuildConfig(kit, config)
|
||||
test.log("Using build config '%s'" % config)
|
||||
if runAndCloseApp() == None:
|
||||
checkCompile()
|
||||
|
@@ -81,6 +81,13 @@ class Targets:
|
||||
test.fatal("You've passed at least one unknown target!")
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def getIdForTargetName(targetName):
|
||||
for id in Targets.ALL_TARGETS:
|
||||
if Targets.getStringForTarget(id) == targetName:
|
||||
return id
|
||||
raise Exception("'%s' is not a known target name" % targetName)
|
||||
|
||||
@staticmethod
|
||||
def getDefaultKit():
|
||||
return Targets.DESKTOP_5_6_1_DEFAULT
|
||||
|
@@ -115,25 +115,24 @@ def removeOldBreakpoints():
|
||||
return test.compare(model.rowCount(), 0, "Check if all breakpoints have been removed.")
|
||||
|
||||
# function to do simple debugging of the current (configured) project
|
||||
# param kitCount specifies the number of kits currently defined (must be correct!)
|
||||
# param currentKit specifies the target to use (zero based index)
|
||||
# param currentKit specifies the ID of the kit to use (see class Targets)
|
||||
# param currentConfigName is the name of the configuration that should be used
|
||||
# param pressContinueCount defines how often it is expected to press
|
||||
# the 'Continue' button while debugging
|
||||
# param expectedBPOrder holds a list of dicts where the dicts contain always
|
||||
# only 1 key:value pair - the key is the name of the file, the value is
|
||||
# line number where the debugger should stop
|
||||
def doSimpleDebugging(kitCount, currentKit, currentConfigName, pressContinueCount=1,
|
||||
def doSimpleDebugging(currentKit, currentConfigName, pressContinueCount=1,
|
||||
expectedBPOrder=[], enableQml=True):
|
||||
expectedLabelTexts = ['Stopped\.', 'Stopped at breakpoint \d+ \(\d+\) in thread \d+\.']
|
||||
if len(expectedBPOrder) == 0:
|
||||
expectedLabelTexts.append("Running\.")
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.RUN)
|
||||
switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.RUN)
|
||||
ensureChecked(waitForObject("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' "
|
||||
"type='QCheckBox' unnamed='1' visible='1'}"), enableQml)
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
if not __startDebugger__(kitCount, currentKit, currentConfigName):
|
||||
if not __startDebugger__(currentKit, currentConfigName):
|
||||
return False
|
||||
statusLabel = findObject(":Debugger Toolbar.StatusText_Utils::StatusLabel")
|
||||
test.log("Continuing debugging %d times..." % pressContinueCount)
|
||||
@@ -167,20 +166,18 @@ def doSimpleDebugging(kitCount, currentKit, currentConfigName, pressContinueCoun
|
||||
# if stopping failed - debugger had already stopped
|
||||
return True
|
||||
|
||||
# param kitCount specifies the number of kits currently defined (must be correct!)
|
||||
# param currentKit specifies the target to use (zero based index)
|
||||
def isMsvcConfig(kitCount, currentKit):
|
||||
# param currentKit specifies the ID of the kit to use (see class Targets)
|
||||
def isMsvcConfig(currentKit):
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.BUILD)
|
||||
switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.BUILD)
|
||||
isMsvc = " -spec win32-msvc" in str(waitForObject(":qmakeCallEdit").text)
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
return isMsvc
|
||||
|
||||
# param kitCount specifies the number of kits currently defined (must be correct!)
|
||||
# param currentKit specifies the target to use (zero based index)
|
||||
# param currentKit specifies the ID of the kit to use (see class Targets)
|
||||
# param config is the name of the configuration that should be used
|
||||
def __startDebugger__(kitCount, currentKit, config):
|
||||
isMsvcBuild = isMsvcConfig(kitCount, currentKit)
|
||||
def __startDebugger__(currentKit, config):
|
||||
isMsvcBuild = isMsvcConfig(currentKit)
|
||||
clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton"))
|
||||
handleDebuggerWarnings(config, isMsvcBuild)
|
||||
try:
|
||||
|
@@ -50,10 +50,9 @@ def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWe
|
||||
clickButton(waitForObject("{text='Yes' type='QPushButton' unnamed='1' visible='1'}"))
|
||||
except:
|
||||
pass
|
||||
checkedTargets = __chooseTargets__(targets)
|
||||
__chooseTargets__(targets)
|
||||
configureButton = waitForObject(":Qt Creator.Configure Project_QPushButton")
|
||||
clickButton(configureButton)
|
||||
return checkedTargets
|
||||
|
||||
def openCmakeProject(projectPath, buildDir):
|
||||
def additionalFunction():
|
||||
@@ -175,7 +174,6 @@ def __selectQtVersionDesktop__(checks, available=None, withoutQt4=False):
|
||||
verifyChecked(cbObject % ("Release", objectMap.realName(detailsWidget)))
|
||||
clickButton(detailsButton)
|
||||
clickButton(waitForObject(":Next_QPushButton"))
|
||||
return checkedTargets
|
||||
|
||||
def __createProjectHandleLastPage__(expectedFiles=[], addToVersionControl="<None>", addToProject=None):
|
||||
if len(expectedFiles):
|
||||
@@ -220,7 +218,7 @@ def createProject_Qt_GUI(path, projectName, checks = True, addToVersionControl =
|
||||
template = "Qt Widgets Application"
|
||||
available = __createProjectOrFileSelectType__(" Application", template)
|
||||
__createProjectSetNameAndPath__(path, projectName, checks)
|
||||
checkedTargets = __selectQtVersionDesktop__(checks, available, True)
|
||||
__selectQtVersionDesktop__(checks, available, True)
|
||||
|
||||
if checks:
|
||||
exp_filename = "mainwindow"
|
||||
@@ -251,7 +249,6 @@ def createProject_Qt_GUI(path, projectName, checks = True, addToVersionControl =
|
||||
progressBarWait(20000)
|
||||
if checks:
|
||||
__verifyFileCreation__(path, expectedFiles)
|
||||
return checkedTargets
|
||||
|
||||
# Creates a Qt Console project
|
||||
# param path specifies where to create the project
|
||||
@@ -261,7 +258,7 @@ def createProject_Qt_Console(path, projectName, checks = True, buildSystem = Non
|
||||
available = __createProjectOrFileSelectType__(" Application", "Qt Console Application")
|
||||
__createProjectSetNameAndPath__(path, projectName, checks)
|
||||
__handleBuildSystem__(buildSystem)
|
||||
checkedTargets = __selectQtVersionDesktop__(checks, available)
|
||||
__selectQtVersionDesktop__(checks, available)
|
||||
|
||||
expectedFiles = []
|
||||
if checks:
|
||||
@@ -277,7 +274,6 @@ def createProject_Qt_Console(path, projectName, checks = True, buildSystem = Non
|
||||
progressBarWait(10000)
|
||||
if checks:
|
||||
__verifyFileCreation__(path, expectedFiles)
|
||||
return checkedTargets
|
||||
|
||||
def createNewQtQuickApplication(workingDir, projectName = None,
|
||||
targets=Targets.desktopTargetClasses(), minimumQtVersion="5.6",
|
||||
@@ -324,7 +320,7 @@ def createNewQmlExtension(workingDir, targets=[Targets.DESKTOP_5_6_1_DEFAULT]):
|
||||
if workingDir == None:
|
||||
workingDir = tempDir()
|
||||
__createProjectSetNameAndPath__(workingDir)
|
||||
checkedTargets = __chooseTargets__(targets, available)
|
||||
__chooseTargets__(targets, available)
|
||||
nextButton = waitForObject(":Next_QPushButton")
|
||||
clickButton(nextButton)
|
||||
nameLineEd = waitForObject("{buddy={type='QLabel' text='Object class-name:' unnamed='1' visible='1'} "
|
||||
@@ -335,18 +331,17 @@ def createNewQmlExtension(workingDir, targets=[Targets.DESKTOP_5_6_1_DEFAULT]):
|
||||
replaceEditorContent(uriLineEd, "org.qt-project.test.qmlcomponents")
|
||||
clickButton(nextButton)
|
||||
__createProjectHandleLastPage__()
|
||||
return checkedTargets
|
||||
|
||||
def createEmptyQtProject(workingDir=None, projectName=None, targets=Targets.desktopTargetClasses()):
|
||||
__createProjectOrFileSelectType__(" Other Project", "Empty qmake Project")
|
||||
if workingDir == None:
|
||||
workingDir = tempDir()
|
||||
projectName = __createProjectSetNameAndPath__(workingDir, projectName)
|
||||
checkedTargets = __chooseTargets__(targets)
|
||||
__chooseTargets__(targets)
|
||||
snooze(1)
|
||||
clickButton(waitForObject(":Next_QPushButton"))
|
||||
__createProjectHandleLastPage__()
|
||||
return projectName, checkedTargets
|
||||
return projectName
|
||||
|
||||
def createNewNonQtProject(workingDir=None, projectName=None, target=[Targets.DESKTOP_4_8_7_DEFAULT],
|
||||
plainC=False, cmake=False, qbs=False):
|
||||
@@ -386,13 +381,13 @@ def createNewCPPLib(projectDir = None, projectName = None, className = None, fro
|
||||
if projectDir == None:
|
||||
projectDir = tempDir()
|
||||
projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, libType)
|
||||
checkedTargets = __chooseTargets__(target, available)
|
||||
__chooseTargets__(target, available)
|
||||
snooze(1)
|
||||
clickButton(waitForObject(":Next_QPushButton"))
|
||||
__createProjectHandleModuleSelection__(modules)
|
||||
className = __createProjectHandleClassInformation__(className)
|
||||
__createProjectHandleLastPage__()
|
||||
return checkedTargets, projectName, className
|
||||
return projectName, className
|
||||
|
||||
def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWelcome=False,
|
||||
target=[Targets.DESKTOP_4_8_7_DEFAULT], baseClass="QGenericPlugin"):
|
||||
@@ -400,12 +395,12 @@ def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWel
|
||||
if projectDir == None:
|
||||
projectDir = tempDir()
|
||||
projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, LibType.QT_PLUGIN)
|
||||
checkedTargets = __chooseTargets__(target, available)
|
||||
__chooseTargets__(target, available)
|
||||
snooze(1)
|
||||
clickButton(waitForObject(":Next_QPushButton"))
|
||||
className = __createProjectHandleClassInformation__(className, baseClass)
|
||||
__createProjectHandleLastPage__()
|
||||
return checkedTargets, projectName, className
|
||||
return projectName, className
|
||||
|
||||
# parameter target can be a list of Targets
|
||||
# parameter availableTargets should be the result of __createProjectOrFileSelectType__()
|
||||
|
@@ -48,126 +48,67 @@ def switchViewTo(view):
|
||||
mouseClick(waitForObject("{type='Core::Internal::FancyTabBar' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}"), 20, 20 + 52 * view, 0, Qt.LeftButton)
|
||||
|
||||
# this function is used to make sure that simple building prerequisites are met
|
||||
# param targetCount specifies how many build targets had been selected (it's important that this one is correct)
|
||||
# param currentTarget specifies which target should be selected for the next build (zero based index)
|
||||
# param setReleaseBuild defines whether the current target(s) will be set to a Release or a Debug build
|
||||
# param disableShadowBuild defines whether to disable shadow build or leave it unchanged (no matter what is defined)
|
||||
# param setForAll defines whether to set Release or Debug and ShadowBuild option for all targets or only for the currentTarget
|
||||
def prepareBuildSettings(targetCount, currentTarget, setReleaseBuild=True, disableShadowBuild=True, setForAll=True):
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
success = True
|
||||
for current in range(targetCount):
|
||||
if setForAll or current == currentTarget:
|
||||
switchToBuildOrRunSettingsFor(targetCount, current, ProjectSettings.BUILD)
|
||||
# TODO: Improve selection of Release/Debug version
|
||||
if setReleaseBuild:
|
||||
chooseThis = "Release"
|
||||
else:
|
||||
chooseThis = "Debug"
|
||||
editBuildCfg = waitForObject("{leftWidget={text='Edit build configuration:' type='QLabel' "
|
||||
"unnamed='1' visible='1'} unnamed='1' type='QComboBox' visible='1'}")
|
||||
selectFromCombo(editBuildCfg, chooseThis)
|
||||
ensureChecked("{name='shadowBuildCheckBox' type='QCheckBox' visible='1'}", not disableShadowBuild)
|
||||
# get back to the current target
|
||||
if currentTarget < 0 or currentTarget >= targetCount:
|
||||
test.warning("Parameter currentTarget is out of range - will be ignored this time!")
|
||||
else:
|
||||
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
return success
|
||||
def __kitIsActivated__(kit):
|
||||
return not (str(kit.toolTip).startswith("<h3>Click to activate:</h3>")
|
||||
or str(kit.toolTip).startswith("<h3>Kit is unsuited for project</h3>"))
|
||||
|
||||
# this function switches to the build or the run settings (inside the Projects view)
|
||||
# if you haven't already switched to the Projects view this will fail and return False
|
||||
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
|
||||
# param targetCount specifies the number of targets currently defined (must be correct!)
|
||||
# param projectSettings specifies where to switch to (must be one of ProjectSettings.BUILD or ProjectSettings.RUN)
|
||||
def switchToBuildOrRunSettingsFor(targetCount, currentTarget, projectSettings):
|
||||
def kitIsActivated(kit):
|
||||
return not (str(kit.toolTip).startswith("<h3>Click to activate:</h3>")
|
||||
or str(kit.toolTip).startswith("<h3>Kit is unsuited for project</h3>"))
|
||||
|
||||
try:
|
||||
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
||||
except LookupError:
|
||||
return False
|
||||
# returns a list of the IDs (see class Targets) of all kits
|
||||
# which are currently configured for the active project
|
||||
# Creator must be in projects mode when calling
|
||||
def iterateConfiguredKits():
|
||||
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
||||
bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView")
|
||||
kitIndices = dumpIndices(treeView.model(), waitForObject(bAndRIndex))
|
||||
configuredKitNames = map(lambda t: str(t.data(0)),
|
||||
filter(__kitIsActivated__, kitIndices))
|
||||
return map(Targets.getIdForTargetName, configuredKitNames)
|
||||
|
||||
targetIndices = dumpIndices(treeView.model(), waitForObject(bAndRIndex))
|
||||
targets = map(lambda t: str(t.data(0)),
|
||||
filter(kitIsActivated, targetIndices))
|
||||
if not test.compare(targetCount, len(targets), "Check whether all chosen targets are listed."):
|
||||
return False
|
||||
# we assume the targets are still ordered the same way
|
||||
currentTargetIndex = getQModelIndexStr("text='%s'" % targets[currentTarget], bAndRIndex)
|
||||
if not test.verify(kitIsActivated(findObject(currentTargetIndex)),
|
||||
"Verifying target '%s' is enabled." % targets[currentTarget]):
|
||||
return False
|
||||
index = waitForObject(currentTargetIndex)
|
||||
treeView.scrollTo(index)
|
||||
mouseClick(index)
|
||||
|
||||
# This function switches to the build or the run settings (inside the Projects view).
|
||||
# If you haven't already switched to the Projects view this will raise a LookupError.
|
||||
# It will return a boolean value indicating whether the selected Kit was changed by the function.
|
||||
# Note that a 'False' return does not indicate any error.
|
||||
# param wantedKit specifies the ID of the kit (see class Targets)
|
||||
# for which to switch into the specified settings
|
||||
# param projectSettings specifies where to switch to (must be one of
|
||||
# ProjectSettings.BUILD or ProjectSettings.RUN)
|
||||
def switchToBuildOrRunSettingsFor(wantedKit, projectSettings):
|
||||
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
||||
bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView")
|
||||
wantedKitName = Targets.getStringForTarget(wantedKit)
|
||||
wantedKitIndexString = getQModelIndexStr("text='%s'" % wantedKitName, bAndRIndex)
|
||||
if not test.verify(__kitIsActivated__(findObject(wantedKitIndexString)),
|
||||
"Verifying target '%s' is enabled." % wantedKitName):
|
||||
raise Exception("Kit '%s' is not activated in the project." % wantedKitName)
|
||||
index = waitForObject(wantedKitIndexString)
|
||||
projectAlreadySelected = index.font.bold
|
||||
if projectAlreadySelected:
|
||||
test.log("Kit '%s' is already selected." % wantedKitName)
|
||||
else:
|
||||
test.log("Selecting kit '%s'..." % wantedKitName)
|
||||
treeView.scrollTo(index)
|
||||
mouseClick(index)
|
||||
|
||||
if projectSettings == ProjectSettings.BUILD:
|
||||
settingsIndex = getQModelIndexStr("text='Build'", currentTargetIndex)
|
||||
settingsIndex = getQModelIndexStr("text='Build'", wantedKitIndexString)
|
||||
elif projectSettings == ProjectSettings.RUN:
|
||||
settingsIndex = getQModelIndexStr("text='Run'", currentTargetIndex)
|
||||
settingsIndex = getQModelIndexStr("text='Run'", wantedKitIndexString)
|
||||
else:
|
||||
test.fatal("Don't know what you're trying to switch to")
|
||||
return False
|
||||
raise Exception("Unexpected projectSettings parameter (%s), needs to be BUILD or RUN."
|
||||
% str(projectSettings))
|
||||
mouseClick(waitForObject(settingsIndex))
|
||||
return True
|
||||
return not projectAlreadySelected
|
||||
|
||||
# this function switches "Run in terminal" on or off in a project's run settings
|
||||
# param targetCount specifies the number of targets currently defined (must be correct!)
|
||||
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
|
||||
# param wantedKit specifies the ID of the kit to edit (see class Targets)
|
||||
# param runInTerminal specifies if "Run in terminal should be turned on (True) or off (False)
|
||||
def setRunInTerminal(targetCount, currentTarget, runInTerminal=True):
|
||||
def setRunInTerminal(wantedKit, runInTerminal=True):
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.RUN)
|
||||
switchToBuildOrRunSettingsFor(wantedKit, ProjectSettings.RUN)
|
||||
ensureChecked("{window=':Qt Creator_Core::Internal::MainWindow' text='Run in terminal'\
|
||||
type='QCheckBox' unnamed='1' visible='1'}", runInTerminal)
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
|
||||
# helper function to get some Qt information for the current (already configured) project
|
||||
# param kitCount is the number of kits cofigured for the current project
|
||||
# param alreadyOnProjectsBuildSettings if set to True you have to make sure that you're
|
||||
# on the Projects view on the Build settings page (otherwise this function will end
|
||||
# up in a ScriptError)
|
||||
# param afterSwitchTo if you want to leave the Projects view/Build settings when returning
|
||||
# from this function you can set this parameter to one of the ViewConstants
|
||||
# this function returns an array of 4 elements (all could be None):
|
||||
# * the first element holds the Qt version
|
||||
# * the second element holds the mkspec
|
||||
# * the third element holds the Qt bin path
|
||||
# * the fourth element holds the Qt lib path
|
||||
# of the current active project
|
||||
def getQtInformationForBuildSettings(kitCount, alreadyOnProjectsBuildSettings=False, afterSwitchTo=None):
|
||||
if not alreadyOnProjectsBuildSettings:
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.BUILD)
|
||||
clickButton(waitForObject(":Qt Creator_SystemSettings.Details_Utils::DetailsButton"))
|
||||
model = waitForObject(":scrollArea.environment_QTreeView").model()
|
||||
qtDir = None
|
||||
for row in range(model.rowCount()):
|
||||
index = model.index(row, 0)
|
||||
text = str(model.data(index).toString())
|
||||
if text == "QTDIR":
|
||||
qtDir = str(model.data(model.index(row, 1)).toString())
|
||||
break
|
||||
if qtDir == None:
|
||||
test.fatal("UI seems to have changed - couldn't get QTDIR for this configuration.")
|
||||
return None, None, None, None
|
||||
|
||||
qmakeCallLabel = waitForObject("{text?='<b>qmake:</b> qmake*' type='QLabel' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
qtVersion = getQtInformationByQMakeCall(qtDir)
|
||||
if afterSwitchTo:
|
||||
if ViewConstants.FIRST_AVAILABLE <= afterSwitchTo <= ViewConstants.LAST_AVAILABLE:
|
||||
switchViewTo(afterSwitchTo)
|
||||
else:
|
||||
test.warning("Don't know where you trying to switch to (%s)" % afterSwitchTo)
|
||||
return qtVersion
|
||||
|
||||
def __getTargetFromToolTip__(toolTip):
|
||||
if toolTip == None or not isinstance(toolTip, (str, unicode)):
|
||||
test.warning("Parameter toolTip must be of type str or unicode and can't be None!")
|
||||
@@ -192,19 +133,6 @@ def getExecutableAndTargetFromToolTip(toolTip):
|
||||
return None, target
|
||||
return exe.group(1).strip(), target
|
||||
|
||||
# this function queries the version number from qmake
|
||||
# param qtDir set this to a path that holds a valid Qt
|
||||
# the function will return the wanted information or None if something went wrong
|
||||
def getQtInformationByQMakeCall(qtDir):
|
||||
qmake = os.path.join(qtDir, "bin", "qmake")
|
||||
if platform.system() in ('Microsoft', 'Windows'):
|
||||
qmake += ".exe"
|
||||
if not os.path.exists(qmake):
|
||||
test.fatal("Given Qt directory does not exist or does not contain bin/qmake.",
|
||||
"Constructed path: '%s'" % qmake)
|
||||
return None
|
||||
return getOutputFromCmdline([qmake, "-query", "QT_VERSION"]).strip()
|
||||
|
||||
def invokeContextMenuOnProject(projectName, menuItem):
|
||||
try:
|
||||
projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", projectName, 3000)
|
||||
|
@@ -32,8 +32,8 @@ def main():
|
||||
startCreator(False)
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
checkedTargets = createProject_Qt_GUI(tempDir(), "SampleApp")
|
||||
createProject_Qt_GUI(tempDir(), "SampleApp")
|
||||
# run project for debug and release and verify results
|
||||
runVerify(checkedTargets)
|
||||
runVerify()
|
||||
#close Qt Creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
@@ -30,8 +30,8 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# run project for debug and release and verify results
|
||||
runVerify(checkedTargets)
|
||||
runVerify()
|
||||
#close Qt Creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
@@ -56,11 +56,11 @@ def handleInsertVirtualFunctions(expected):
|
||||
clickButton("{text='OK' type='QPushButton' unnamed='1' visible='1'}")
|
||||
|
||||
def checkSimpleCppLib(projectName, static):
|
||||
checkedTargets, projectName, className = createNewCPPLib(tempDir(), projectName, "MyClass",
|
||||
target=Targets.desktopTargetClasses(),
|
||||
isStatic=static)
|
||||
for kit, config in iterateBuildConfigs(len(checkedTargets), "Release"):
|
||||
verifyBuildConfig(len(checkedTargets), kit, config, False, True)
|
||||
projectName, className = createNewCPPLib(tempDir(), projectName, "MyClass",
|
||||
target=Targets.desktopTargetClasses(),
|
||||
isStatic=static)
|
||||
for kit, config in iterateBuildConfigs("Release"):
|
||||
verifyBuildConfig(kit, config, False, True)
|
||||
invokeMenuItem('Build', 'Build Project "%s"' % projectName)
|
||||
waitForCompile(10000)
|
||||
checkCompile()
|
||||
@@ -81,12 +81,12 @@ def main():
|
||||
|
||||
# Qt Plugin needs Qt4.8 for QGenericPlugin which is tested by default
|
||||
targets = Targets.desktopTargetClasses()
|
||||
checkedTargets, projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin",
|
||||
target=targets)
|
||||
projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin",
|
||||
target=targets)
|
||||
virtualFunctionsAdded = False
|
||||
for kit, config in iterateBuildConfigs(len(checkedTargets), "Debug"):
|
||||
is487Kit = checkedTargets[kit] in (Targets.DESKTOP_4_8_7_DEFAULT, Targets.EMBEDDED_LINUX)
|
||||
verifyBuildConfig(len(checkedTargets), kit, config, True, True)
|
||||
for kit, config in iterateBuildConfigs("Debug"):
|
||||
is487Kit = kit in (Targets.DESKTOP_4_8_7_DEFAULT, Targets.EMBEDDED_LINUX)
|
||||
verifyBuildConfig(kit, config, True, True)
|
||||
if virtualFunctionsAdded and platform.system() in ('Microsoft', 'Windows') and is487Kit:
|
||||
test.warning("Skipping building of Qt4.8 targets because of QTCREATORBUG-12251.")
|
||||
continue
|
||||
|
@@ -42,13 +42,13 @@ def main():
|
||||
# open example project, supports only Qt 5
|
||||
targets = Targets.desktopTargetClasses()
|
||||
targets.remove(Targets.DESKTOP_4_8_7_DEFAULT)
|
||||
checkedTargets = openQmakeProject(examplePath, targets)
|
||||
openQmakeProject(examplePath, targets)
|
||||
# build and wait until finished - on all build configurations
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets))
|
||||
availableConfigs = iterateBuildConfigs()
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
selectBuildConfig(kit, config)
|
||||
# try to build project
|
||||
test.log("Testing build configuration: " + config)
|
||||
invokeMenuItem("Build", "Build All")
|
||||
|
@@ -31,13 +31,13 @@ def main():
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
# create qt quick application
|
||||
checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# build it - on all build configurations
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets))
|
||||
availableConfigs = iterateBuildConfigs()
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
selectBuildConfig(kit, config)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
|
||||
|
@@ -39,7 +39,7 @@ def main():
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
# create qt quick application
|
||||
checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# create syntax error in cpp file
|
||||
openDocument("SampleApp.Sources.main\\.cpp")
|
||||
if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "QQmlApplicationEngine engine;", "SyntaxError"):
|
||||
@@ -48,11 +48,11 @@ def main():
|
||||
# save all
|
||||
invokeMenuItem("File", "Save All")
|
||||
# build it - on all build configurations
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets))
|
||||
availableConfigs = iterateBuildConfigs()
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
selectBuildConfig(kit, config)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
|
||||
|
@@ -31,12 +31,12 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
checkedTargets = createProject_Qt_Console(tempDir(), project)
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets))
|
||||
createProject_Qt_Console(tempDir(), project)
|
||||
availableConfigs = iterateBuildConfigs()
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
selectBuildConfig(kit, config)
|
||||
test.log("Testing build configuration: " + config)
|
||||
if runAndCloseApp() == None:
|
||||
checkCompile()
|
||||
|
@@ -34,7 +34,7 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
checkedTargets = createProject_Qt_Console(tempDir(), project)
|
||||
createProject_Qt_Console(tempDir(), project)
|
||||
|
||||
mainEditor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
||||
replaceEditorContent(mainEditor, "")
|
||||
@@ -52,15 +52,15 @@ def main():
|
||||
test.verify("CONFIG += c++11 console" in str(proEditor.plainText),
|
||||
"Verifying that program is configured with console")
|
||||
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets))
|
||||
availableConfigs = iterateBuildConfigs()
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
selectBuildConfig(kit, config)
|
||||
test.log("Testing build configuration: " + config)
|
||||
|
||||
test.log("Running application")
|
||||
setRunInTerminal(len(checkedTargets), kit, False)
|
||||
setRunInTerminal(kit, False)
|
||||
clickButton(waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton"))
|
||||
outputButton = waitForObject(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
|
||||
waitFor("outputButton.checked", 20000) # Not ensureChecked(), avoid race condition
|
||||
@@ -71,7 +71,7 @@ def main():
|
||||
appOutput = str(waitForObject(":Qt Creator_Core::OutputWindow").plainText)
|
||||
verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output")
|
||||
verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output")
|
||||
if (checkedTargets[kit] == Targets.DESKTOP_5_4_1_GCC
|
||||
if (kit == Targets.DESKTOP_5_4_1_GCC
|
||||
and platform.system() in ('Windows', 'Microsoft')):
|
||||
test.log("Skipping qDebug() from %s (unstable, QTCREATORBUG-15067)"
|
||||
% Targets.getStringForTarget(Targets.DESKTOP_5_4_1_GCC))
|
||||
@@ -84,7 +84,7 @@ def main():
|
||||
"Did the application run at all?")
|
||||
|
||||
test.log("Debugging application")
|
||||
isMsvc = isMsvcConfig(len(checkedTargets), kit)
|
||||
isMsvc = isMsvcConfig(kit)
|
||||
invokeMenuItem("Debug", "Start Debugging", "Start Debugging")
|
||||
handleDebuggerWarnings(config, isMsvc)
|
||||
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
|
||||
|
@@ -50,12 +50,12 @@ def main():
|
||||
|
||||
# empty Qt
|
||||
workingDir = tempDir()
|
||||
projectName, checkedTargets = createEmptyQtProject(workingDir, "EmptyQtProj", targets)
|
||||
projectName = createEmptyQtProject(workingDir, "EmptyQtProj", targets)
|
||||
addFileToProject(os.path.join(workingDir, projectName), " C++", "C++ Source File", "main.cpp")
|
||||
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
||||
typeLines(editor, ["int main() {"])
|
||||
invokeMenuItem("File", "Save All")
|
||||
performDebugging(projectName, checkedTargets)
|
||||
performDebugging(projectName)
|
||||
invokeMenuItem("File", "Close All Projects and Editors")
|
||||
# C/C++
|
||||
for name,isC in {"C":True, "CPP":False}.items():
|
||||
@@ -74,8 +74,8 @@ def main():
|
||||
typeLines(editor, ["int main() {"])
|
||||
invokeMenuItem("File", "Save All")
|
||||
progressBarWait(15000)
|
||||
setRunInTerminal(1, 0, False)
|
||||
performDebugging(projectName, [singleTarget])
|
||||
setRunInTerminal(singleTarget, False)
|
||||
performDebugging(projectName)
|
||||
invokeMenuItem("File", "Close All Projects and Editors")
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
||||
@@ -89,14 +89,14 @@ def __handleAppOutputWaitForDebuggerFinish__():
|
||||
invokeMenuItem("Debug", "Abort Debugging")
|
||||
waitFor("str(appOutput.plainText).endswith('Debugging has finished')", 5000)
|
||||
|
||||
def performDebugging(projectName, checkedTargets):
|
||||
for kit, config in iterateBuildConfigs(len(checkedTargets), "Debug"):
|
||||
def performDebugging(projectName):
|
||||
for kit, config in iterateBuildConfigs("Debug"):
|
||||
test.log("Selecting '%s' as build config" % config)
|
||||
verifyBuildConfig(len(checkedTargets), kit, config, True, True)
|
||||
verifyBuildConfig(kit, config, True, True)
|
||||
waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton")
|
||||
invokeMenuItem("Build", "Rebuild All")
|
||||
waitForCompile()
|
||||
isMsvc = isMsvcConfig(len(checkedTargets), kit)
|
||||
isMsvc = isMsvcConfig(kit)
|
||||
clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton"))
|
||||
handleDebuggerWarnings(config, isMsvc)
|
||||
waitForObject(":Qt Creator.DebugModeWidget_QSplitter")
|
||||
|
@@ -129,7 +129,7 @@ def main():
|
||||
if test.verify(waitFor('fancyDebugButton.enabled', 5000), "Start Debugging is enabled."):
|
||||
# make sure QML Debugging is enabled
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(1, 0, ProjectSettings.RUN)
|
||||
switchToBuildOrRunSettingsFor(Targets.getDefaultKit(), ProjectSettings.RUN)
|
||||
ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' "
|
||||
"type='QCheckBox' unnamed='1' visible='1'}")
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
|
@@ -56,7 +56,7 @@ def main():
|
||||
earlyExit("Something went wrong opening Qml project - probably missing Qt5.")
|
||||
return
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(1, 0, ProjectSettings.RUN)
|
||||
switchToBuildOrRunSettingsFor(Targets.getDefaultKit(), ProjectSettings.RUN)
|
||||
ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' "
|
||||
"type='QCheckBox' unnamed='1' visible='1'}")
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
|
@@ -33,7 +33,7 @@ def main():
|
||||
workingDir = tempDir()
|
||||
# we need a Qt >= 5.3 - we use checkedTargets, so we should get only valid targets
|
||||
analyzerTargets = Targets.desktopTargetClasses()
|
||||
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=analyzerTargets)
|
||||
projectName = createNewQtQuickApplication(workingDir, targets=analyzerTargets)[1]
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
if placeCursorToLine(editor, "}"):
|
||||
type(editor, '<Left>')
|
||||
@@ -52,14 +52,14 @@ def main():
|
||||
'var j = i * i;',
|
||||
'console.log(j);'])
|
||||
invokeMenuItem("File", "Save All")
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug")
|
||||
availableConfigs = iterateBuildConfigs("Debug")
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (need Qt 5.3+) - leaving without debugging.")
|
||||
else:
|
||||
performTest(workingDir, projectName, len(checkedTargets), availableConfigs)
|
||||
performTest(workingDir, projectName, availableConfigs)
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
||||
def performTest(workingDir, projectName, targetCount, availableConfigs):
|
||||
def performTest(workingDir, projectName, availableConfigs):
|
||||
def __elapsedTime__(elapsedTimeLabelText):
|
||||
return float(re.search("Elapsed:\s+(-?\d+\.\d+) s", elapsedTimeLabelText).group(1))
|
||||
|
||||
@@ -67,7 +67,8 @@ def performTest(workingDir, projectName, targetCount, availableConfigs):
|
||||
# switching from MSVC to MinGW build will fail on the clean step of 'Rebuild All' because
|
||||
# of differences between MSVC's and MinGW's Makefile (so clean before switching kits)
|
||||
invokeMenuItem('Build', 'Clean Project "%s"' % projectName)
|
||||
qtVersion = verifyBuildConfig(targetCount, kit, config, True, True, True)
|
||||
verifyBuildConfig(kit, config, True, True, True)
|
||||
qtVersion = "5.6.1" if kit == Targets.DESKTOP_5_6_1_DEFAULT else "5.10.1"
|
||||
test.log("Selected kit using Qt %s" % qtVersion)
|
||||
# explicitly build before start debugging for adding the executable as allowed program to WinFW
|
||||
invokeMenuItem("Build", "Rebuild All")
|
||||
|
@@ -33,7 +33,7 @@ def main():
|
||||
targets = Targets.desktopTargetClasses()
|
||||
# using a temporary directory won't mess up a potentially existing
|
||||
workingDir = tempDir()
|
||||
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets)
|
||||
projectName = createNewQtQuickApplication(workingDir, targets=targets)[1]
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
if placeCursorToLine(editor, "}"):
|
||||
type(editor, '<Left>')
|
||||
@@ -54,13 +54,13 @@ def main():
|
||||
if result:
|
||||
expectedBreakpointsOrder = [{os.path.join(workingDir, projectName, "main.cpp"):10},
|
||||
{os.path.join(workingDir, projectName, "main.qml"):13}]
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug")
|
||||
availableConfigs = iterateBuildConfigs("Debug")
|
||||
progressBarWait()
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without debugging.")
|
||||
for kit, config in availableConfigs:
|
||||
test.log("Selecting '%s' as build config" % config)
|
||||
verifyBuildConfig(len(checkedTargets), kit, config, True, True, True)
|
||||
verifyBuildConfig(kit, config, True, True, True)
|
||||
# explicitly build before start debugging for adding the executable as allowed program to WinFW
|
||||
invokeMenuItem("Build", "Rebuild All")
|
||||
waitForCompile(300000)
|
||||
@@ -69,12 +69,12 @@ def main():
|
||||
continue
|
||||
if platform.system() in ('Microsoft' 'Windows'):
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(len(checkedTargets), kit, ProjectSettings.BUILD)
|
||||
switchToBuildOrRunSettingsFor(kit, ProjectSettings.BUILD)
|
||||
buildDir = os.path.join(str(waitForObject(":Qt Creator_Utils::BuildDirectoryLineEdit").text),
|
||||
"debug")
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
allowAppThroughWinFW(buildDir, projectName, None)
|
||||
if not doSimpleDebugging(len(checkedTargets), kit, config,
|
||||
if not doSimpleDebugging(kit, config,
|
||||
len(expectedBreakpointsOrder), expectedBreakpointsOrder):
|
||||
try:
|
||||
stopB = findObject(':Qt Creator.Stop_QToolButton')
|
||||
|
@@ -42,16 +42,16 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
checkedTargets = openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_4_8_7_DEFAULT])
|
||||
openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_4_8_7_DEFAULT])
|
||||
progressBarWait(30000)
|
||||
|
||||
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
|
||||
|
||||
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Release")
|
||||
availableConfigs = iterateBuildConfigs("Release")
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
selectBuildConfig(kit, config)
|
||||
buildConfig = buildConfigFromFancyToolButton(fancyToolButton)
|
||||
if buildConfig != config:
|
||||
test.fatal("Build configuration %s is selected instead of %s" % (buildConfig, config))
|
||||
|
@@ -37,9 +37,9 @@ def main():
|
||||
quick = "2.6"
|
||||
# using a temporary directory won't mess up a potentially existing
|
||||
workingDir = tempDir()
|
||||
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targ,
|
||||
minimumQtVersion=qtVersion,
|
||||
withControls = controls)
|
||||
checkedTargets = createNewQtQuickApplication(workingDir, targets=targ,
|
||||
minimumQtVersion=qtVersion,
|
||||
withControls = controls)[0]
|
||||
if len(checkedTargets) == 0:
|
||||
if controls and qtVersion < "5.7":
|
||||
test.xfail("Could not check wanted target.", "Quick Controls 2 wizard needs Qt5.7+")
|
||||
|
Reference in New Issue
Block a user