2016-01-15 14:55:33 +01:00
|
|
|
# Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2013-05-15 13:17:33 +02:00
|
|
|
|
2012-03-26 14:13:39 +02:00
|
|
|
source("../../shared/qtcreator.py")
|
|
|
|
|
|
|
|
|
|
def main():
|
2018-08-22 14:37:34 +02:00
|
|
|
startQC()
|
2013-02-22 14:31:39 +01:00
|
|
|
if not startedWithoutPluginError():
|
|
|
|
|
return
|
2012-03-26 14:13:39 +02:00
|
|
|
# using a temporary directory won't mess up a potentially existing
|
|
|
|
|
workingDir = tempDir()
|
2018-08-02 12:05:19 +02:00
|
|
|
projectName = createNewQtQuickApplication(workingDir)[1]
|
2012-09-05 16:49:35 +02:00
|
|
|
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
2017-09-14 14:36:26 +02:00
|
|
|
if placeCursorToLine(editor, "}"):
|
|
|
|
|
type(editor, '<Left>')
|
|
|
|
|
type(editor, '<Return>')
|
2012-03-26 14:13:39 +02:00
|
|
|
type(editor, '<Up>')
|
|
|
|
|
type(editor, '<Return>')
|
2012-05-11 17:38:58 +02:00
|
|
|
typeLines(editor, ['Timer {',
|
|
|
|
|
'interval: 1000',
|
|
|
|
|
'running: true',
|
|
|
|
|
'onTriggered: console.log("Break here")'])
|
2012-03-26 14:13:39 +02:00
|
|
|
invokeMenuItem("File", "Save All")
|
2012-05-03 11:47:35 +02:00
|
|
|
filesAndLines = [
|
2023-02-16 14:15:40 +01:00
|
|
|
{ "%s.app%s.Source Files.main\\.cpp" % (projectName, projectName) : "QQmlApplicationEngine engine;" },
|
|
|
|
|
{ "%s.app%s.Main\\.qml" % (projectName, projectName) : 'onTriggered.*' }
|
2012-05-03 11:47:35 +02:00
|
|
|
]
|
2012-03-26 14:13:39 +02:00
|
|
|
test.log("Setting breakpoints")
|
2021-04-21 20:43:09 +02:00
|
|
|
expectedBreakpointsOrder = setBreakpointsForCurrentProject(filesAndLines)
|
|
|
|
|
if expectedBreakpointsOrder:
|
2018-08-02 11:26:43 +02:00
|
|
|
availableConfigs = iterateBuildConfigs("Debug")
|
2021-10-29 13:51:35 +02:00
|
|
|
if len(availableConfigs) > 1: # having just one config means no change, no progress bar
|
|
|
|
|
progressBarWait()
|
|
|
|
|
elif len(availableConfigs) == 0:
|
2016-07-20 15:40:38 +02:00
|
|
|
test.fatal("Haven't found a suitable Qt version - leaving without debugging.")
|
2012-10-29 19:22:43 +01:00
|
|
|
for kit, config in availableConfigs:
|
2012-03-26 14:13:39 +02:00
|
|
|
test.log("Selecting '%s' as build config" % config)
|
2018-08-02 11:26:43 +02:00
|
|
|
verifyBuildConfig(kit, config, True, True, True)
|
2012-03-26 14:13:39 +02:00
|
|
|
# explicitly build before start debugging for adding the executable as allowed program to WinFW
|
2022-10-11 10:54:51 +02:00
|
|
|
selectFromLocator("t rebuild", "Rebuild All Projects")
|
2014-01-21 17:29:35 +01:00
|
|
|
waitForCompile(300000)
|
2012-03-26 14:13:39 +02:00
|
|
|
if not checkCompile():
|
|
|
|
|
test.fatal("Compile had errors... Skipping current build config")
|
|
|
|
|
continue
|
2016-07-22 15:14:27 +02:00
|
|
|
if platform.system() in ('Microsoft' 'Windows'):
|
|
|
|
|
switchViewTo(ViewConstants.PROJECTS)
|
2018-08-02 11:26:43 +02:00
|
|
|
switchToBuildOrRunSettingsFor(kit, ProjectSettings.BUILD)
|
2023-03-07 12:41:36 +01:00
|
|
|
detailsWidget = waitForObject("{type='Utils::DetailsWidget' unnamed='1' visible='1' "
|
|
|
|
|
"summaryText~='^<b>Configure:</b>.+'}")
|
|
|
|
|
detailsButton = getChildByClass(detailsWidget, "QToolButton")
|
|
|
|
|
ensureChecked(detailsButton)
|
2016-07-22 15:14:27 +02:00
|
|
|
buildDir = os.path.join(str(waitForObject(":Qt Creator_Utils::BuildDirectoryLineEdit").text),
|
|
|
|
|
"debug")
|
|
|
|
|
switchViewTo(ViewConstants.EDIT)
|
|
|
|
|
allowAppThroughWinFW(buildDir, projectName, None)
|
2021-04-21 14:44:03 +02:00
|
|
|
if not doSimpleDebugging(kit, config, expectedBreakpointsOrder):
|
2012-03-26 14:13:39 +02:00
|
|
|
try:
|
|
|
|
|
stopB = findObject(':Qt Creator.Stop_QToolButton')
|
|
|
|
|
if stopB.enabled:
|
|
|
|
|
clickButton(stopB)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2016-07-22 15:14:27 +02:00
|
|
|
if platform.system() in ('Microsoft' 'Windows'):
|
|
|
|
|
deleteAppFromWinFW(buildDir, projectName, None)
|
2012-03-26 14:13:39 +02:00
|
|
|
# close application output window of current run to avoid mixing older output on the next run
|
|
|
|
|
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
|
|
|
|
|
clickButton(waitForObject("{type='CloseButton' unnamed='1' visible='1' "
|
|
|
|
|
"window=':Qt Creator_Core::Internal::MainWindow'}"))
|
2014-09-25 17:54:52 +02:00
|
|
|
try:
|
|
|
|
|
clickButton(waitForObject(":Close Debugging Session.Yes_QPushButton", 2000))
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2012-03-26 14:13:39 +02:00
|
|
|
else:
|
|
|
|
|
test.fatal("Setting breakpoints failed - leaving without testing.")
|
|
|
|
|
invokeMenuItem("File", "Exit")
|