From 7f6c48e0176ab1c723ad0fb428ce365ab2392e0b Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 25 Jul 2018 14:12:28 +0200 Subject: [PATCH 01/19] Debugger: Do not start the mixed engine on Attach to QML Server Task-number: QTCREATORBUG-20168 Change-Id: I6af3bf7f0f9ed2316d1382383a7889f55a16dea1 Reviewed-by: David Schulz --- src/plugins/debugger/debuggerruncontrol.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 98dbf5061a4..cd004f9a845 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -265,6 +265,7 @@ void DebuggerRunTool::setStartMode(DebuggerStartMode startMode) if (startMode == AttachToQmlServer) { m_runParameters.startMode = AttachToRemoteProcess; m_runParameters.isCppDebugging = false; + m_runParameters.cppEngineType = NoEngineType; m_runParameters.isQmlDebugging = true; m_runParameters.closeMode = KillAtClose; From cc25aa4cafbbb04cc652c79763c09ab7f584a4d5 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 25 Jul 2018 13:02:18 +0200 Subject: [PATCH 02/19] Environment: Do not leave stray ':' in LD_LIBRARY_PATH A empty path segment in LD_LIBRARY_PATH is *not* ignored and treated as '.' IIRC. So make sure to not leave a ':' in first place of LD_LIBRARY_PATH or set an empty LD_LIBRARY_PATH on Linux. Change-Id: I99ec2e333c6c0205334daf14ac6a2373c6e465ad Reviewed-by: Ulf Hermann --- src/libs/utils/environment.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index e8e8938739e..1efbc024dd1 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -49,8 +49,10 @@ public: toReplace.append(':'); toReplace.append(lib.path()); - if (ldLibraryPath.startsWith(toReplace)) - set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length())); + if (ldLibraryPath.startsWith(toReplace + ':')) + set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length() + 1)); + else if (ldLibraryPath == toReplace) + unset("LD_LIBRARY_PATH"); } } }; From 8e8598f2a34766880506f3cc4a3e4fb325eb29bb Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Tue, 24 Jul 2018 14:17:40 +0200 Subject: [PATCH 03/19] Coding Style: Update null pointer description to C++11 Task-number: QTCREATORBUG-20852 Change-Id: I150b8e815e137fee333b71d3b05c3a4d2a0038ba Reviewed-by: hjk Reviewed-by: Tobias Hunger --- doc/api/coding-style.qdoc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/api/coding-style.qdoc b/doc/api/coding-style.qdoc index 00143bcbb9a..3275dca8d4a 100644 --- a/doc/api/coding-style.qdoc +++ b/doc/api/coding-style.qdoc @@ -744,11 +744,10 @@ \section3 Null Pointers - Using a plain zero (0) for null pointer constants is always correct and - least effort to type. + Use nullptr for null pointer constants. \code - void *p = 0; + void *p = nullptr; -NOT- @@ -764,7 +763,7 @@ \endcode \note As an exception, imported third party code as well as code - interfacing the native APIs (src/support/os_*) can use NULL. + interfacing the native APIs (src/support/os_*) can use NULL or 0. \section2 C++11 and C++14 Features From 5787ecb025c668c988e5bb4881c307b0df1a7e2f Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 26 Jul 2018 13:05:21 +0200 Subject: [PATCH 04/19] Revert "Wizards: Drop support for Qt4 for widgets application" This reverts commit 1a6522b47c7eb667d297c71a48751e22f7069c04 which leaves people wondering about their kit setups. Creating a project that possibly does not compile due to the use of C++11's nullptr in the generated code is lesser evil. Apart from that this potential mis-compilation does not happen in practice on e.g. Ubuntu 18.04 with system Qt 4 and system compiler. Change-Id: Iaa90f225d5317dc48428aa2d3fcf3ec051ef2018 Reviewed-by: Christian Stenger --- src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp | 3 +-- src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp index 88aa8989495..fd6cbc475e0 100644 --- a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp @@ -78,8 +78,7 @@ GuiAppWizard::GuiAppWizard() "Includes a Qt Designer-based main window.\n\n" "Preselects a desktop Qt for building the application if available.")); setIcon(QIcon(QLatin1String(":/wizards/images/gui.png"))); - auto qt5 = Core::Id::fromString(QString(QtSupport::Constants::FEATURE_QT_PREFIX).append(".5")); - setRequiredFeatures({QtSupport::Constants::FEATURE_QWIDGETS, qt5}); + setRequiredFeatures({QtSupport::Constants::FEATURE_QWIDGETS}); } Core::BaseFileWizard *GuiAppWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp index 0bdf1a3a7de..5f12fdc41a0 100644 --- a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp @@ -84,7 +84,6 @@ QtProjectParameters GuiAppWizardDialog::projectParameters() const rc.path = path(); rc.selectedModules = selectedModulesList(); rc.deselectedModules = deselectedModulesList(); - rc.qtVersionSupport = QtProjectParameters::SupportQt5Only; return rc; } From 210a873efbf99d3e1c9b39387a697382ba254b24 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 24 Jul 2018 13:47:25 +0200 Subject: [PATCH 05/19] Squish: Forward qbs' warnings about deprecated features Change-Id: Ib99713b95d010acf4b49065ad7e20862e59476d1 Reviewed-by: Christian Stenger --- tests/system/shared/build_utils.py | 10 ++++++---- tests/system/suite_general/tst_opencreator_qbs/test.py | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index 964cec2458d..5c40c92cc29 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -25,6 +25,11 @@ import re; +def getBuildIssues(): + ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton") + model = waitForObject(":Qt Creator.Issues_QListView").model() + return dumpBuildIssues(model) + # this method checks the last build (if there's one) and logs the number of errors, warnings and # lines within the Issues output # param expectedToFail can be used to tell this function if the build was expected to fail or not @@ -36,16 +41,13 @@ def checkLastBuild(expectedToFail=False, createTasksFileOnError=True): except LookupError: test.log("checkLastBuild called without a build") return - ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton") - model = waitForObject(":Qt Creator.Issues_QListView").model() - buildIssues = dumpBuildIssues(model) + buildIssues = getBuildIssues() types = map(lambda i: i[5], buildIssues) errors = types.count("1") warnings = types.count("2") gotErrors = errors != 0 test.verify(not (gotErrors ^ expectedToFail), "Errors: %s | Warnings: %s" % (errors, warnings)) # additional stuff - could be removed... or improved :) - test.log("Rows inside issues: %d" % model.rowCount()) if gotErrors and createTasksFileOnError: createTasksFile(buildIssues) return not gotErrors diff --git a/tests/system/suite_general/tst_opencreator_qbs/test.py b/tests/system/suite_general/tst_opencreator_qbs/test.py index a20426d3599..3b7a86a42b4 100644 --- a/tests/system/suite_general/tst_opencreator_qbs/test.py +++ b/tests/system/suite_general/tst_opencreator_qbs/test.py @@ -46,4 +46,9 @@ def main(): else: test.warning("Parsing project timed out") compareProjectTree(rootNodeTemplate % "Qt Creator", "projecttree_creator.tsv") + buildIssuesTexts = map(lambda i: str(i[3]), getBuildIssues()) + deprecationWarnings = filter(lambda s: "deprecated" in s, buildIssuesTexts) + if deprecationWarnings: + test.warning("Creator claims that the .qbs file uses deprecated features.", + "\n".join(set(deprecationWarnings))) invokeMenuItem("File", "Exit") From 3f97874ca1056bca0baf8876466fbb8c8cd61971 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 26 Jul 2018 14:04:17 +0200 Subject: [PATCH 06/19] Squish: Fix tests after revert The patch that removed Qt4 completely from the widget app wizard has been reverted. Adjusting the tests now. Change-Id: I0af1eb2102caa22022658d1189794c7757c7628f Reviewed-by: Robert Loehning --- tests/system/shared/project.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 313ace186cc..71b493c5463 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -156,8 +156,12 @@ def __createProjectHandleQtQuickSelection__(minimumQtVersion): # Selects the Qt versions for a project # param checks turns tests in the function on if set to True # param available a list holding the available targets -def __selectQtVersionDesktop__(checks, available=None): - checkedTargets = __chooseTargets__(Targets.desktopTargetClasses(), available) +# withoutQt4 if True Qt4 will get unchecked / not selected while checking the targets +def __selectQtVersionDesktop__(checks, available=None, withoutQt4=False): + wanted = Targets.desktopTargetClasses() + if withoutQt4 and Targets.DESKTOP_4_8_7_DEFAULT in wanted: + wanted.remove(Targets.DESKTOP_4_8_7_DEFAULT) + checkedTargets = __chooseTargets__(wanted, available) if checks: for target in checkedTargets: detailsWidget = waitForObject("{type='Utils::DetailsWidget' unnamed='1' visible='1' " @@ -216,7 +220,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) + checkedTargets = __selectQtVersionDesktop__(checks, available, True) if checks: exp_filename = "mainwindow" @@ -541,7 +545,7 @@ def __getSupportedPlatforms__(text, templateName, getAsStrings=False): supports = text[text.find('Supported Platforms'):].split(":")[1].strip().split(" ") result = [] if 'Desktop' in supports: - if (version == None or version < "5.0") and templateName != "Qt Widgets Application": + if (version == None or version < "5.0"): result.append(Targets.DESKTOP_4_8_7_DEFAULT) if platform.system() in ("Linux", "Darwin"): result.append(Targets.EMBEDDED_LINUX) From 7cc5376f0dbbcb2a2b8ba7e93373d9d4613e1e2d Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 27 Jul 2018 15:32:44 +0200 Subject: [PATCH 07/19] Squish: Fix handling of server issues in tst_codepasting Change-Id: I35d8dbeb11be104a1af2956125a29c4606c7e050 Reviewed-by: Christian Stenger --- .../suite_tools/tst_codepasting/test.py | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index 998b36bf84f..160353b2c5d 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -43,15 +43,20 @@ def invalidPasteId(protocol): return -1 def closeHTTPStatusAndPasterDialog(protocol, pasterDialog): - mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol - mBox = waitForObject(mBoxStr, 1000) - text = str(mBox.text) - # close message box and paster window - clickButton("{type='QPushButton' text='Cancel' visible='1' window=%s}" % mBoxStr) - clickButton("{type='QPushButton' text='Cancel' visible='1' window='%s'}" % pasterDialog) - if 'Service Unavailable' in text: - test.warning(text) - return True + try: + mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol + mBox = waitForObject(mBoxStr, 1000) + text = str(mBox.text) + # close message box and paster window + clickButton("{type='QPushButton' text='Cancel' visible='1' window=%s}" % mBoxStr) + clickButton("{type='QPushButton' text='Cancel' visible='1' window='%s'}" % pasterDialog) + if 'Service Unavailable' in text: + test.warning(text) + return True + except: + t,v = sys.exc_info()[:2] + test.warning("An exception occurred in closeHTTPStatusAndPasterDialog(): %s(%s)" + % (str(t), str(v))) test.log("Closed dialog without expected error.", text) return False @@ -90,11 +95,9 @@ def pasteFile(sourceFile, protocol): output = str(outputWindow.plainText).splitlines()[-1] except: output = "" - try: - if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'): - raise Exception(serverProblems) - except: - pass + if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'): + resetFiles() + raise Exception(serverProblems) stdErrOut = aut.readStderr() match = re.search("^%s protocol error: (.*)$" % protocol, stdErrOut, re.MULTILINE) if match: @@ -123,11 +126,8 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting): try: pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model() except: - try: - if closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog'): - return -1 - except: - pass + closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog') + return -1 waitFor("pasteModel.rowCount() > 1", 20000) if (not skippedPasting and not protocol == NAME_PBCA and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))): From 8c0042da40c13c1ad5cf768e2e019f6d2a3f06e8 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 27 Jul 2018 15:43:55 +0200 Subject: [PATCH 08/19] Squish: Use sections for services in tst_codepasting Change-Id: If97331e3a18f44ca82ad81c7609dc3162caf5254 Reviewed-by: Christian Stenger --- .../suite_tools/tst_codepasting/test.py | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index 160353b2c5d..b2df4f9943a 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -177,44 +177,45 @@ def main(): openGeneralMessages() clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) for protocol in protocolsToTest: - skippedPasting = True - description = "Paste from 2017-05-11" - if protocol == NAME_KDE: - pasteId = "pysjk6n2i" - pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp")) - elif skipPastingToPastebinCom and protocol == NAME_PBCOM: - pasteId = "8XHP0ZgH" - pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp")) - else: - skippedPasting = False - try: - pasteId, description, pastedText = pasteFile(sourceFile, protocol) - except Exception as e: - if e.message == serverProblems: - test.warning("Ignoring server side issues") + with TestSection(protocol): + skippedPasting = True + description = "Paste from 2017-05-11" + if protocol == NAME_KDE: + pasteId = "pysjk6n2i" + pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp")) + elif skipPastingToPastebinCom and protocol == NAME_PBCOM: + pasteId = "8XHP0ZgH" + pastedText = readFile(os.path.join(os.getcwd(), "testdata", "main-prepasted.cpp")) + else: + skippedPasting = False + try: + pasteId, description, pastedText = pasteFile(sourceFile, protocol) + except Exception as e: + if e.message == serverProblems: + test.warning("Ignoring server side issues") + continue + else: # if it was not our own exception re-raise + raise e + if not pasteId: + test.fatal("Could not get id of paste to %s" % protocol) continue - else: # if it was not our own exception re-raise - raise e - if not pasteId: - test.fatal("Could not get id of paste to %s" % protocol) + pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting) + if pasteId == -1: continue - pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting) - if pasteId == -1: - continue - filenameCombo = waitForObject(":Qt Creator_FilenameQComboBox") - waitFor("not filenameCombo.currentText.isEmpty()", 20000) - try: - editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") - except: - outputWindow = waitForObject(":Qt Creator_Core::OutputWindow") - test.fail("Could not find editor with snippet", str(outputWindow.plainText)) - clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) - continue - test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor") - if protocol in (NAME_KDE, NAME_PBCOM) and pastedText.endswith("\n"): - pastedText = pastedText[:-1] - test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same") - invokeMenuItem("File", "Close All") + filenameCombo = waitForObject(":Qt Creator_FilenameQComboBox") + waitFor("not filenameCombo.currentText.isEmpty()", 20000) + try: + editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") + except: + outputWindow = waitForObject(":Qt Creator_Core::OutputWindow") + test.fail("Could not find editor with snippet", str(outputWindow.plainText)) + clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) + continue + test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor") + if protocol in (NAME_KDE, NAME_PBCOM) and pastedText.endswith("\n"): + pastedText = pastedText[:-1] + test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same") + invokeMenuItem("File", "Close All") invokeMenuItem("File", "Open File or Project...") selectFromFileDialog(sourceFile) editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") From 6d7eb57e750d63d350b9aedddb3eacb50e961a22 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 27 Jul 2018 16:16:12 +0200 Subject: [PATCH 09/19] Squish: Test pasting with pastebin.com Yes, there are only ten pastes per IP per day. But doesn't that mean that nobody can rely on it being availabe anyway? So it's better to use some of those ten pastes for testing instead of not testing pasting at all. Change-Id: I45362e5ab0c3eb43f1ddd18d4be39474e26c8460 Reviewed-by: Christian Stenger --- .../system/suite_tools/tst_codepasting/test.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index b2df4f9943a..b91ce2e5585 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -25,10 +25,14 @@ source("../../shared/qtcreator.py") import random +from datetime import date + +def __platformToBeRunToday__(): + return (('Linux'), ('Darwin'), ('Microsoft', 'Windows'))[date.today().day % 3] # Be careful with Pastebin.Com, there are only 10 pastes per 24h # for all machines using the same IP-address like you. -skipPastingToPastebinCom = True +skipPastingToPastebinCom = platform.system() not in __platformToBeRunToday__() NAME_KDE = "Paste.KDE.Org" NAME_PBCA = "Pastebin.Ca" @@ -197,8 +201,16 @@ def main(): else: # if it was not our own exception re-raise raise e if not pasteId: - test.fatal("Could not get id of paste to %s" % protocol) - continue + message = "Could not get id of paste to %s" % protocol + if protocol == NAME_PBCOM: + test.log("%s, using prepasted file instead" % message) + skippedPasting = True + pasteId = "8XHP0ZgH" + pastedText = readFile(os.path.join(os.getcwd(), + "testdata", "main-prepasted.cpp")) + else: + test.fatal(message) + continue pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting) if pasteId == -1: continue From 01aafd8021de9afc80a13bd48bb5cbe59d90295a Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 31 Jul 2018 08:21:18 +0200 Subject: [PATCH 10/19] Squish: Redo readFile() Change-Id: Ife8f951aa8fc86403197318b55db725ed3259336 Reviewed-by: Christian Stenger Reviewed-by: Robert Loehning --- tests/system/shared/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index e89e969a7e0..590b277a1e6 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -605,10 +605,8 @@ def progressBarWait(timeout=60000, warn=True): checkIfObjectExists(":Qt Creator_Core::Internal::ProgressBar", False, timeout) def readFile(filename): - f = open(filename, "r") - content = f.read() - f.close() - return content + with open(filename, "r") as f: + return f.read() def simpleFileName(navigatorFileName): # try to find the last part of the given name, assume it's inside a (folder) structure From e8acb75115723dce6af4079efa0c3fd1d2a2936f Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 2 Aug 2018 11:26:43 +0200 Subject: [PATCH 11/19] 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 Reviewed-by: Christian Stenger --- tests/system/objects.map | 2 - tests/system/shared/build_utils.py | 36 ++-- tests/system/shared/classes.py | 7 + tests/system/shared/debugger.py | 23 ++- tests/system/shared/project.py | 25 ++- tests/system/shared/project_explorer.py | 162 +++++------------- tests/system/suite_APTW/tst_APTW01/test.py | 4 +- tests/system/suite_APTW/tst_APTW02/test.py | 4 +- tests/system/suite_APTW/tst_APTW03/test.py | 20 +-- tests/system/suite_CCOM/tst_CCOM01/test.py | 6 +- tests/system/suite_SCOM/tst_SCOM01/test.py | 6 +- tests/system/suite_SCOM/tst_SCOM04/test.py | 6 +- .../tst_build_new_project/test.py | 6 +- .../tst_cli_output_console/test.py | 12 +- .../tst_debug_empty_main/test.py | 16 +- .../suite_debugger/tst_qml_js_console/test.py | 2 +- .../suite_debugger/tst_qml_locals/test.py | 2 +- .../suite_debugger/tst_simple_analyze/test.py | 11 +- .../suite_debugger/tst_simple_debug/test.py | 10 +- .../tst_build_speedcrunch/test.py | 6 +- .../tst_qtquick_creation/test.py | 6 +- 21 files changed, 149 insertions(+), 223 deletions(-) diff --git a/tests/system/objects.map b/tests/system/objects.map index ffc6e4753fe..0fdd7e14272 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -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'} diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index 5c40c92cc29..d2d1f596007 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -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() diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index 398928366e2..c4db7046e28 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -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 diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index 0ff993d27d5..b3cf7988a99 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -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: diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 71b493c5463..bd798461022 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -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="", 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__() diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index df67ee25ee2..336d82fc485 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -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("

