From fdad6496f4f6034f77108d43cf8531651f36ae46 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 14 Dec 2022 14:53:52 +0100 Subject: [PATCH 1/6] Fix language selection box When Qt Creator is installed in a path with underscore. Amends 451d02c88d3aca4a1c1d6487b2ecaaac848e5c90 which changed the pattern matching from file name only to the whole path. Fixes: QTCREATORBUG-28591 Change-Id: Ice6a7cb34fd2bb98c384a3b7cb573614bb7a43b6 Reviewed-by: Marcus Tillmanns --- src/plugins/coreplugin/generalsettings.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 2e9d3fa884e..9cc5889e7fa 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -163,10 +163,10 @@ void GeneralSettingsWidget::fillLanguageBox() const QStringList(QLatin1String("qtcreator*.qm"))); for (const FilePath &languageFile : languageFiles) { - const QString path = languageFile.path(); - int start = path.indexOf('_') + 1; - int end = path.lastIndexOf('.'); - const QString locale = path.mid(start, end-start); + const QString name = languageFile.fileName(); + int start = name.indexOf('_') + 1; + int end = name.lastIndexOf('.'); + const QString locale = name.mid(start, end - start); // no need to show a language that creator will not load anyway if (hasQmFilesForLocale(locale, creatorTrPath.toString())) { QLocale tmpLocale(locale); From d0046ec4358585aa8bdf2ee13d61b0329c06e334 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 12 Dec 2022 15:25:09 +0100 Subject: [PATCH 2/6] ProjectExplorer: Consider the form "-D key=value" ... when filtering compiler options for MSVC macro extractions. Otherwise we end up with a stray command line argument, breaking the call to cl.exe. Fixes: QTCREATORBUG-28016 Change-Id: I29979a4b968d2056a0feba61fee01d5ddc9aa28f Reviewed-by: Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/msvctoolchain.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 468c408adf5..cd3d4afb561 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -621,15 +621,22 @@ Macros MsvcToolChain::msvcPredefinedMacros(const QStringList &cxxflags, Macros predefinedMacros; QStringList toProcess; - for (const QString &arg : cxxflags) { - if (arg.startsWith("/D") || arg.startsWith("-D")) { - const QString define = arg.mid(2); - predefinedMacros.append(Macro::fromKeyValue(define)); - } else if (arg.startsWith("/U") || arg.startsWith("-U")) { - predefinedMacros.append( - {arg.mid(2).toLocal8Bit(), ProjectExplorer::MacroType::Undefine}); + for (auto arg = cxxflags.begin(); arg != cxxflags.end(); ++arg) { + if (arg->startsWith("/D") || arg->startsWith("-D")) { + if (arg->length() > 2) + predefinedMacros.append(Macro::fromKeyValue(arg->mid(2))); + else if (std::next(arg) != cxxflags.end()) + predefinedMacros.append(Macro::fromKeyValue(*++arg)); + } else if (arg->startsWith("/U") || arg->startsWith("-U")) { + if (arg->length() > 2) { + predefinedMacros.append({arg->mid(2).toLocal8Bit(), + MacroType::Undefine}); + } else if (std::next(arg) != cxxflags.end()) { + predefinedMacros.append({(++arg)->toLocal8Bit(), + MacroType::Undefine}); + } } else { - toProcess.append(arg); + toProcess.append(*arg); } } From bbd5d6c7aed1b98e5405d39ad42e928a00409b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 14 Dec 2022 17:12:43 +0100 Subject: [PATCH 3/6] SquishTests: Update FindToolBar ...as seen in tst_CSUP05 Change-Id: I1736a4ec9c69a3db3fc98ea1234b0363ceeaef41 Reviewed-by: Reviewed-by: Christian Stenger --- src/plugins/coreplugin/find/findtoolbar.cpp | 1 + tests/system/objects.map | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index ab207391bdb..6db9774afee 100644 --- a/src/plugins/coreplugin/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -78,6 +78,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind) m_horizontalSpacer = new QSpacerItem(40, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); m_close = new QToolButton; + m_close->setObjectName("closeFindToolBarButton"); auto findButtonsWidget = new QWidget; diff --git a/tests/system/objects.map b/tests/system/objects.map index 074275eba8c..1ba56ea1cfd 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -2,7 +2,7 @@ :*Qt Creator.Cancel Build_QToolButton {text='Cancel Build' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Clear_QToolButton {text='Clear' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Continue_Core::Internal::FancyToolButton {name='Debug.Button' toolTip?='Continue *' type='Core::Internal::FancyToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:*Qt Creator.Find_Find::Internal::FindToolBar {name='Core__Internal__FindWidget' type='Core::Internal::FindToolBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Find'} +:*Qt Creator.Find_Find::Internal::FindToolBar {type='Core::Internal::FindToolBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Find'} :*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack {name='FormEditorStack' type='Designer::Internal::FormEditorStack' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Interrupt_Core::Internal::FancyToolButton {name='Debug.Button' toolTip='Interrupt' type='Core::Internal::FancyToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.ProjectSelectorDockWidget_QDockWidget {name='ProjectSelectorDockWidget' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -118,7 +118,7 @@ :QML Debugging_QMessageBox {text='The option will only take effect if the project is recompiled. Do you want to recompile now?' type='QMessageBox' unnamed='1' visible='1'} :Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.CloseDoc_QToolButton {toolTip?='Close Document *' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.CloseFind_QToolButton {name='closeFindToolBarButton' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Compile Output_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'} :Qt Creator.Configure Project_QPushButton {text='Configure Project' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.DebugModeWidget_QSplitter {name='DebugModeWidget' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -132,8 +132,8 @@ :Qt Creator.QML debugging and profiling:_QLabel {text='QML debugging and profiling:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.ReRun_QToolButton {toolTip='Re-run this run-configuration.' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Replace_QToolButton {name='replaceButton' text='Replace' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.Replace All_QToolButton {text='Replace All' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.Replace_QToolButton {text='Replace' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Stop_QToolButton {text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Timeline_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='QmlProfiler.Timeline.DockDockWidget' type='QDockWidget' visible='1'} :Qt Creator.Timeline_QTabBar {aboveWidget=':Qt Creator.Timeline_QDockWidget' container=':Qt Creator.DebugModeWidget_QSplitter' type='QTabBar' unnamed='1' visible='1'} From 7b073efe4aa94827e4d17c8dc8d21437f690a805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 14 Dec 2022 22:24:56 +0100 Subject: [PATCH 4/6] SquishTests: Update tst_QMLS04 Change-Id: I383e8f652ae233df7ed5bef93dcaa9a43fe95f0e Reviewed-by: Christian Stenger --- src/plugins/qmljseditor/qmljscomponentnamedialog.cpp | 1 + tests/system/objects.map | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp index 6953e992b9e..c94fbebe433 100644 --- a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp +++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp @@ -24,6 +24,7 @@ ComponentNameDialog::ComponentNameDialog(QWidget *parent) : { setWindowTitle(Tr::tr("Move Component into Separate File")); m_componentNameEdit = new Utils::ClassNameValidatingLineEdit; + m_componentNameEdit->setObjectName("componentNameEdit"); m_componentNameEdit->setPlaceholderText(Tr::tr("Component Name")); m_messageLabel = new QLabel; m_pathEdit = new Utils::PathChooser; diff --git a/tests/system/objects.map b/tests/system/objects.map index 1ba56ea1cfd..09ef2505423 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -61,7 +61,7 @@ :Dialog.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} :Dialog.componentNameEdit_QLineEdit {name='componentNameEdit' type='Utils::ClassNameValidatingLineEdit' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} :Dialog_Debugger::Internal::SymbolPathsDialog {name='Debugger__Internal__SymbolPathsDialog' type='Debugger::Internal::SymbolPathsDialog' visible='1' windowTitle='Dialog'} -:Dialog_QmlJSEditor::Internal::ComponentNameDialog {name='QmlJSEditor__Internal__ComponentNameDialog' type='QmlJSEditor::Internal::ComponentNameDialog' visible='1' windowTitle='Move Component into Separate File'} +:Dialog_QmlJSEditor::Internal::ComponentNameDialog {type='QmlJSEditor::Internal::ComponentNameDialog' unnamed='1' visible='1' windowTitle='Move Component into Separate File'} :Events.QmlProfilerEventsTable_QmlProfiler::Internal::QmlProfilerStatisticsMainView {container=':Qt Creator.Events_QDockWidget' name='QmlProfilerEventsTable' type='QmlProfiler::Internal::QmlProfilerStatisticsMainView' visible='1'} :Failed to start application_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Failed to start application'} :File has been removed.Close_QPushButton {text='Close' type='QPushButton' unnamed='1' visible='1' window=':File has been removed_QMessageBox'} From 3874ac236d1bd14f6904c03e63e88f065c6fe62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 14 Dec 2022 22:54:07 +0100 Subject: [PATCH 5/6] SquishTests: Stabilize tst_codepasting Avoid "Error in type() invocation: Could not activate toplevel-window for widget" Change-Id: Ib68a975724ad3824800bdcb542916b6644f1dc7f Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/suite_tools/tst_codepasting/test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index 1275052156c..fd389490eaf 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -53,6 +53,8 @@ def pasteFile(sourceFile, protocol): typeLines(editor, "// tst_codepasting %s" % datetime.utcnow()) sourceText = editor.plainText invokeMenuItem("Tools", "Code Pasting", "Paste Snippet...") + pasteView = waitForObject(":Send to Codepaster_CodePaster::PasteView") + waitFor("pasteView.isActiveWindow") selectFromCombo(":Send to Codepaster.protocolBox_QComboBox", protocol) pasteEditor = waitForObject(":stackedWidget.plainTextEdit_QPlainTextEdit") test.compare(pasteEditor.plainText, sourceText, "Verify that dialog shows text from the editor") From 75c43f926b95cb7ac546ec8929e6e759320e7d89 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 15 Dec 2022 08:25:56 +0100 Subject: [PATCH 6/6] Squish: Stabilize invoking context menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Try a second time if the wanted menu item is not active when triggering the context menu the first time. Change-Id: I742db645542e6775baaa77fbdb1fd5a8e9a120f2 Reviewed-by: Robert Löhning --- tests/system/shared/editor_utils.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index 4aa008515eb..60ed802745d 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -336,9 +336,16 @@ def validateSearchResult(expectedCount): # this function invokes context menu and command from it def invokeContextMenuItem(editorArea, command1, command2 = None): - ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) - snooze(1) - item1 = waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000) + for _ in range(2): + ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) + snooze(1) + try: + item1 = waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000) + break + except: + test.warning("Context menu item not ready (%s) - trying once more." % command1) + type(editorArea, "") + if command2 and platform.system() == 'Darwin': mouseMove(item1) activateItem(item1)