From 83736649a7196667f68931e70c27dde830d43b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 5 May 2022 21:16:08 +0200 Subject: [PATCH 1/7] Squish: Remove outdated comment from Readme Change-Id: I480756cf9c6be999d0a7c08476609e8f470a1221 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/README | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/system/README b/tests/system/README index 890dc3caa6c..9e1a5d4264a 100644 --- a/tests/system/README +++ b/tests/system/README @@ -63,10 +63,7 @@ Fifth - you'll have to make sure that some needed tools are available (no matter * wget or curl, capable of HTTPS Normally it should be okay to just install them as usual and add their executables' path(s) to the PATH variable. -Sixth - Qt Creator must be built on a Qt without Qt WebEngine or Qt WebKit. Its ClangCodeModel -plugin should be linked to LLVM/Clang 7.0.0 or later. How to do so, see QTCREATOR_REPO/README.md. -With a lower version, the tests for the ClangCodeModel might fail. Without the plugin, the tests for -the ClangCodeModel will be skipped but will not cause failures. +Sixth - Qt Creator must be built on a Qt without Qt WebEngine or Qt WebKit. On macOS make sure you are using the correct keyboard layout to avoid problems when using keyboard interaction. Tested and known to be working would be 'U.S. International - PC', while pure 'U.S.' had problems. From 302c2e804c0a0a616c17858dc2560c7797bdc689 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 28 Apr 2022 18:26:33 +0200 Subject: [PATCH 2/7] StudioWelcome: Disable welcome page if inactive Change-Id: Id098579003ef63d2d06bfb1f2afaeca15c3bbc70 Reviewed-by: Tim Jenssen --- src/plugins/studiowelcome/studiowelcomeplugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 8c933829731..0637f04ef75 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -671,6 +671,11 @@ WelcomeMode::WelcomeMode() m_modeWidget->engine()->setOutputWarningsToStandardError(false); + connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this](Utils::Id mode){ + bool active = (mode == Core::Constants::MODE_WELCOME); + m_modeWidget->rootObject()->setProperty("active", active); + }); + if (!useNewWelcomePage()) { #ifdef QT_DEBUG From 02742670d3f2f2490135f8c139a9761674045086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 13 Apr 2022 22:41:31 +0200 Subject: [PATCH 3/7] Squish: Reduce complexity of iterateQtVersions() By removing dead code, code which generated unused data, unneeded generality and needless abstractions. Change-Id: Ie271363c5446ef02f32e48a78db3d8ef9be0ed29 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/objects.map | 1 - tests/system/shared/utils.py | 77 ++++--------------- .../tst_create_proj_wizard/test.py | 2 +- 3 files changed, 15 insertions(+), 65 deletions(-) diff --git a/tests/system/objects.map b/tests/system/objects.map index aa80ec7c2d0..81120f94964 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -167,7 +167,6 @@ :Qt Creator_Utils::BuildDirectoryLineEdit {name='LineEdit' 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'} :Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit {container=':Qt Creator_Utils::NavigationTreeView' type='QExpandingLineEdit' unnamed='1' visible='1'} -:QtSupport__Internal__QtVersionManager.QLabel {container=':qt_tabwidget_stackedwidget_QScrollArea' text?='Qt version *' type='QLabel' unnamed='1' visible='1'} :QtSupport__Internal__QtVersionManager.errorLabel.QLabel {container=':qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget' name='errorLabel' type='QLabel' visible='1'} :QtSupport__Internal__QtVersionManager.qmake_QLabel {container=':qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget' name='qmakePath' type='QLabel' visible='1'} :QtVersionLabel_KitPage {container=':qt_tabwidget_stackedwidget_QWidget' text='Qt version:' type='QLabel' unnamed='1' visible='1'} diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 76fe918e98f..b680d3dafa3 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2016 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. @@ -347,10 +347,6 @@ def __checkParentAccess__(filePath): # options dialog and returns a dict holding the kits as keys # and a list of information of its configured Qt def getConfiguredKits(): - def __retrieveQtVersionName__(target, version): - treeView = waitForObject(":qtdirList_QTreeView") - return str(treeView.currentIndex().data().toString()) - # end of internal function for iterateQtVersions def __setQtVersionForKit__(kit, kitName, kitsQtVersionName): mouseClick(waitForObjectItem(":BuildAndRun_QTreeView", kit)) qtVersionStr = str(waitForObjectExists(":Kits_QtVersion_QComboBox").currentText) @@ -361,18 +357,15 @@ def getConfiguredKits(): # end of internal function for iterate kits kitsWithQtVersionName = {} - result = {} + result = [] # collect kits and their Qt versions - targetsQtVersions, qtVersionNames = iterateQtVersions(True, False, __retrieveQtVersionName__) + qtVersionNames = iterateQtVersions() # update collected Qt versions with their configured device and version iterateKits(True, True, __setQtVersionForKit__, kitsWithQtVersionName) # merge defined target names with their configured Qt versions and devices for kit, qtVersion in kitsWithQtVersionName.iteritems(): - if kit in ('Fremantle', 'Harmattan', 'Qt Simulator'): - test.verify(qtVersion == 'None', - "The outdated kit '%s' should not have a Qt version" % kit) - elif qtVersion in qtVersionNames: - result[kit] = targetsQtVersions[qtVersionNames.index(qtVersion)].items()[0] + if qtVersion in qtVersionNames: + result.append(kit) else: test.fail("Qt version '%s' for kit '%s' can't be found in qtVersionNames." % (qtVersion, kit)) @@ -400,35 +393,14 @@ def regexVerify(text, expectedTexts): return True return False + # function that opens Options Dialog and parses the configured Qt versions -# param keepOptionsOpen set to True if the Options dialog should stay open when -# leaving this function -# param alreadyOnOptionsDialog set to True if you already have opened the Options Dialog -# (if False this function will open it via the MenuBar -> Tools -> Options...) -# param additionalFunction pass a function or name of a defined function to execute -# for each correctly configured item on the list of Qt versions -# (Qt versions having no assigned toolchain, failing qmake,... will be skipped) -# this function must take at least 2 parameters - the first is the target name -# and the second the version of the current selected Qt version item -# param argsForAdditionalFunc you can specify as much parameters as you want to pass -# to additionalFunction from the outside -# the function returns a list of dict holding target-version mappings if used without -# additionalFunction -# WATCH OUT! if you're using the additionalFunction parameter - this function will -# return the list mentioned above as well as the returned value(s) from -# additionalFunction. You MUST call this function like -# result, additionalResult = _iterateQtVersions(...) -# where additionalResult is the result of all executions of additionalFunction which -# means it is a list of results. -def iterateQtVersions(keepOptionsOpen=False, alreadyOnOptionsDialog=False, - additionalFunction=None, *argsForAdditionalFunc): - result = [] - additionalResult = [] - if not alreadyOnOptionsDialog: - invokeMenuItem("Tools", "Options...") +# the function returns a list of the found Qt versions +def iterateQtVersions(): + qtVersionNames = [] + invokeMenuItem("Tools", "Options...") mouseClick(waitForObjectItem(":Options_QListView", "Kits")) clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Qt Versions") - pattern = re.compile("Qt version (?P.*?) for (?P.*)") treeView = waitForObject(":qtdirList_QTreeView") model = treeView.model() for rootIndex in dumpIndices(model): @@ -436,31 +408,10 @@ def iterateQtVersions(keepOptionsOpen=False, alreadyOnOptionsDialog=False, for subIndex in dumpIndices(model, rootIndex): subChildText = str(subIndex.data()).replace(".", "\\.").replace("_", "\\_") treeView.scrollTo(subIndex) - mouseClick(waitForObjectItem(treeView, ".".join([rootChildText,subChildText]))) - currentText = str(waitForObject(":QtSupport__Internal__QtVersionManager.QLabel").text) - matches = pattern.match(currentText) - if matches: - target = matches.group("target").strip() - version = matches.group("version").strip() - result.append({target:version}) - if additionalFunction: - try: - if isString(additionalFunction): - currResult = globals()[additionalFunction](target, version, *argsForAdditionalFunc) - else: - currResult = additionalFunction(target, version, *argsForAdditionalFunc) - except: - 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))) - additionalResult.append(currResult) - if not keepOptionsOpen: - clickButton(waitForObject(":Options.Cancel_QPushButton")) - if additionalFunction: - return result, additionalResult - else: - return result + mouseClick(waitForObjectItem(treeView, ".".join([rootChildText, subChildText]))) + qtVersionNames.append(str(treeView.currentIndex().data().toString())) + return qtVersionNames + # function that opens Options Dialog (if necessary) and parses the configured Kits # param keepOptionsOpen set to True if the Options dialog should stay open when 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 a8ef4782fc5..38550a96aff 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -93,7 +93,7 @@ def main(): def verifyKitCheckboxes(kits, displayedPlatforms): waitForObject("{type='QLabel' unnamed='1' visible='1' text='Kit Selection'}") - availableCheckboxes = frozenset(filter(enabledCheckBoxExists, kits.keys())) + availableCheckboxes = frozenset(filter(enabledCheckBoxExists, kits)) # verification whether expected, found and configured match expectedShownKits = availableCheckboxes.intersection(displayedPlatforms) From 90bde92efd91fc0c4cb1a11b4b2a7a3bef3758aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Fri, 25 Mar 2022 00:35:14 +0100 Subject: [PATCH 4/7] Squish: Align iterateKits() better with the way we use it Change-Id: Ib41b4e763b0df8a74fd7b073710b29640fea17db Reviewed-by: Christian Stenger --- tests/system/shared/utils.py | 63 ++++++++----------- .../suite_general/tst_remove_kits/test.py | 6 +- 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index b680d3dafa3..72f38a52852 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -361,7 +361,7 @@ def getConfiguredKits(): # collect kits and their Qt versions qtVersionNames = iterateQtVersions() # update collected Qt versions with their configured device and version - iterateKits(True, True, __setQtVersionForKit__, kitsWithQtVersionName) + iterateKits(False, True, __setQtVersionForKit__, kitsWithQtVersionName) # merge defined target names with their configured Qt versions and devices for kit, qtVersion in kitsWithQtVersionName.iteritems(): if qtVersion in qtVersionNames: @@ -414,25 +414,23 @@ def iterateQtVersions(): # function that opens Options Dialog (if necessary) and parses the configured Kits -# param keepOptionsOpen set to True if the Options dialog should stay open when -# leaving this function +# param clickOkWhenDone set to True if the Options dialog should be closed by clicking the +# "OK" button. If False, the dialog will stay open # param alreadyOnOptionsDialog set to True if you already have opened the Options Dialog -# (if False this functions will open it via the MenuBar -> Tools -> Options...) +# (if False this function will open it via the MenuBar -> Tools -> Options...) # param additionalFunction pass a function or name of a defined function to execute # for each configured item on the list of Kits -# this function must take at least 2 parameters - the first is the item (QModelIndex) -# of the current Kit (if you need to click on it) and the second the Kit name itself -# param argsForAdditionalFunc you can specify as much parameters as you want to pass +# this function must take at least 2 parameters - the first is the full string +# of the kit which can be used in waitForObjectItem(), the second the Kit name itself +# param argsForAdditionalFunc you can specify as many parameters as you want to pass # to additionalFunction from the outside -# the function returns a list of Kit names if used without an additional function -# WATCH OUT! if you're using the additionalFunction parameter - this function will -# return the list mentioned above as well as the returned value(s) from +# this function will return a list of Kit names as well as the returned value(s) from # additionalFunction. You MUST call this function like -# result, additionalResult = _iterateQtVersions(...) +# result, additionalResult = iterateKits(...) # where additionalResult is the result of all executions of additionalFunction which # means it is a list of results. -def iterateKits(keepOptionsOpen=False, alreadyOnOptionsDialog=False, - additionalFunction=None, *argsForAdditionalFunc): +def iterateKits(clickOkWhenDone, alreadyOnOptionsDialog, + additionalFunction, *argsForAdditionalFunc): result = [] additionalResult = [] if not alreadyOnOptionsDialog: @@ -449,31 +447,22 @@ def iterateKits(keepOptionsOpen=False, alreadyOnOptionsDialog=False, test.compare(manual.data().toString(), "Manual", "Verifying label for target section") for section in [autoDetected, manual]: for currentItem in dumpItems(model, section): - kitName = currentItem - if (kitName.endswith(" (default)")): - kitName = kitName.rsplit(" (default)", 1)[0] + kitName = currentItem.rsplit(" (default)", 1)[0] result.append(kitName) - item = ".".join([str(section.data().toString()), - currentItem.replace(".", "\\.")]) - if additionalFunction: - try: - if isString(additionalFunction): - currResult = globals()[additionalFunction](item, kitName, *argsForAdditionalFunc) - else: - currResult = additionalFunction(item, kitName, *argsForAdditionalFunc) - except: - 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))) - additionalResult.append(currResult) - if not keepOptionsOpen: - clickButton(waitForObject(":Options.Cancel_QPushButton")) - if additionalFunction: - return result, additionalResult - else: - return result + try: + item = ".".join([str(section.data().toString()), + currentItem.replace(".", "\\.")]) + currResult = additionalFunction(item, kitName, *argsForAdditionalFunc) + except: + 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))) + additionalResult.append(currResult) + if clickOkWhenDone: + clickButton(waitForObject(":Options.OK_QPushButton")) + return result, additionalResult # set a help viewer that will always be used, regardless of Creator's width diff --git a/tests/system/suite_general/tst_remove_kits/test.py b/tests/system/suite_general/tst_remove_kits/test.py index 8549d285cad..01af0b07476 100644 --- a/tests/system/suite_general/tst_remove_kits/test.py +++ b/tests/system/suite_general/tst_remove_kits/test.py @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2017 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. @@ -41,7 +41,8 @@ def verifyProjectsMode(expectedKits): kitNameTemplate = "Manual.%s" -def __removeKit__(kit, kitName): + +def __removeKit__(_, kitName): global kitNameTemplate if kitName == Targets.getStringForTarget(Targets.getDefaultKit()): # The following kits will be the default kit at that time @@ -58,6 +59,5 @@ def main(): switchViewTo(ViewConstants.PROJECTS) verifyProjectsMode(Targets.getTargetsAsStrings(Targets.availableTargetClasses(True))) iterateKits(True, False, __removeKit__) - clickButton(waitForObject(":Options.OK_QPushButton")) verifyProjectsMode([]) invokeMenuItem("File", "Exit") From 9c9aa75ca38237bd0453d84780ba2bb12cb4b892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Mon, 9 May 2022 12:21:50 +0200 Subject: [PATCH 5/7] Squish: Fix findUnusedObjects for Python3 Change-Id: I4d092c5f4be682116f3313a72e17e5b1056e6866 Reviewed-by: Christian Stenger Reviewed-by: --- tests/system/tools/findUnusedObjects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/tools/findUnusedObjects.py b/tests/system/tools/findUnusedObjects.py index 258674a4aa6..8bf044dba60 100755 --- a/tests/system/tools/findUnusedObjects.py +++ b/tests/system/tools/findUnusedObjects.py @@ -2,7 +2,7 @@ ############################################################################ # -# Copyright (C) 2019 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. @@ -189,7 +189,7 @@ def printResult(): def deleteRemovable(): global useCounts, objMap - deletable = filter(lambda x: useCounts[x] == 0, useCounts) + deletable = list(filter(lambda x: useCounts[x] == 0, useCounts)) if len(deletable) == 0: print("Nothing to delete - leaving objects.map untouched") return From d10f3f834213d165381a849779829685343e78ef Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 5 May 2022 13:56:02 +0200 Subject: [PATCH 6/7] Dumper: Fix map dumper for lldb Change-Id: I8adab131632b2ca04a3de8094699ab43d2de03bb Reviewed-by: Reviewed-by: hjk --- share/qtcreator/debugger/lldbbridge.py | 2 ++ share/qtcreator/debugger/stdtypes.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 7bba95dd394..e121ece7da5 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -472,6 +472,8 @@ class Dumper(DumperBase): tdata.code = TypeCode.Void elif typeName == 'wchar_t': tdata.code = TypeCode.Integral + elif typeName in ("char16_t", "char32_t", "char8_t"): + tdata.code = TypeCode.Integral else: self.warn('UNKNOWN TYPE KEY: %s: %s' % (typeName, code)) elif code == lldb.eTypeClassEnumeration: diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index 0bc5c1e5ffe..1f4386607d7 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -643,7 +643,7 @@ def qdump__std____1__map(d, value): with Children(d, size, maxNumChild=1000): for (i, pair) in zip(d.childRange(), in_order_traversal(head)): - d.putPairItem(i, pair, 'key', 'value') + d.putPairItem(i, pair) def qform__std____1__multimap(): @@ -1293,9 +1293,9 @@ def qform__std____cxx11__wstring(): def qdump__std____1__basic_string(d, value): innerType = value.type[0].name - if innerType == "char": + if innerType in ("char", "char8_t", "char16_t"): qdump__std____1__string(d, value) - elif innerType == "wchar_t": + elif innerType in ("wchar_t", "char32_t"): qdump__std____1__wstring(d, value) else: d.warn("UNKNOWN INNER TYPE %s" % innerType) From 81f33072b90ba2ff860654ad59eba7d651c5bfb7 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 10 May 2022 08:14:32 +0200 Subject: [PATCH 7/7] Tests: Fix compile of test app on macOS Change-Id: I1a96bc57bae2aa3f1f7a1c0d6d4306cf5c36a78b Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 4c6c9919d0c..2046b948ee4 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -5301,7 +5301,9 @@ void tst_Dumpers::dumper_data() << Data("#include \n" "#include \n" "template\n" - "class myallocator : public std::allocator {};\n", + "class myallocator : public std::allocator {\n" + "using std::allocator::allocator;\n" + "};\n", "std::vector v0, v1;\n" "v1.push_back(1);\n"