Click to activate:

") + or str(kit.toolTip).startswith("

Kit is unsuited for project

")) -# 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("

Click to activate:

") - or str(kit.toolTip).startswith("

Kit is unsuited for project

")) - - 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?='qmake: 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) diff --git a/tests/system/suite_APTW/tst_APTW01/test.py b/tests/system/suite_APTW/tst_APTW01/test.py index e6fcc937c12..52ae22b787f 100644 --- a/tests/system/suite_APTW/tst_APTW01/test.py +++ b/tests/system/suite_APTW/tst_APTW01/test.py @@ -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") diff --git a/tests/system/suite_APTW/tst_APTW02/test.py b/tests/system/suite_APTW/tst_APTW02/test.py index 6294be9edda..dd76b788d3e 100644 --- a/tests/system/suite_APTW/tst_APTW02/test.py +++ b/tests/system/suite_APTW/tst_APTW02/test.py @@ -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") diff --git a/tests/system/suite_APTW/tst_APTW03/test.py b/tests/system/suite_APTW/tst_APTW03/test.py index 905dea914e4..022c1ba8130 100644 --- a/tests/system/suite_APTW/tst_APTW03/test.py +++ b/tests/system/suite_APTW/tst_APTW03/test.py @@ -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 diff --git a/tests/system/suite_CCOM/tst_CCOM01/test.py b/tests/system/suite_CCOM/tst_CCOM01/test.py index 6e75e634f2e..432c916cb86 100755 --- a/tests/system/suite_CCOM/tst_CCOM01/test.py +++ b/tests/system/suite_CCOM/tst_CCOM01/test.py @@ -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") diff --git a/tests/system/suite_SCOM/tst_SCOM01/test.py b/tests/system/suite_SCOM/tst_SCOM01/test.py index 7be524372d2..593ef2e6fd7 100644 --- a/tests/system/suite_SCOM/tst_SCOM01/test.py +++ b/tests/system/suite_SCOM/tst_SCOM01/test.py @@ -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")) diff --git a/tests/system/suite_SCOM/tst_SCOM04/test.py b/tests/system/suite_SCOM/tst_SCOM04/test.py index a2590b6740e..1fbf2088f0c 100644 --- a/tests/system/suite_SCOM/tst_SCOM04/test.py +++ b/tests/system/suite_SCOM/tst_SCOM04/test.py @@ -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")) diff --git a/tests/system/suite_debugger/tst_build_new_project/test.py b/tests/system/suite_debugger/tst_build_new_project/test.py index 93cfaa8d035..f977435328e 100644 --- a/tests/system/suite_debugger/tst_build_new_project/test.py +++ b/tests/system/suite_debugger/tst_build_new_project/test.py @@ -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() diff --git a/tests/system/suite_debugger/tst_cli_output_console/test.py b/tests/system/suite_debugger/tst_cli_output_console/test.py index 1add5fe028c..298fdb8dfc5 100644 --- a/tests/system/suite_debugger/tst_cli_output_console/test.py +++ b/tests/system/suite_debugger/tst_cli_output_console/test.py @@ -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") 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 be7f15fc2f8..d49f77e4542 100644 --- a/tests/system/suite_debugger/tst_debug_empty_main/test.py +++ b/tests/system/suite_debugger/tst_debug_empty_main/test.py @@ -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") diff --git a/tests/system/suite_debugger/tst_qml_js_console/test.py b/tests/system/suite_debugger/tst_qml_js_console/test.py index 7187fc9ceaa..7022b09cd5f 100644 --- a/tests/system/suite_debugger/tst_qml_js_console/test.py +++ b/tests/system/suite_debugger/tst_qml_js_console/test.py @@ -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) diff --git a/tests/system/suite_debugger/tst_qml_locals/test.py b/tests/system/suite_debugger/tst_qml_locals/test.py index d78e02d48f7..06a60bb1166 100644 --- a/tests/system/suite_debugger/tst_qml_locals/test.py +++ b/tests/system/suite_debugger/tst_qml_locals/test.py @@ -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) diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py index 8b73e7aa722..89eeee73d14 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/test.py +++ b/tests/system/suite_debugger/tst_simple_analyze/test.py @@ -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, '') @@ -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") diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index c726d6468bb..b203c963897 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -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, '') @@ -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') diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py index 686943b422a..ef51997c7f9 100644 --- a/tests/system/suite_general/tst_build_speedcrunch/test.py +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -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)) diff --git a/tests/system/suite_qtquick/tst_qtquick_creation/test.py b/tests/system/suite_qtquick/tst_qtquick_creation/test.py index 0289d277834..584235282fa 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation/test.py @@ -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+") From da21353276e209049f05f59dce7f90ac04753dda Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 2 Aug 2018 12:05:19 +0200 Subject: [PATCH 12/19] Squish: Don't explicitly pass default to createNewQtQuickApplication Change-Id: I006c6cad0e972006475ad488b9a71def09de0dbb Reviewed-by: Christian Stenger --- tests/system/suite_debugger/tst_simple_analyze/test.py | 4 +--- tests/system/suite_debugger/tst_simple_debug/test.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py index 89eeee73d14..b752a4b586f 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/test.py +++ b/tests/system/suite_debugger/tst_simple_analyze/test.py @@ -31,9 +31,7 @@ def main(): return # using a temporary directory won't mess up a potentially existing workingDir = tempDir() - # we need a Qt >= 5.3 - we use checkedTargets, so we should get only valid targets - analyzerTargets = Targets.desktopTargetClasses() - projectName = createNewQtQuickApplication(workingDir, targets=analyzerTargets)[1] + projectName = createNewQtQuickApplication(workingDir)[1] editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") if placeCursorToLine(editor, "}"): type(editor, '') diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index b203c963897..9067361c28f 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -29,11 +29,9 @@ def main(): startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - # Requires Qt 4.8 - targets = Targets.desktopTargetClasses() # using a temporary directory won't mess up a potentially existing workingDir = tempDir() - projectName = createNewQtQuickApplication(workingDir, targets=targets)[1] + projectName = createNewQtQuickApplication(workingDir)[1] editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") if placeCursorToLine(editor, "}"): type(editor, '') From f6f8bc5d959bcd534f2fafbe708a82dc7d60b974 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 3 Aug 2018 10:43:55 +0200 Subject: [PATCH 13/19] Update qbs submodule To HEAD of 1.12 branch. Change-Id: I44bf654eb81a30f44055b366c21dca10fded37c4 Reviewed-by: Joerg Bornemann --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 2440b19b288..66131652f17 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 2440b19b288096e1601674de2ac15c560af469cd +Subproject commit 66131652f178cd1605b8a2c0ba7023392e13ad5a From 8353a6ed20dec674211c6f1cbc37868fab929a36 Mon Sep 17 00:00:00 2001 From: Sergey Belyashov Date: Mon, 30 Jul 2018 14:21:09 +0300 Subject: [PATCH 14/19] Improve Russian translation Change-Id: Ib632fb9f5efe97a1913f9a0c09512b6b99ef2b6e Reviewed-by: Denis Shienkov --- share/qtcreator/translations/qtcreator_ru.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index d87d7c58874..4a7e7ca9620 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -303,7 +303,7 @@ The minimum API level required by the kit is %1. Android run settings - Настройки запуска Android + Настройки запуска под Android The project file "%1" is currently being parsed. @@ -357,7 +357,7 @@ The minimum API level required by the kit is %1. Install the missing emulator tool (%1) to the installed Android SDK. - Установите отсутствующую утилиту эмуляции (%1) в установленный Android SDK. + Установите утилиту эмуляции (%1) в установленный Android SDK. @@ -929,7 +929,7 @@ Do you want to uninstall the existing package? Cannot attach jdb to the running application - Не удалось подключить jdb к работающему приложению + Не удалось подключить jdb к запущенному приложению "%1" died. @@ -1909,7 +1909,7 @@ Executable: %2 Select on what grouping the tests should be based. - Выберите основание для группировки тестов. + Выберите критерий для группировки тестов. Directory @@ -14156,7 +14156,7 @@ You can choose between waiting longer or aborting debugging. Attached to running application. - Присоединено к работающему приложению. + Присоединено к запущенному приложению. Failed to attach to application: %1 From 787c4fc21e43959a25ff63c120214c663e1fa96b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 2 Aug 2018 22:07:26 +0300 Subject: [PATCH 15/19] GDB: Escape quotes on breakpoint commands The commands are wrapped in quotes, and if they contain quotes it gets messed up. Change-Id: I41cebd8cf4a57a8ea671e5f43a3295af1c73fd02 Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 263211a5988..81af51a3cc6 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2603,9 +2603,13 @@ void GdbEngine::changeBreakpoint(Breakpoint bp) cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }; } else if (data.command != response.command) { cmd.function = "-break-commands " + bpnr; - foreach (const QString &command, data.command.split(QLatin1String("\n"))) { - if (!command.isEmpty()) + for (QString command : data.command.split('\n')) { + if (!command.isEmpty()) { + // escape backslashes and quotes + command.replace('\\', "\\\\"); + command.replace('"', "\\\""); cmd.function += " \"" + command + '"'; + } } cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakIgnore(r, bp); }; } else if (!data.conditionsMatch(response.condition)) { From e3a0a710c62638ad3d2361d8037aa456a3adc9e0 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 6 Aug 2018 08:40:41 +0200 Subject: [PATCH 16/19] TextEditor: fix crash while request follow symbol and typing on mac Use a qobject_cast to prevent accessing a not available function. Task-number: QTCREATORBUG-20910 Change-Id: If2aa6b7b120379681e9590db80904c45a6d9bd55 Reviewed-by: Christian Stenger --- src/plugins/cpptools/cppvirtualfunctionassistprovider.h | 1 + src/plugins/texteditor/codeassist/codeassistant.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/cpptools/cppvirtualfunctionassistprovider.h b/src/plugins/cpptools/cppvirtualfunctionassistprovider.h index 52734bd71bb..83de52594b9 100644 --- a/src/plugins/cpptools/cppvirtualfunctionassistprovider.h +++ b/src/plugins/cpptools/cppvirtualfunctionassistprovider.h @@ -40,6 +40,7 @@ namespace CppTools { class CPPTOOLS_EXPORT VirtualFunctionAssistProvider : public TextEditor::IAssistProvider { + Q_OBJECT public: VirtualFunctionAssistProvider(); diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index 4a5a23bf4d7..3cbd99b5177 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -512,7 +512,7 @@ bool CodeAssistantPrivate::isDestroyEvent(int key, const QString &keyText) { if (keyText.isEmpty()) return key != Qt::LeftArrow && key != Qt::RightArrow && key != Qt::Key_Shift; - else if (auto *provider = dynamic_cast(m_requestProvider)) + if (auto *provider = qobject_cast(m_requestProvider)) return !provider->isContinuationChar(keyText.at(0)); return false; } From 18617668a02444e3591598cf2f0ff1f5783fd4e6 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 2 Aug 2018 15:49:02 +0200 Subject: [PATCH 17/19] AutoTest: Avoid crash in illegal state While debugging tests we rely on some states of the debugger. If anything goes wrong we might end in an illegal state on our side as well. This would then result in a crash. Avoid nullptr access and try to recover from illegal state. Change-Id: If8ca396a6e456d2f37777eba86f320643fbcd275 Reviewed-by: David Schulz --- src/plugins/autotest/testrunner.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 923149c5a09..ef92b911dc8 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -239,7 +239,8 @@ void TestRunner::cancelCurrent(TestRunner::CancelReason reason) void TestRunner::onProcessFinished() { - if (m_currentConfig) { + if (m_executingTests && QTC_GUARD(m_currentConfig)) { + QTC_CHECK(m_fakeFutureInterface); m_fakeFutureInterface->setProgressValue(m_fakeFutureInterface->progressValue() + m_currentConfig->testCaseCount()); if (!m_fakeFutureInterface->isCanceled()) { @@ -258,6 +259,10 @@ void TestRunner::onProcessFinished() } resetInternalPointers(); + if (!m_fakeFutureInterface) { + QTC_ASSERT(!m_executingTests, m_executingTests = false); + return; + } if (!m_selectedTests.isEmpty() && !m_fakeFutureInterface->isCanceled()) scheduleNext(); else From c1f78335e005b311ce3eac94ca48cc573f50a56d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 2 Aug 2018 15:56:26 +0200 Subject: [PATCH 18/19] AutoTest: Disconnect signal after being processed When debugging a test the run control outlives the connection and the signal can be triggered again and again which results in warnings on the command line. Do not rely on run control handling things for us, instead disconnect the signal after it had been processed. Change-Id: I704fd110bce3b387ee419a3f83bf904f2687a435 Reviewed-by: David Schulz --- src/plugins/autotest/testrunner.cpp | 6 ++++-- src/plugins/autotest/testrunner.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index ef92b911dc8..0b774c6c7a5 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -558,8 +558,9 @@ void TestRunner::debugTests() outputreader, &QObject::deleteLater); } - connect(this, &TestRunner::requestStopTestRun, runControl, - &ProjectExplorer::RunControl::initiateStop); + m_stopDebugConnect = connect(this, &TestRunner::requestStopTestRun, + runControl, &ProjectExplorer::RunControl::initiateStop); + connect(runControl, &ProjectExplorer::RunControl::stopped, this, &TestRunner::onFinished); ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl); } @@ -618,6 +619,7 @@ void TestRunner::onFinished() qDeleteAll(m_selectedTests); m_selectedTests.clear(); + disconnect(m_stopDebugConnect); disconnect(m_targetConnect); m_fakeFutureInterface = nullptr; m_executingTests = false; diff --git a/src/plugins/autotest/testrunner.h b/src/plugins/autotest/testrunner.h index 11fc9815d6f..ae4fc7c0d52 100644 --- a/src/plugins/autotest/testrunner.h +++ b/src/plugins/autotest/testrunner.h @@ -99,6 +99,8 @@ private: // temporarily used if building before running is necessary QMetaObject::Connection m_buildConnect; + // temporarily used when debugging + QMetaObject::Connection m_stopDebugConnect; // temporarily used for handling of switching the current target QMetaObject::Connection m_targetConnect; }; From ff10f8c3a58c2c57e221e294d5c4829c3fd05c15 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 2 Aug 2018 13:45:34 +0200 Subject: [PATCH 19/19] Squish: Fix warnings Warnings from static code checks, that is, not test.warning() at runtime. Change-Id: I651d13491106583908059ecdb5f700f539b6d9c8 Reviewed-by: Christian Stenger --- tests/system/shared/build_utils.py | 2 +- tests/system/shared/classes.py | 1 - tests/system/shared/debugger.py | 6 ++---- tests/system/shared/editor_utils.py | 7 +++---- tests/system/shared/project_explorer.py | 4 ++-- tests/system/shared/utils.py | 4 ++-- tests/system/suite_APTW/tst_APTW03/test.py | 2 +- tests/system/suite_CSUP/tst_CSUP04/test.py | 2 +- tests/system/suite_CSUP/tst_CSUP05/test.py | 2 +- tests/system/suite_HELP/tst_HELP06/test.py | 2 +- tests/system/suite_QMLS/tst_QMLS02/test.py | 2 +- tests/system/suite_QMLS/tst_QMLS03/test.py | 6 +++--- tests/system/suite_QMLS/tst_QMLS04/test.py | 2 +- tests/system/suite_QMLS/tst_QMLS05/test.py | 4 ++-- tests/system/suite_QMLS/tst_QMLS06/test.py | 4 ++-- tests/system/suite_QMLS/tst_QMLS07/test.py | 2 +- tests/system/suite_QMLS/tst_QMLS08/test.py | 2 +- tests/system/suite_debugger/tst_qml_js_console/test.py | 3 +-- tests/system/suite_debugger/tst_qml_locals/test.py | 2 +- tests/system/suite_editors/tst_qml_indent/test.py | 1 - tests/system/suite_editors/tst_rename_macros/test.py | 2 +- tests/system/suite_general/tst_build_speedcrunch/test.py | 1 - tests/system/suite_general/tst_create_proj_wizard/test.py | 1 - tests/system/suite_general/tst_default_settings/test.py | 2 -- tests/system/suite_qtquick/tst_qml_outline/test.py | 6 +++--- tests/system/suite_qtquick/tst_qtquick_creation/test.py | 1 - tests/system/suite_tools/tst_git_local/test.py | 4 ++-- 27 files changed, 33 insertions(+), 44 deletions(-) diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index d2d1f596007..0aaab2ac33d 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -37,7 +37,7 @@ def getBuildIssues(): def checkLastBuild(expectedToFail=False, createTasksFileOnError=True): try: # can't use waitForObject() 'cause visible is always 0 - buildProg = findObject("{type='ProjectExplorer::Internal::BuildProgress' unnamed='1' }") + findObject("{type='ProjectExplorer::Internal::BuildProgress' unnamed='1' }") except LookupError: test.log("checkLastBuild called without a build") return diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index c4db7046e28..a8bdbf96640 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -24,7 +24,6 @@ ############################################################################ import __builtin__ -import operator # for easier re-usage (because Python hasn't an enum type) class Targets: diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index b3cf7988a99..1a1fc39a567 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -23,8 +23,6 @@ # ############################################################################ -import re - def handleDebuggerWarnings(config, isMsvcBuild=False): if isMsvcBuild: try: @@ -71,8 +69,8 @@ def setBreakpointsForCurrentProject(filesAndLines): if not filesAndLines or not isinstance(filesAndLines, (list,tuple)): test.fatal("This function only takes a non-empty list/tuple holding dicts.") return False - navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}") + waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}") for current in filesAndLines: for curFile,curLine in current.iteritems(): if not openDocument(curFile): diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index 09b3af6ae71..df3f7d37ea5 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -106,7 +106,7 @@ def openContextMenuOnTextCursorPosition(editor): # param direction is one of "Left", "Right", "Up", "Down", but "End" and combinations work as well # param typeCount defines how often the cursor will be moved in the given direction (while marking) def markText(editor, direction, typeCount=1): - for i in range(typeCount): + for _ in range(typeCount): type(editor, "" % direction) # works for all standard editors @@ -173,7 +173,7 @@ def verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, e # param expectedVals a dict holding property value pairs that must match def __handleTextTips__(textTip, expectedVals, alternativeVals): props = object.properties(textTip) - expFail = altFail = False + expFail = False eResult = verifyProperties(props, expectedVals) for val in eResult.itervalues(): if not val: @@ -182,7 +182,6 @@ def __handleTextTips__(textTip, expectedVals, alternativeVals): if expFail and alternativeVals != None: aResult = verifyProperties(props, alternativeVals) else: - altFail = True aResult = None if not expFail: test.passes("TextTip verified") @@ -360,7 +359,7 @@ def invokeContextMenuItem(editorArea, command1, command2 = None): def invokeFindUsage(editor, line, typeOperation, n=1): if not placeCursorToLine(editor, line, True): return False - for i in range(n): + for _ in range(n): type(editor, typeOperation) snooze(1) invokeContextMenuItem(editor, "Find Usages") diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 336d82fc485..2ad9a329577 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -42,7 +42,7 @@ def switchViewTo(view): text = "" pattern = ViewConstants.getToolTipForViewTab(view) if re.match(pattern, unicode(text), re.UNICODE): - test.passes("ToolTip verified") + test.passes("ToolTip verified") else: test.warning("ToolTip does not match", "Expected pattern: %s\nGot: %s" % (pattern, text)) mouseClick(waitForObject("{type='Core::Internal::FancyTabBar' unnamed='1' visible='1' " @@ -158,7 +158,7 @@ def addAndActivateKit(kit): kitString = Targets.getStringForTarget(kit) switchViewTo(ViewConstants.PROJECTS) try: - treeView = waitForObject(":Projects.ProjectNavigationTreeView") + waitForObject(":Projects.ProjectNavigationTreeView") wanted = getQModelIndexStr("text='%s'" % kitString, bAndRIndex) index = findObject(wanted) if str(index.toolTip).startswith(clickToActivate): diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 590b277a1e6..097772769d0 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -458,7 +458,7 @@ def iterateQtVersions(keepOptionsOpen=False, alreadyOnOptionsDialog=False, currResult = additionalFunction(target, version, *argsForAdditionalFunc) except: import sys - t,v,tb = sys.exc_info() + t,v,_ = sys.exc_info() currResult = None test.fatal("Function to additionally execute on Options Dialog could not be found or " "an exception occurred while executing it.", "%s(%s)" % (str(t), str(v))) @@ -521,7 +521,7 @@ def iterateKits(keepOptionsOpen=False, alreadyOnOptionsDialog=False, currResult = additionalFunction(item, kitName, *argsForAdditionalFunc) except: import sys - t,v,tb = sys.exc_info() + t,v,_ = sys.exc_info() currResult = None test.fatal("Function to additionally execute on Options Dialog could not be " "found or an exception occurred while executing it.", "%s(%s)" % diff --git a/tests/system/suite_APTW/tst_APTW03/test.py b/tests/system/suite_APTW/tst_APTW03/test.py index 022c1ba8130..ca1378196af 100644 --- a/tests/system/suite_APTW/tst_APTW03/test.py +++ b/tests/system/suite_APTW/tst_APTW03/test.py @@ -98,7 +98,7 @@ def main(): test.fail("Could not open %s.h - continuing." % className.lower()) continue editor = getEditorForFileSuffix("%s.h" % className.lower()) - oldContent = str(editor.plainText) + str(editor.plainText) placeCursorToLine(editor, "class %s.*" % className, True) snooze(4) # avoid timing issue with the parser invokeContextMenuItem(editor, "Refactor", "Insert Virtual Functions of Base Classes") diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index e922281d4b8..d6eaf7086ea 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -70,7 +70,7 @@ def main(): openDocument("openglwindow.Sources.main\\.cpp") if not placeCursorToLine(editorWidget, 'm_posAttr = m_program->attributeLocation("posAttr");'): return - for i in range(13): + for _ in range(13): type(editorWidget, "") type(editorWidget, "") # wait until search finished and verify search results diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py index 466b77b5fbb..0824ef48fdc 100644 --- a/tests/system/suite_CSUP/tst_CSUP05/test.py +++ b/tests/system/suite_CSUP/tst_CSUP05/test.py @@ -76,7 +76,7 @@ def main(): # select some other word in .cpp file and select "Edit" -> "Find/Replace". clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton")) placeCursorToLine(editorWidget, "void Trianglefind::render()") - for i in range(10): + for _ in range(10): type(editorWidget, "") markText(editorWidget, "Left", 12) invokeMenuItem("Edit", "Find/Replace", "Find/Replace") diff --git a/tests/system/suite_HELP/tst_HELP06/test.py b/tests/system/suite_HELP/tst_HELP06/test.py index d1d87f0b048..11ef0e7c0e8 100755 --- a/tests/system/suite_HELP/tst_HELP06/test.py +++ b/tests/system/suite_HELP/tst_HELP06/test.py @@ -107,7 +107,7 @@ def main(): checkIfObjectExists(manualQModelIndex, verboseOnFail = True), "Verifying if all folders and bookmarks are present") mouseClick(waitForObject(":Qt Creator_Bookmarks_TreeView"), 5, 5, 0, Qt.LeftButton) - for i in range(6): + for _ in range(6): type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") test.verify(textForQtVersion("Building and Running an Example") in getHelpTitle(), diff --git a/tests/system/suite_QMLS/tst_QMLS02/test.py b/tests/system/suite_QMLS/tst_QMLS02/test.py index 687f53a53f5..752bf3a05e5 100644 --- a/tests/system/suite_QMLS/tst_QMLS02/test.py +++ b/tests/system/suite_QMLS/tst_QMLS02/test.py @@ -48,7 +48,7 @@ def main(): "Verifying if error is properly reported") # repair error - go to written line placeCursorToLine(editorArea, testingCodeLine) - for i in range(14): + for _ in range(14): type(editorArea, "") markText(editorArea, "Right") type(editorArea, "c") diff --git a/tests/system/suite_QMLS/tst_QMLS03/test.py b/tests/system/suite_QMLS/tst_QMLS03/test.py index 0287c352f36..16120b81fe4 100644 --- a/tests/system/suite_QMLS/tst_QMLS03/test.py +++ b/tests/system/suite_QMLS/tst_QMLS03/test.py @@ -90,7 +90,7 @@ def main(): if not placeCursorToLine(editorArea, "Rectangle {"): invokeMenuItem("File", "Exit") return - for i in range(5): + for _ in range(5): type(editorArea, "") invokeContextMenuItem(editorArea, "Find Usages") # check if usage was properly found @@ -109,7 +109,7 @@ def main(): if not placeCursorToLine(editorArea, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"): invokeMenuItem("File", "Exit") return - for i in range(87): + for _ in range(87): type(editorArea, "") invokeMenuItem("Tools", "QML/JS", "Find Usages") # check if usage was properly found @@ -128,7 +128,7 @@ def main(): if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"): invokeMenuItem("File", "Exit") return - for i in range(5): + for _ in range(5): type(editorArea, "") type(editorArea, "") # check if usage was properly found diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 6d4d9624775..b6336700c43 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -37,7 +37,7 @@ def main(): saveAndExit() return placeCursorToLine(editorArea, "TextEdit {") - for i in range(5): + for _ in range(5): type(editorArea, "") # invoke Refactoring - Move Component into separate file invokeContextMenuItem(editorArea, "Refactoring", "Move Component into Separate File") diff --git a/tests/system/suite_QMLS/tst_QMLS05/test.py b/tests/system/suite_QMLS/tst_QMLS05/test.py index 111bf68f391..9f78d8b8c4f 100644 --- a/tests/system/suite_QMLS/tst_QMLS05/test.py +++ b/tests/system/suite_QMLS/tst_QMLS05/test.py @@ -32,13 +32,13 @@ def main(): homeKey = "" if platform.system() == "Darwin": homeKey = "" - for i in range(2): + for _ in range(2): type(editorArea, homeKey) type(editorArea, "") type(editorArea, "") type(editorArea, "") type(editorArea, "Item { x: 10; y: 20; width: 10 }") - for i in range(30): + for _ in range(30): type(editorArea, "") invokeMenuItem("File", "Save All") # activate menu and apply 'Refactoring - Split initializer' diff --git a/tests/system/suite_QMLS/tst_QMLS06/test.py b/tests/system/suite_QMLS/tst_QMLS06/test.py index f4e9a12d92d..9c61188e1f3 100644 --- a/tests/system/suite_QMLS/tst_QMLS06/test.py +++ b/tests/system/suite_QMLS/tst_QMLS06/test.py @@ -32,14 +32,14 @@ def main(): homeKey = "" if platform.system() == "Darwin": homeKey = "" - for i in range(2): + for _ in range(2): type(editorArea, homeKey) type(editorArea, "") type(editorArea, "") type(editorArea, "") testingItemText = "Item { x: 10; y: 20; width: 10 }" type(editorArea, testingItemText) - for i in range(30): + for _ in range(30): type(editorArea, "") invokeMenuItem("File", "Save All") # invoke Refactoring - Wrap Component in Loader diff --git a/tests/system/suite_QMLS/tst_QMLS07/test.py b/tests/system/suite_QMLS/tst_QMLS07/test.py index 631aff02205..054332e5213 100644 --- a/tests/system/suite_QMLS/tst_QMLS07/test.py +++ b/tests/system/suite_QMLS/tst_QMLS07/test.py @@ -31,7 +31,7 @@ def main(): return type(editorArea, "") type(editorArea, "Color") - for i in range(3): + for _ in range(3): type(editorArea, "") invokeMenuItem("File", "Save All") # invoke Refactoring - Add a message suppression comment. diff --git a/tests/system/suite_QMLS/tst_QMLS08/test.py b/tests/system/suite_QMLS/tst_QMLS08/test.py index bb5f9e4c14d..5e0b3aefea9 100644 --- a/tests/system/suite_QMLS/tst_QMLS08/test.py +++ b/tests/system/suite_QMLS/tst_QMLS08/test.py @@ -71,7 +71,7 @@ def main(): return # cancel indentation type(editorArea, "") - for i in range(5): + for _ in range(5): type(editorArea, "") # select unindented block type(editorArea, "") diff --git a/tests/system/suite_debugger/tst_qml_js_console/test.py b/tests/system/suite_debugger/tst_qml_js_console/test.py index 7022b09cd5f..1d193541bcd 100644 --- a/tests/system/suite_debugger/tst_qml_js_console/test.py +++ b/tests/system/suite_debugger/tst_qml_js_console/test.py @@ -68,7 +68,6 @@ def debuggerHasStopped(): def getQmlJSConsoleOutput(): try: - result = [] consoleView = waitForObject(":DebugModeWidget_Debugger::Internal::ConsoleView") model = consoleView.model() # old input, output, new input > 2 @@ -135,7 +134,7 @@ def main(): switchViewTo(ViewConstants.EDIT) # start debugging clickButton(fancyDebugButton) - locAndExprTV = waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView") + waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView") rootIndex = getQModelIndexStr("text='Rectangle'", ":Locals and Expressions_Debugger::Internal::WatchTreeView") # make sure the items inside the root item are visible diff --git a/tests/system/suite_debugger/tst_qml_locals/test.py b/tests/system/suite_debugger/tst_qml_locals/test.py index 06a60bb1166..3429d5725f9 100644 --- a/tests/system/suite_debugger/tst_qml_locals/test.py +++ b/tests/system/suite_debugger/tst_qml_locals/test.py @@ -117,7 +117,7 @@ def fetchItems(index, valIndex, treeView): tree.setName(name) tree.setValue(value) for row in range(model.rowCount(index)): - tree.addChild(fetchItems(model.index(row, 0, index), model.index(row, 1, index), treeView)) + tree.addChild(fetchItems(model.index(row, 0, index), model.index(row, 1, index), treeView)) return tree def checkForEmptyRows(items, isRootCheck=True): diff --git a/tests/system/suite_editors/tst_qml_indent/test.py b/tests/system/suite_editors/tst_qml_indent/test.py index f05da16317e..2be24a94ce9 100644 --- a/tests/system/suite_editors/tst_qml_indent/test.py +++ b/tests/system/suite_editors/tst_qml_indent/test.py @@ -44,7 +44,6 @@ def prepareQmlFile(): editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") isDarwin = platform.system() == 'Darwin' for i in range(3): - content = "%s" % editor.plainText if not placeCursorToLine(editor, 'title: qsTr("Hello World")'): test.fatal("Couldn't find line(s) I'm looking for - QML file seems to " "have changed!\nLeaving test...") diff --git a/tests/system/suite_editors/tst_rename_macros/test.py b/tests/system/suite_editors/tst_rename_macros/test.py index 581247bfdfb..5a4177daad4 100644 --- a/tests/system/suite_editors/tst_rename_macros/test.py +++ b/tests/system/suite_editors/tst_rename_macros/test.py @@ -118,7 +118,7 @@ def testRenameMacroAfterSourceMoving(): return True def performMacroRenaming(newMacroName): - for i in range(10): + for _ in range(10): type(cppEditorStr, "") invokeContextMenuItem(waitForObject(cppEditorStr), "Refactor", "Rename Symbol Under Cursor") diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py index ef51997c7f9..1d7eda90884 100644 --- a/tests/system/suite_general/tst_build_speedcrunch/test.py +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -24,7 +24,6 @@ ############################################################################ source("../../shared/qtcreator.py") -import re SpeedCrunchPath = "" diff --git a/tests/system/suite_general/tst_create_proj_wizard/test.py b/tests/system/suite_general/tst_create_proj_wizard/test.py index adfe3d60442..34878b9566a 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -45,7 +45,6 @@ def main(): projects = catModel.index(0, 0) test.compare("Projects", str(projects.data())) comboBox = findObject(":New.comboBox_QComboBox") - targets = zip(*kits.values())[0] test.verify(comboBox.enabled, "Verifying whether combobox is enabled.") test.compare(comboBox.currentText, "All Templates") try: diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index 72ff89c7e38..bb75bf9b326 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -26,8 +26,6 @@ source("../../shared/qtcreator.py") import re -import tempfile -import __builtin__ currentSelectedTreeItem = None warningOrError = re.compile('

