From d57ab7f6b9d00cf280cb4c44a12283a06051981c Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 18 Apr 2018 19:16:12 +0200 Subject: [PATCH 01/13] Squish: Update tst_HELP04 for hidden "Search" button Task-number: QTCREATORBUG-20295 Change-Id: Idada7f86088946ecddd69c0ac10656c202d4f566 Reviewed-by: Christian Stenger --- tests/system/suite_HELP/tst_HELP04/test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 344d3e20e49..05d62cab84e 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -98,8 +98,7 @@ def main(): "Verifying search widget visibility.") # try to search empty string clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}")) - progressBarWait(600000) + "window=':Qt Creator_Core::Internal::MainWindow'}", 600000)) test.verify(waitFor("noMatch in " "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 2000), "Verifying if search did not match anything.") From 0e216fda3e05b5ca16f6c231291cbda6b7140563 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 18 Apr 2018 19:09:20 +0200 Subject: [PATCH 02/13] Squish: Don't expect WebEngine or WebKit Change-Id: Ib44d0c7671b016c27e33ffd66e4797be37523ca3 Reviewed-by: Christian Stenger --- tests/system/README | 5 +++-- tests/system/objects.map | 1 - tests/system/shared/utils.py | 19 ++++------------- tests/system/suite_HELP/tst_HELP04/test.py | 24 +++++----------------- 4 files changed, 12 insertions(+), 37 deletions(-) diff --git a/tests/system/README b/tests/system/README index b309c607537..5389e5232d6 100644 --- a/tests/system/README +++ b/tests/system/README @@ -59,8 +59,9 @@ 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 should be built with ClangCodeModel plugin. How to do so, see QTCREATOR_REPO/src/plugins/clangcodemodel/README. Without the -plugin, the tests for ClangCodeModel will be skipped but will not cause failures. +Sixth - Qt Creator must be built on a Qt without Qt WebEngine or Qt WebKit. Its ClangCodeModel +plugin should be built. How to do so, see QTCREATOR_REPO/README.md. Without the plugin, the tests +for ClangCodeModel will be skipped but will not cause failures. 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. diff --git a/tests/system/objects.map b/tests/system/objects.map index fce477feb63..7805817f513 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -155,7 +155,6 @@ :Qt Creator_FilenameQComboBox {type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Find::Internal::SearchResultTreeView {type='Core::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Git::Internal::GitEditor {type='Git::Internal::GitEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::QtWebKitHelpWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_HelpSelector_QComboBox {occurrence='3' type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Issues_Core::Internal::OutputPaneToggleButton {occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_QHelpContentWidget {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index e9209177eb8..c8bd71da6fc 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -683,20 +683,9 @@ def getChildByClass(parent, classToSearchFor, occurrence=1): return children[occurrence - 1] def getHelpViewer(): - try: - return waitForObject(":Qt Creator_Help::Internal::HelpViewer", 3000) - except: - pass - try: - return waitForObject("{type='QWebEngineView' unnamed='1' " - "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 1000) - except: - return waitForObject("{type='Help::Internal::TextBrowserHelpWidget' unnamed='1' " - "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 1000) + return waitForObject("{type='Help::Internal::TextBrowserHelpWidget' unnamed='1' " + "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", + 1000) def getHelpTitle(): - hv = getHelpViewer() - try: - return str(hv.title) - except: - return str(hv.documentTitle) + return str(getHelpViewer().documentTitle) diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 05d62cab84e..8985de2d275 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -33,20 +33,11 @@ urlDictionary = { "deployment":"qthelp://com.trolltech.qt.487/qdoc/gettingstarte def __getSelectedText__(): - hv = getHelpViewer() - isWebEngineView = className(hv) == "QWebEngineView" try: - selText = hv.selectedText - if className(selText) != 'instancemethod': - return str(selText), isWebEngineView - except: - pass - try: - selText = getHighlightsInHtml(str(hv.toHtml())) + return getHighlightsInHtml(str(getHelpViewer().toHtml())) except: test.warning("Could not get highlighted text.") - selText = '' - return str(selText), isWebEngineView + return str("") def __getUrl__(): helpViewer = getHelpViewer() @@ -69,12 +60,7 @@ def getHighlightsInHtml(htmlCode): return res def verifySelection(expected): - selText, isWebEngineView = __getSelectedText__() - if isWebEngineView: - test.log("The search results are not a selection in a QWebEngineView", - "Searched strings should still be highlighted") - return - selText = str(selText) + selText = str(__getSelectedText__()) if test.verify(selText, "Verify that there is a selection"): # verify if search keyword is found in results test.verify(expected.lower() in selText.lower(), @@ -118,13 +104,13 @@ def main(): test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits'," "str(findObject(':Hits_QLabel').text))", 2000), "Verifying if search results found with 1+ hits for: " + searchKeyword) - selText = __getSelectedText__()[0] + selText = __getSelectedText__() url = __getUrl__() # click in the widget, tab to first item and press enter mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton) type(waitForObject(":Hits_QCLuceneResultWidget"), "") type(waitForObject(":Hits_QCLuceneResultWidget"), "") - waitFor("__getUrl__() != url or selText != __getSelectedText__()[0]", 20000) + waitFor("__getUrl__() != url or selText != __getSelectedText__()", 20000) verifySelection(searchKeyword) verifyUrl(urlDictionary[searchKeyword]) else: From 356a2fd8553e382f65830659582d64ac98d9c477 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 18 Apr 2018 20:36:06 +0200 Subject: [PATCH 03/13] Squish: Update tst_HELP04 for current Qt versions Change-Id: I944f824807d47bcfaf9cabd2b15b678d858db15f Reviewed-by: Christian Stenger --- tests/system/objects.map | 1 + tests/system/suite_HELP/tst_HELP04/test.py | 112 ++++++++++++--------- 2 files changed, 65 insertions(+), 48 deletions(-) diff --git a/tests/system/objects.map b/tests/system/objects.map index 7805817f513..6f04a58926f 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -88,6 +88,7 @@ :Help Widget_Help::Internal::HelpWidget {type='Help::Internal::HelpWidget' unnamed='1' visible='1' windowTitle?='Help -*'} :Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Hits_QResultWidget {aboveWidget=':Hits_QLabel' type='QResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':QtVersionLabel_KitPage' type='QComboBox' unnamed='1' visible='1'} :Locals and Expressions_Debugger::Internal::WatchTreeView {container=':Debugger.Docks.LocalsAndWatchersDockWidget.Inspector_QFrame' name='WatchWindow' type='Debugger::Internal::WatchTreeView' visible='1'} :Minimal required Qt version:_QLabel {text='Minimal required Qt version:' type='QLabel' unnamed='1' visible='1' window=':New Text File_ProjectExplorer::JsonWizard'} diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 8985de2d275..ed90010e3bb 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -27,14 +27,20 @@ source("../../shared/qtcreator.py") import re # test search in help mode and advanced search -searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False } -urlDictionary = { "deployment":"qthelp://com.trolltech.qt.487/qdoc/gettingstarted-develop.html", - "build":"qthelp://com.trolltech.qt.487/qdoc/sql-driver.html" } +searchKeywordDictionary={ "abundance":True, "deplmint":False, "QODBC":True, "bld":False } +urlDictionary = { "abundance":"qthelp://com.trolltech.qt.487/qdoc/gettingstarted-develop.html", + "QODBC":"qthelp://com.trolltech.qt.487/qdoc/sql-driver.html" } def __getSelectedText__(): + hv = getHelpViewer() try: - return getHighlightsInHtml(str(getHelpViewer().toHtml())) + return hv.textCursor().selectedText() + except: + pass + try: + test.log("Falling back to searching for selection in HTML.") + return getHighlightsInHtml(str(hv.toHtml())) except: test.warning("Could not get highlighted text.") return str("") @@ -85,9 +91,18 @@ def main(): # try to search empty string clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " "window=':Qt Creator_Core::Internal::MainWindow'}", 600000)) - test.verify(waitFor("noMatch in " - "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 2000), - "Verifying if search did not match anything.") + try: + # Creator built with Qt <= 5.8.0 + resultWidget = waitForObject(':Hits_QCLuceneResultWidget', 5000) + olderThan59 = False + except: + # Creator built with Qt >= 5.9.0 + resultWidget = waitForObject(':Hits_QResultWidget', 5000) + olderThan59 = True + if not olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT): + test.verify(waitFor("noMatch in " + "str(resultWidget.plainText)", 2000), + "Verifying if search did not match anything.") # workaround for "endless waiting cursor" mouseClick(waitForObject("{column='0' container=':Qt Creator_QHelpContentWidget' " "text='Qt Reference Documentation' type='QModelIndex'}")) @@ -107,51 +122,52 @@ def main(): selText = __getSelectedText__() url = __getUrl__() # click in the widget, tab to first item and press enter - mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton) - type(waitForObject(":Hits_QCLuceneResultWidget"), "") - type(waitForObject(":Hits_QCLuceneResultWidget"), "") + mouseClick(resultWidget) + type(resultWidget, "") + type(resultWidget, "") waitFor("__getUrl__() != url or selText != __getSelectedText__()", 20000) verifySelection(searchKeyword) verifyUrl(urlDictionary[searchKeyword]) else: - test.verify(waitFor("noMatch in " - "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 1000), - "Verifying if search did not match anything for: " + searchKeyword) - # advanced search - setup - clickButton(waitForObject("{text='+' type='QToolButton' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}")) - label = ("{text='%s' type='QLabel' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}") - lineEdit = ("{leftWidget=%s type='QLineEdit' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}") - labelTextsToSearchStr = {"words similar to:":"deploy", - "without the words:":"bookmark", - "with exact phrase:":"sql in qt", - "with all of the words:":"designer sql", - "with at least one of the words:":"printing"} - for labelText,searchStr in labelTextsToSearchStr.items(): - type(waitForObject(lineEdit % (label % labelText)), searchStr) - # advanced search - do search - clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}")) - progressBarWait(warn=False) - # verify that advanced search results found - test.verify(waitFor("re.search('1 - 2 of 2 Hits'," - "str(findObject(':Hits_QLabel').text))", 3000), - "Verifying if 2 search results found") - resultsView = waitForObject(":Hits_QCLuceneResultWidget") - mouseClick(resultsView, 1, 1, 0, Qt.LeftButton) - type(resultsView, "") - type(resultsView, "") - verifySelection("printing") - verifyUrl("qthelp://com.trolltech.qt.487/qdoc/overviews.html") - for i in range(2): + if not olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT): + test.verify(waitFor("noMatch in " + "str(resultWidget.plainText)", 1000), + "Verifying if search did not match anything for: " + searchKeyword) + if not olderThan59: + # advanced search - setup + clickButton(waitForObject("{text='+' type='QToolButton' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}")) + label = ("{text='%s' type='QLabel' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}") + lineEdit = ("{leftWidget=%s type='QLineEdit' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}") + labelTextsToSearchStr = {"words similar to:":"deploy", + "without the words:":"bookmark", + "with exact phrase:":"sql in qt", + "with all of the words:":"designer sql", + "with at least one of the words:":"printing"} + for labelText,searchStr in labelTextsToSearchStr.items(): + type(waitForObject(lineEdit % (label % labelText)), searchStr) + # advanced search - do search + clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}")) + progressBarWait(warn=False) + # verify that advanced search results found + test.verify(waitFor("re.search('1 - 2 of 2 Hits'," + "str(findObject(':Hits_QLabel').text))", 3000), + "Verifying if 2 search results found") + resultsView = waitForObject(":Hits_QCLuceneResultWidget") + mouseClick(resultsView, 1, 1, 0, Qt.LeftButton) type(resultsView, "") - type(resultsView, "") - verifySelection("sql") - verifyUrl("qthelp://com.trolltech.qt.487/qdoc/best-practices.html") - # verify if simple search is properly disabled - test.verify(not searchLineEdit.enabled, - "Verifying if simple search is not active in advanced mode.") + type(resultsView, "") + verifySelection("printing") + verifyUrl("qthelp://com.trolltech.qt.487/qdoc/overviews.html") + for i in range(2): + type(resultsView, "") + type(resultsView, "") + verifyUrl("qthelp://com.trolltech.qt.487/qdoc/best-practices.html") + # verify if simple search is properly disabled + test.verify(not searchLineEdit.enabled, + "Verifying if simple search is not active in advanced mode.") # exit invokeMenuItem("File", "Exit") From 503fb603c3ed12fc65135e43977142a267938c97 Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Thu, 19 Apr 2018 12:19:03 +0200 Subject: [PATCH 04/13] Android: Set proper environment for the avdmanager tool Task-number: QTCREATORBUG-19988 Change-Id: If34b4ff570ed6d6fdbb91435913d9130feceb499 Reviewed-by: Tobias Hunger --- src/plugins/android/androidavdmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/android/androidavdmanager.cpp b/src/plugins/android/androidavdmanager.cpp index 954053b08bc..c9f1f0eaa64 100644 --- a/src/plugins/android/androidavdmanager.cpp +++ b/src/plugins/android/androidavdmanager.cpp @@ -66,6 +66,8 @@ static bool avdManagerCommand(const AndroidConfig config, const QStringList &arg { QString avdManagerToolPath = config.avdManagerToolPath().toString(); Utils::SynchronousProcess proc; + auto env = AndroidConfigurations::toolsEnvironment(config).toStringList(); + proc.setEnvironment(env); Utils::SynchronousProcessResponse response = proc.runBlocking(avdManagerToolPath, args); if (response.result == Utils::SynchronousProcessResponse::Finished) { if (output) From 038e214f904f50a70f9456a1e5737429ae3809a8 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 19 Apr 2018 15:54:43 +0200 Subject: [PATCH 05/13] Squish: Fix timing issue in tst_HELP04 Change-Id: Ib69429f9288fb767186c61e913a29fc75ddc4498 Reviewed-by: Christian Stenger --- tests/system/suite_HELP/tst_HELP04/test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) mode change 100755 => 100644 tests/system/suite_HELP/tst_HELP04/test.py diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py old mode 100755 new mode 100644 index ed90010e3bb..0fc602717c6 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -85,12 +85,14 @@ def main(): switchViewTo(ViewConstants.HELP) # verify that search widget is accessible mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox", "Search")) + snooze(1) # Looks like searching is still available for an instant test.verify(checkIfObjectExists("{type='QHelpSearchQueryWidget' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}"), + "window=':Qt Creator_Core::Internal::MainWindow'}", + timeout=600000), "Verifying search widget visibility.") # try to search empty string clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", 600000)) + "window=':Qt Creator_Core::Internal::MainWindow'}")) try: # Creator built with Qt <= 5.8.0 resultWidget = waitForObject(':Hits_QCLuceneResultWidget', 5000) From 64b6cb88b0551423a08586de2be72ee152f0079d Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 19 Apr 2018 18:01:40 +0200 Subject: [PATCH 06/13] Squish: Flip bool to its correct meaning Change-Id: I8de704ca3086789a7c8bcb787e678ba10c42ca9d Reviewed-by: Christian Stenger --- tests/system/suite_HELP/tst_HELP04/test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 0fc602717c6..29fa60c52d9 100644 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -96,12 +96,12 @@ def main(): try: # Creator built with Qt <= 5.8.0 resultWidget = waitForObject(':Hits_QCLuceneResultWidget', 5000) - olderThan59 = False + olderThan59 = True except: # Creator built with Qt >= 5.9.0 resultWidget = waitForObject(':Hits_QResultWidget', 5000) - olderThan59 = True - if not olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT): + olderThan59 = False + if olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT): test.verify(waitFor("noMatch in " "str(resultWidget.plainText)", 2000), "Verifying if search did not match anything.") @@ -131,11 +131,11 @@ def main(): verifySelection(searchKeyword) verifyUrl(urlDictionary[searchKeyword]) else: - if not olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT): + if olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT): test.verify(waitFor("noMatch in " "str(resultWidget.plainText)", 1000), "Verifying if search did not match anything for: " + searchKeyword) - if not olderThan59: + if olderThan59: # advanced search - setup clickButton(waitForObject("{text='+' type='QToolButton' unnamed='1' visible='1' " "window=':Qt Creator_Core::Internal::MainWindow'}")) From db9922a5bf661bf69d740d8711851244cb5dfee5 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 19 Apr 2018 19:13:18 +0200 Subject: [PATCH 07/13] Squish: Fix expected compile error message Change-Id: I37d9ea1cdbe21151f8f06cb53851143bbd2c3d6d Reviewed-by: Christian Stenger --- tests/system/suite_SCOM/tst_SCOM04/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_SCOM/tst_SCOM04/test.py b/tests/system/suite_SCOM/tst_SCOM04/test.py index e7136cb0d44..a2590b6740e 100644 --- a/tests/system/suite_SCOM/tst_SCOM04/test.py +++ b/tests/system/suite_SCOM/tst_SCOM04/test.py @@ -31,8 +31,8 @@ def main(): # expected error texts - for different compilers expectedErrorAlternatives = ["'SyntaxError' was not declared in this scope", "\xe2\x80\x98SyntaxError\xe2\x80\x99 was not declared in this scope", - "'SyntaxError' : undeclared identifier", - '"SyntaxError" : undeclared identifier', + "'SyntaxError' : undeclared identifier", # MSVC2013 + "'SyntaxError': undeclared identifier", # MSVC2015 "use of undeclared identifier 'SyntaxError'", "unknown type name 'SyntaxError'"] startApplication("qtcreator" + SettingsPath) From cef50e4166a72f0b9f5a87327a9285e6b4280e49 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 20 Apr 2018 11:31:58 +0200 Subject: [PATCH 08/13] Fix removal of projects from file system view The destruction of a project can still trigger file list changes, so just check if the project is actually still registered before updating anything. Task-number: QTCREATORBUG-20314 Change-Id: I0d634ca8986d1f09e84c310ae732c0bcdc675534 Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/session.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 9ce5f32a59f..3f446f282e4 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -384,20 +384,23 @@ void SessionManager::addProject(Project *pro) emit m_instance->projectAdded(pro); const auto updateFolderNavigation = [pro] { - const QIcon icon = pro->rootProjectNode() ? pro->rootProjectNode()->icon() : QIcon(); - FolderNavigationWidgetFactory::insertRootDirectory({projectFolderId(pro), - PROJECT_SORT_VALUE, - pro->displayName(), - pro->projectFilePath().parentDir(), - icon}); + // destructing projects might trigger changes, so check if the project is actually there + if (QTC_GUARD(d->m_projects.contains(pro))) { + const QIcon icon = pro->rootProjectNode() ? pro->rootProjectNode()->icon() : QIcon(); + FolderNavigationWidgetFactory::insertRootDirectory({projectFolderId(pro), + PROJECT_SORT_VALUE, + pro->displayName(), + pro->projectFilePath().parentDir(), + icon}); + } }; updateFolderNavigation(); configureEditors(pro); - connect(pro, &Project::fileListChanged, [pro, updateFolderNavigation]() { + connect(pro, &Project::fileListChanged, m_instance, [pro, updateFolderNavigation]() { configureEditors(pro); updateFolderNavigation(); // update icon }); - connect(pro, &Project::displayNameChanged, pro, updateFolderNavigation); + connect(pro, &Project::displayNameChanged, m_instance, updateFolderNavigation); if (!startupProject()) setStartupProject(pro); @@ -696,8 +699,9 @@ void SessionManager::removeProjects(const QList &remove) if (pro == d->m_startupProject) changeStartupProject = true; - emit m_instance->projectRemoved(pro); FolderNavigationWidgetFactory::removeRootDirectory(projectFolderId(pro)); + disconnect(pro, nullptr, m_instance, nullptr); + emit m_instance->projectRemoved(pro); } if (changeStartupProject) From 1e31683b7d2a3e6be83f94f0811ac9b81f933dae Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 20 Apr 2018 13:48:34 +0200 Subject: [PATCH 09/13] Squish: Update expected tree after removing WebEngine Change-Id: I097dce55361027acc459070ac750610ec80fa6c9 Reviewed-by: Christian Stenger --- tests/system/README | 6 +++++- .../tst_openqt_creator/testdata/projecttree_creator.tsv | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/system/README b/tests/system/README index 5389e5232d6..703f11ea058 100644 --- a/tests/system/README +++ b/tests/system/README @@ -28,7 +28,11 @@ Second - some of the test suites/test cases expect a build of Qt 4.8.7 to be ava Third - some of the test suites/test cases expect Qt versions to be installed in their default locations. On Linux/macOS this is ~/Qt5.x.1 and on Windows this is C:\Qt\Qt5.x.1. It's easiest to use installations of the official opensource Qt packages. Just install the Qt version for the -respective toolchain and if possible the additional module Qt Script. Do not install Qt WebEngine. +respective toolchain with the components (if available): +- (Desktop) , e.g. Desktop gcc 64-bit +- Qt Quick Controls +- Qt Script + The exact versions and toolchains are: Linux: diff --git a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv index 56369876522..9ca1262ddb8 100644 --- a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv +++ b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv @@ -7306,7 +7306,6 @@ "searchtaskhandler.h" "4" "searchwidget.h" "4" "textbrowserhelpviewer.h" "4" -"webenginehelpviewer.h" "4" "xbelsupport.h" "4" "Sources" "3" "centralwidget.cpp" "4" @@ -7328,7 +7327,6 @@ "searchtaskhandler.cpp" "4" "searchwidget.cpp" "4" "textbrowserhelpviewer.cpp" "4" -"webenginehelpviewer.cpp" "4" "xbelsupport.cpp" "4" "Forms" "3" "docsettingspage.ui" "4" From 28062f0c6871af887e996aa6e60bb1d07642b09c Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 20 Apr 2018 13:49:08 +0200 Subject: [PATCH 10/13] Update qbs submodule To HEAD of 1.11 branch. Change-Id: I2dbca6044dc421cbdfcfff1e1acb79699e39a39c 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 fee6a037b7b..508fce322c4 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit fee6a037b7b28afdc2dfd6297eb089d3e5888ff7 +Subproject commit 508fce322c4715f32309e7ab959ef2630b73b553 From feac99c9acb49c423ec2392df803f07a0f199b6f Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 23 Apr 2018 12:15:42 +0200 Subject: [PATCH 11/13] Clang: Fix possible future watcher issues in local renaming Use the same code pattern as in asynchronous branch of CppUseSelectionsUpdater::update. Change-Id: I7c06b883a5abe1324cb63fa410247ef7f50321ae Reviewed-by: Nikolai Kosjar --- .../clangcodemodel/clangrefactoringengine.cpp | 12 ++++++++---- src/plugins/clangcodemodel/clangrefactoringengine.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/clangcodemodel/clangrefactoringengine.cpp b/src/plugins/clangcodemodel/clangrefactoringengine.cpp index d639e276673..bb985a650e4 100644 --- a/src/plugins/clangcodemodel/clangrefactoringengine.cpp +++ b/src/plugins/clangcodemodel/clangrefactoringengine.cpp @@ -51,10 +51,14 @@ void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data, if (cursorFuture.isCanceled()) return defaultCallback(); - QObject::connect(&m_watcher, &FutureCursorWatcher::finished, [=]() { - if (m_watcher.isCanceled()) + if (m_watcher) + m_watcher->cancel(); + + m_watcher.reset(new FutureCursorWatcher()); + QObject::connect(m_watcher.get(), &FutureCursorWatcher::finished, [=]() { + if (m_watcher->isCanceled()) return defaultCallback(); - const CppTools::CursorInfo info = m_watcher.result(); + const CppTools::CursorInfo info = m_watcher->result(); if (info.useRanges.empty()) return defaultCallback(); @@ -72,7 +76,7 @@ void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data, renameSymbolsCallback(symbolName, container, data.cursor().document()->revision()); }); - m_watcher.setFuture(cursorFuture); + m_watcher->setFuture(cursorFuture); } } diff --git a/src/plugins/clangcodemodel/clangrefactoringengine.h b/src/plugins/clangcodemodel/clangrefactoringengine.h index 10ad96aa0df..424f9a2e5cc 100644 --- a/src/plugins/clangcodemodel/clangrefactoringengine.h +++ b/src/plugins/clangcodemodel/clangrefactoringengine.h @@ -55,7 +55,7 @@ public: private: using FutureCursorWatcher = QFutureWatcher; - FutureCursorWatcher m_watcher; + std::unique_ptr m_watcher; }; } // namespace ClangRefactoring From b5ee2773a083bc39b7d50c9f7064a557cae171d0 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 23 Apr 2018 12:57:23 +0200 Subject: [PATCH 12/13] CppEditor: Use QPointer to 'this' for refactoringEngine calls RefactoringEngine does not depend on CppEditorWidget therefore we should check that the pointer is still valid in the lambda calls. Hopefully fixes QTCREATORBUG-20111 though this fix does not directly address the stack trace. Task-number: QTCREATORBUG-20111 Change-Id: I37f996de60cebe61e290fe181d75fb266f93c1c1 Reviewed-by: Nikolai Kosjar --- src/plugins/cppeditor/cppeditorwidget.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp index 3ba8d40548e..f2c81a74deb 100644 --- a/src/plugins/cppeditor/cppeditorwidget.cpp +++ b/src/plugins/cppeditor/cppeditorwidget.cpp @@ -434,10 +434,14 @@ void CppEditorWidget::findUsages(QTextCursor cursor) { if (cursor.isNull()) cursor = textCursor(); + // 'this' in cursorInEditor is never used (and must never be used) asynchronously. const CppTools::CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this}; + QPointer cppEditorWidget = this; refactoringEngine().findUsages(cursorInEditor, - [this, cursor](const CppTools::Usages &usages) { - findRenameCallback(this, cursor, usages); + [=](const CppTools::Usages &usages) { + if (!cppEditorWidget) + return; + findRenameCallback(cppEditorWidget.data(), cursor, usages); }); } @@ -446,10 +450,13 @@ void CppEditorWidget::renameUsages(const QString &replacement, QTextCursor curso if (cursor.isNull()) cursor = textCursor(); CppTools::CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this}; + QPointer cppEditorWidget = this; refactoringEngine().globalRename(cursorInEditor, - [this, cursor, &replacement](const CppTools::Usages &usages) { - findRenameCallback(this, cursor, usages, true, - replacement); + [=](const CppTools::Usages &usages) { + if (!cppEditorWidget) + return; + findRenameCallback(cppEditorWidget.data(), cursor, usages, + true, replacement); }, replacement); } From a14de75217eb4aa84a792f89e0ad83ac34c5a6a2 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 24 Apr 2018 16:19:38 +0200 Subject: [PATCH 13/13] CMake: Use better value to initialize executable of RunConfiguration Task-number: QTCREATORBUG-19792 Change-Id: Iacf72c71c65ffcfb3a46ca985424806a1d75f1cf Reviewed-by: hjk --- src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index 1c79c3a4634..9e234cb123d 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -99,8 +99,7 @@ Runnable CMakeRunConfiguration::runnable() const QString CMakeRunConfiguration::baseWorkingDirectory() const { - const QString exe = m_executable; - if (!exe.isEmpty()) + if (!m_executable.isEmpty()) return QFileInfo(m_executable).absolutePath(); return QString(); } @@ -137,12 +136,12 @@ bool CMakeRunConfiguration::fromMap(const QVariantMap &map) if (!extraId.isEmpty()) { m_buildSystemTarget = extraId; - m_executable = extraId; if (m_title.isEmpty()) m_title = extraId; CMakeProject *project = static_cast(target()->project()); - const CMakeBuildTarget ct = project->buildTargetForTitle(m_title); + const CMakeBuildTarget ct = project->buildTargetForTitle(m_buildSystemTarget); + m_executable = ct.executable.toString(); extraAspect()->setDefaultWorkingDirectory(ct.workingDirectory); setDefaultDisplayName(m_title);