diff options
Diffstat (limited to 'tests/system')
-rw-r--r-- | tests/system/objects.map | 4 | ||||
-rw-r--r-- | tests/system/shared/build_utils.py | 28 | ||||
-rw-r--r-- | tests/system/shared/debugger.py | 22 | ||||
-rw-r--r-- | tests/system/shared/project.py | 40 | ||||
-rw-r--r-- | tests/system/suite_APTW/tst_APTW01/test.py | 4 | ||||
-rw-r--r-- | tests/system/suite_APTW/tst_APTW02/test.py | 4 | ||||
-rw-r--r-- | tests/system/suite_APTW/tst_APTW03/test.py | 11 | ||||
-rw-r--r-- | tests/system/suite_debugger/tst_debug_empty_main/test.py | 4 | ||||
-rw-r--r-- | tests/system/suite_debugger/tst_simple_debug/test.py | 4 | ||||
-rw-r--r-- | tests/system/suite_general/tst_build_speedcrunch/test.py | 5 |
10 files changed, 78 insertions, 48 deletions
diff --git a/tests/system/objects.map b/tests/system/objects.map index a222860aadc..074fc19ae7e 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -22,7 +22,6 @@ :Add Bookmark_BookmarkDialog {name='BookmarkDialog' type='BookmarkDialog' visible='1' windowTitle='Add Bookmark'} :Add to Version Control.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':Add to Version Control_QMessageBox'} :Add to Version Control_QMessageBox {text~='Add the file.*to version control (.*)?' type='QMessageBox' unnamed='1' visible='1'} -:Additional arguments:_QWidget {buddy=':Qt Creator.Additional arguments:_QLabel' type='QWidget' unnamed='1' visible='1'} :Analyzer Toolbar.AnalyzerManagerToolBox_QComboBox {container=':DebugModeWidget.Toolbar_QDockWidget' name='PerspectiveChooser' type='QComboBox' visible='1'} :Analyzer Toolbar.Clear_QToolButton {container=':DebugModeWidget.Toolbar_QDockWidget' toolTip='Discard data' type='QToolButton' unnamed='1' visible='1'} :Analyzer Toolbar.Elapsed:_QLabel {container=':DebugModeWidget.Toolbar_QDockWidget' text~='Elapsed: \\\\d+.\\\\d s' type='QLabel' unnamed='1' visible='1'} @@ -118,15 +117,12 @@ :QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'} :QML Debugging_QMessageBox {text='The option will only take effect if the project is recompiled. Do you want to recompile now?' type='QMessageBox' unnamed='1' visible='1'} :Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Additional arguments:_QLabel {text='Additional arguments:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.CloseDoc_QToolButton {toolTip?='Close Document *' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Compile Output_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'} :Qt Creator.Configure Project_QPushButton {text='Configure Project' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.DebugModeWidget_QSplitter {name='DebugModeWidget' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.DragDoc_QToolButton {toolTip='Drag to drag documents between splits' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Effective qmake call:_QLabel {text='Effective qmake call:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Effective qmake call:_QTextEdit {aboveWidget=':Additional arguments:_QWidget' leftWidget=':Qt Creator.Effective qmake call:_QLabel' type='QTextEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Events_QDockWidget {name='QmlProfiler.Statistics.DockDockWidget' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Events_QTabBar {aboveWidget=':Qt Creator.Events_QDockWidget' type='QTabBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'} diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index f74bea0df10..a58a1fa93d7 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -163,13 +163,17 @@ def selectBuildConfig(wantedKit, configName, afterSwitchTo=ViewConstants.EDIT): 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(currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, enableQmlDebug=False): +def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, + enableQmlDebug=False, buildSystem=None): selectBuildConfig(currentTarget, configName, None) ensureChecked(waitForObject(":scrollArea.Details_Utils::DetailsButton")) - ensureChecked("{leftWidget={text='Shadow build:' type='QLabel' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'} " - "type='QCheckBox' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", enableShadowBuild) + + if buildSystem == "qmake": + ensureChecked("{leftWidget={text='Shadow build:' type='QLabel' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'} " + "type='QCheckBox' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", enableShadowBuild) + buildCfCombo = waitForObject("{leftWidget=':scrollArea.Edit build configuration:_QLabel' " "type='QComboBox' unnamed='1' visible='1'}") if shouldBeDebug: @@ -184,11 +188,15 @@ def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShad pass # Since waitForObject waits for the object to be enabled, # it will wait here until compilation of the debug libraries has finished. + runCMakeButton = ("{type='QPushButton' text='Run CMake' unnamed='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}") if currentTarget not in (Targets.DESKTOP_4_8_7_DEFAULT, Targets.EMBEDDED_LINUX): qmlDebuggingCombo = findObject(':Qt Creator.QML debugging and profiling:_QComboBox') if selectFromCombo(qmlDebuggingCombo, 'Enable'): - # Don't rebuild now - clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) + if buildSystem is None or buildSystem == "CMake": # re-run cmake to apply + clickButton(waitForObject(runCMakeButton)) + elif buildSystem == "qmake": # Don't rebuild now + clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) try: problemFound = waitForObject("{window=':Qt Creator_Core::Internal::MainWindow' " "type='QLabel' name='problemLabel' visible='1'}", 1000) @@ -201,8 +209,10 @@ def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShad qmlDebuggingCombo = findObject(':Qt Creator.QML debugging and profiling:_QComboBox') if selectFromCombo(qmlDebuggingCombo, "Disable"): test.log("Qml debugging libraries are available - unchecked qml debugging.") - # Don't rebuild now - clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) + if buildSystem is None or buildSystem == "CMake": # re-run cmake to apply + clickButton(waitForObject(runCMakeButton)) + elif buildSystem == "qmake": # Don't rebuild now + clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton")) switchViewTo(ViewConstants.EDIT) diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index daf67db6aaf..39b184146e4 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -84,7 +84,7 @@ def setBreakpointsForCurrentProject(filesAndLines): editor = getEditorForFileSuffix(curFile, True) if not placeCursorToLine(editor, curLine, True): return None - invokeMenuItem("Debug", "Toggle Breakpoint") + invokeMenuItem("Debug", "Enable or Disable Breakpoint") filePath = str(waitForObjectExists(":Qt Creator_FilenameQComboBox").toolTip) breakPointList.append({filePath:lineNumberWithCursor(editor)}) test.log('Set breakpoint in %s' % curFile, curLine) @@ -175,8 +175,24 @@ def doSimpleDebugging(currentKit, currentConfigName, expectedBPOrder=[], enableQ def isMsvcConfig(currentKit): switchViewTo(ViewConstants.PROJECTS) switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.BUILD) - clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton")) - isMsvc = " -spec win32-msvc" in str(waitForObject(":Qt Creator.Effective qmake call:_QTextEdit").plainText) + + waitForObject(":Projects.ProjectNavigationTreeView") + bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView") + wantedKitName = Targets.getStringForTarget(currentKit) + 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) + toolTip = str(index.data(Qt.ToolTipRole).toString()) + compilerPattern = re.compile("<tr><td><b>Compiler:</b></td><td>(?P<compiler>.+)</td></tr>") + match = compilerPattern.search(toolTip) + if match is None: + test.warning("UI seems to have changed - failed to check for compiler.") + return False + + compiler = str(match.group("compiler")) + isMsvc = compiler.startswith("MSVC") or compiler.startswith("Microsoft Visual C") switchViewTo(ViewConstants.EDIT) return isMsvc diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index e5f4c4bc6b6..16570424b03 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2016 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. @@ -69,10 +69,8 @@ def openCmakeProject(projectPath, buildDir): invokeMenuItem("File", "Open File or Project...") selectFromFileDialog(projectPath) __chooseTargets__([]) # uncheck all - targetToChoose = Targets.DESKTOP_4_8_7_DEFAULT # FIXME make the intended target a parameter - if not qt4Available: - targetToChoose = Targets.DESKTOP_5_14_1_DEFAULT - __chooseTargets__([targetToChoose], additionalFunc=additionalFunction) + # FIXME make the intended target a parameter + __chooseTargets__([Targets.DESKTOP_5_14_1_DEFAULT], additionalFunc=additionalFunction) clickButton(waitForObject(":Qt Creator.Configure Project_QPushButton")) return True @@ -224,22 +222,31 @@ def __modifyAvailableTargets__(available, requiredQt, asStrings=False): if Qt5Path.toVersionTuple(found.group(1)) < Qt5Path.toVersionTuple(requiredQt): available.discard(currentItem) +def __getProjectFileName__(projectName, buildSystem): + if buildSystem is None or buildSystem == "CMake": + return "CMakeLists.txt" + else: + return projectName + (".pro" if buildSystem == "qmake" else ".qbs") + # Creates a Qt GUI project # param path specifies where to create the project # param projectName is the name for the new project # param checks turns tests in the function on if set to True -def createProject_Qt_GUI(path, projectName, checks = True, addToVersionControl = "<None>"): +# param addToVersionControl selects the specified VCS from Creator's wizard +# param buildSystem selects the specified build system from Creator's wizard +def createProject_Qt_GUI(path, projectName, checks=True, addToVersionControl="<None>", + buildSystem=None): template = "Qt Widgets Application" available = __createProjectOrFileSelectType__(" Application (Qt)", template) __createProjectSetNameAndPath__(path, projectName, checks) - buildSystem = __handleBuildSystem__(None) + buildSystem = __handleBuildSystem__(buildSystem) if checks: exp_filename = "mainwindow" h_file = exp_filename + ".h" cpp_file = exp_filename + ".cpp" ui_file = exp_filename + ".ui" - pro_file = projectName + ".pro" + projectFile = __getProjectFileName__(projectName, buildSystem) waitFor("object.exists(':headerFileLineEdit_Utils::FileNameValidatingLineEdit')", 20000) waitFor("object.exists(':sourceFileLineEdit_Utils::FileNameValidatingLineEdit')", 20000) @@ -259,7 +266,7 @@ def createProject_Qt_GUI(path, projectName, checks = True, addToVersionControl = path = os.path.abspath(path) path = os.path.join(path, projectName) expectedFiles = [path] - expectedFiles.extend(__sortFilenamesOSDependent__(["main.cpp", cpp_file, h_file, ui_file, pro_file])) + expectedFiles.extend(__sortFilenamesOSDependent__(["main.cpp", cpp_file, h_file, ui_file, projectFile])) __createProjectHandleLastPage__(expectedFiles, addToVersionControl) waitForProjectParsing() @@ -283,9 +290,9 @@ def createProject_Qt_Console(path, projectName, checks = True, buildSystem = Non path = os.path.abspath(path) path = os.path.join(path, projectName) cpp_file = "main.cpp" - pro_file = projectName + ".pro" + projectFile = __getProjectFileName__(projectName, buildSystem) expectedFiles = [path] - expectedFiles.extend(__sortFilenamesOSDependent__([cpp_file, pro_file])) + expectedFiles.extend(__sortFilenamesOSDependent__([cpp_file, projectFile])) __createProjectHandleLastPage__(expectedFiles) waitForProjectParsing() @@ -375,7 +382,8 @@ def createNewNonQtProject(workingDir, projectName, target, plainC=False, buildSy __createProjectHandleLastPage__() return projectName -def createNewCPPLib(projectDir, projectName, className, target, isStatic): + +def createNewCPPLib(projectDir, projectName, className, target, isStatic, buildSystem=None): available = __createProjectOrFileSelectType__(" Library", "C++ Library", False, True) if isStatic: libType = LibType.STATIC @@ -384,7 +392,7 @@ def createNewCPPLib(projectDir, projectName, className, target, isStatic): if projectDir == None: projectDir = tempDir() projectName = __createProjectSetNameAndPath__(projectDir, projectName, False) - __handleBuildSystem__(None) + __handleBuildSystem__(buildSystem) selectFromCombo(waitForObject("{name='Type' type='QComboBox' visible='1' " "window=':New_ProjectExplorer::JsonWizard'}"), LibType.getStringForLib(libType)) @@ -396,10 +404,12 @@ def createNewCPPLib(projectDir, projectName, className, target, isStatic): __createProjectHandleLastPage__() return projectName, className -def createNewQtPlugin(projectDir, projectName, className, target, baseClass="QGenericPlugin"): + +def createNewQtPlugin(projectDir, projectName, className, target, baseClass="QGenericPlugin", + buildSystem=None): available = __createProjectOrFileSelectType__(" Library", "C++ Library", False, True) projectName = __createProjectSetNameAndPath__(projectDir, projectName, False) - __handleBuildSystem__(None) + __handleBuildSystem__(buildSystem) selectFromCombo(waitForObject("{name='Type' type='QComboBox' visible='1' " "window=':New_ProjectExplorer::JsonWizard'}"), LibType.getStringForLib(LibType.QT_PLUGIN)) diff --git a/tests/system/suite_APTW/tst_APTW01/test.py b/tests/system/suite_APTW/tst_APTW01/test.py index ac833cffc93..cb03f38e1b8 100644 --- a/tests/system/suite_APTW/tst_APTW01/test.py +++ b/tests/system/suite_APTW/tst_APTW01/test.py @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2016 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. @@ -31,7 +31,7 @@ def main(): # warnings from the clang code model in "issues" view if not startCreatorVerifyingClang(False): return - createProject_Qt_GUI(tempDir(), "SampleApp") + createProject_Qt_GUI(tempDir(), "SampleApp", buildSystem="qmake") # run project for debug and release and verify results runVerify() #close Qt Creator diff --git a/tests/system/suite_APTW/tst_APTW02/test.py b/tests/system/suite_APTW/tst_APTW02/test.py index bff30f84e4e..e4f9a6d6ea1 100644 --- a/tests/system/suite_APTW/tst_APTW02/test.py +++ b/tests/system/suite_APTW/tst_APTW02/test.py @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2016 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. @@ -30,7 +30,7 @@ def main(): startQC() if not startedWithoutPluginError(): return - createNewQtQuickApplication(tempDir(), "SampleApp") + createNewQtQuickApplication(tempDir(), "SampleApp", buildSystem="qmake") # run project for debug and release and verify results runVerify() #close Qt Creator diff --git a/tests/system/suite_APTW/tst_APTW03/test.py b/tests/system/suite_APTW/tst_APTW03/test.py index 2a7c78bdde1..e18b67ea978 100644 --- a/tests/system/suite_APTW/tst_APTW03/test.py +++ b/tests/system/suite_APTW/tst_APTW03/test.py @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2016 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. @@ -65,9 +65,9 @@ def handleInsertVirtualFunctions(expected, toAdd): def checkSimpleCppLib(projectName, static): projectName, className = createNewCPPLib(tempDir(), projectName, "MyClass", Targets.desktopTargetClasses(), - static) + static, buildSystem="qmake") for kit, config in iterateBuildConfigs("Release"): - verifyBuildConfig(kit, config, False, True) + verifyBuildConfig(kit, config, False, True, buildSystem="qmake") invokeMenuItem('Build', 'Build Project "%s"' % projectName) waitForCompile(10000) checkCompile() @@ -87,10 +87,11 @@ def main(): checkSimpleCppLib("SampleApp2", True) pluginTargets = (Targets.DESKTOP_5_10_1_DEFAULT, Targets.DESKTOP_5_14_1_DEFAULT) - projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin", pluginTargets) + projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin", pluginTargets, + buildSystem="qmake") virtualFunctionsAdded = False for kit, config in iterateBuildConfigs("Debug"): - verifyBuildConfig(kit, config, True, True) + verifyBuildConfig(kit, config, True, True, buildSystem="qmake") invokeMenuItem('Build', 'Build Project "%s"' % projectName) waitForCompile(10000) if not virtualFunctionsAdded: diff --git a/tests/system/suite_debugger/tst_debug_empty_main/test.py b/tests/system/suite_debugger/tst_debug_empty_main/test.py index 3e0e456e921..4a2bd938288 100644 --- a/tests/system/suite_debugger/tst_debug_empty_main/test.py +++ b/tests/system/suite_debugger/tst_debug_empty_main/test.py @@ -98,7 +98,7 @@ def __handleAppOutputWaitForDebuggerFinish__(): def performDebugging(projectName): for kit, config in iterateBuildConfigs("Debug"): test.log("Selecting '%s' as build config" % config) - verifyBuildConfig(kit, config, True, True) + verifyBuildConfig(kit, config, True, True, buildSystem="qmake") waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton") selectFromLocator("t rebuild", "Rebuild (Rebuild All Projects)") waitForCompile() @@ -111,7 +111,7 @@ def performDebugging(projectName): editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") placeCursorToLine(editor, "int main.*", True) type(editor, "<Down>") - invokeMenuItem("Debug", "Toggle Breakpoint") + invokeMenuItem("Debug", "Enable or Disable Breakpoint") clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton")) handleDebuggerWarnings(config, isMsvc) clickButton(waitForObject(":*Qt Creator.Continue_Core::Internal::FancyToolButton")) diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index 7237e00aae0..8c9c71a8fc2 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -44,8 +44,8 @@ def main(): 'onTriggered: console.log("Break here")']) invokeMenuItem("File", "Save All") filesAndLines = [ - { "%s.Sources.main\\.cpp" % projectName : "QQmlApplicationEngine engine;" }, - { "%s.Resources.qml\.qrc./.main\\.qml" % projectName : 'onTriggered.*' } + { "%s.%s.Source Files.main\\.cpp" % (projectName, projectName) : "QQmlApplicationEngine engine;" }, + { "%s.%s.qml\.qrc./.main\\.qml" % (projectName, projectName) : 'onTriggered.*' } ] test.log("Setting breakpoints") expectedBreakpointsOrder = setBreakpointsForCurrentProject(filesAndLines) diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py index e98a9b0e9a5..3ebed1b67e8 100644 --- a/tests/system/suite_general/tst_build_speedcrunch/test.py +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -41,10 +41,7 @@ def main(): startQC() if not startedWithoutPluginError(): return - targetToChoose = Targets.DESKTOP_4_8_7_DEFAULT - if not qt4Available: - targetToChoose = Targets.DESKTOP_5_14_1_DEFAULT - openQmakeProject(SpeedCrunchPath, [targetToChoose]) + openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_5_14_1_DEFAULT]) waitForProjectParsing() fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton") |