((Error|Warning).*?)

') diff --git a/tests/system/suite_qtquick/tst_qml_outline/test.py b/tests/system/suite_qtquick/tst_qml_outline/test.py index e14c5eb5394..7b806afc28a 100644 --- a/tests/system/suite_qtquick/tst_qml_outline/test.py +++ b/tests/system/suite_qtquick/tst_qml_outline/test.py @@ -139,9 +139,9 @@ def verifyOutline(outlinePseudoTree, datasetFileName): "Found %d elements, but expected %d" % (len(outlinePseudoTree), len(expected))) return for counter, (expectedItem, foundItem) in enumerate(zip(expected, outlinePseudoTree)): - if expectedItem != foundItem: - test.fail("Mismatch in element number %d for '%s'" % (counter + 1, fileName), + if expectedItem != foundItem: + test.fail("Mismatch in element number %d for '%s'" % (counter + 1, fileName), "%s != %s" % (str(expectedItem), str(foundItem))) - return + return test.passes("All nodes (%d) inside outline match expected nodes for '%s'." % (len(expected), fileName)) diff --git a/tests/system/suite_qtquick/tst_qtquick_creation/test.py b/tests/system/suite_qtquick/tst_qtquick_creation/test.py index 584235282fa..3eda2c6e0ee 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation/test.py @@ -34,7 +34,6 @@ def main(): for qtVersion, controls in available: targ = [Targets.DESKTOP_5_6_1_DEFAULT] - quick = "2.6" # using a temporary directory won't mess up a potentially existing workingDir = tempDir() checkedTargets = createNewQtQuickApplication(workingDir, targets=targ, diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py index 0206885fa28..4998c393e03 100644 --- a/tests/system/suite_tools/tst_git_local/test.py +++ b/tests/system/suite_tools/tst_git_local/test.py @@ -92,7 +92,7 @@ def __clickCommit__(count): test.fail("Could not find the %d. commit - leaving test" % count) return False placeCursorToLine(gitEditor, line) - for i in range(30): + for _ in range(30): type(gitEditor, "") # get the current cursor rectangle which should be positioned on the commit ID rect = gitEditor.cursorRect() @@ -234,7 +234,7 @@ def deleteProject(): if os.path.exists(path): try: # Make files in .git writable to remove them - for root, dirs, files in os.walk(path): + for root, _, files in os.walk(path): for name in files: os.chmod(os.path.join(root, name), stat.S_IWUSR) shutil.rmtree(path)