Merge "Merge remote-tracking branch 'origin/4.6'"

This commit is contained in:
Eike Ziller
2018-04-26 12:28:00 +00:00
committed by The Qt Project
12 changed files with 119 additions and 107 deletions

View File

@@ -69,6 +69,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)

View File

@@ -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);
}
}

View File

@@ -57,7 +57,7 @@ public:
private:
using FutureCursorWatcher = QFutureWatcher<CppTools::CursorInfo>;
FutureCursorWatcher m_watcher;
std::unique_ptr<FutureCursorWatcher> m_watcher;
};
} // namespace ClangRefactoring

View File

@@ -435,10 +435,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> 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);
});
}
@@ -447,10 +451,13 @@ void CppEditorWidget::renameUsages(const QString &replacement, QTextCursor curso
if (cursor.isNull())
cursor = textCursor();
CppTools::CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this};
QPointer<CppEditorWidget> 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);
}

View File

@@ -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<Project *> &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)

View File

@@ -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) <toolchain> <bitness>, e.g. Desktop gcc 64-bit
- Qt Quick Controls
- Qt Script
The exact versions and toolchains are:
Linux:
@@ -59,8 +63,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.

View File

@@ -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'}
@@ -155,7 +156,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'}

View File

@@ -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)

131
tests/system/suite_HELP/tst_HELP04/test.py Executable file → Normal file
View File

@@ -27,26 +27,23 @@ 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()
isWebEngineView = className(hv) == "QWebEngineView"
try:
selText = hv.selectedText
if className(selText) != 'instancemethod':
return str(selText), isWebEngineView
return hv.textCursor().selectedText()
except:
pass
try:
selText = getHighlightsInHtml(str(hv.toHtml()))
test.log("Falling back to searching for selection in HTML.")
return getHighlightsInHtml(str(hv.toHtml()))
except:
test.warning("Could not get highlighted text.")
selText = ''
return str(selText), isWebEngineView
return str("")
def __getUrl__():
helpViewer = getHelpViewer()
@@ -69,12 +66,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(),
@@ -93,16 +85,26 @@ 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'}"))
progressBarWait(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 = True
except:
# Creator built with Qt >= 5.9.0
resultWidget = waitForObject(':Hits_QResultWidget', 5000)
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.")
# workaround for "endless waiting cursor"
mouseClick(waitForObject("{column='0' container=':Qt Creator_QHelpContentWidget' "
"text='Qt Reference Documentation' type='QModelIndex'}"))
@@ -119,54 +121,55 @@ 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"), "<Tab>")
type(waitForObject(":Hits_QCLuceneResultWidget"), "<Return>")
waitFor("__getUrl__() != url or selText != __getSelectedText__()[0]", 20000)
mouseClick(resultWidget)
type(resultWidget, "<Tab>")
type(resultWidget, "<Return>")
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 <B>similar</B> to:":"deploy",
"<B>without</B> the words:":"bookmark",
"with <B>exact phrase</B>:":"sql in qt",
"with <B>all</B> of the words:":"designer sql",
"with <B>at least one</B> 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, "<Tab>")
type(resultsView, "<Return>")
verifySelection("printing")
verifyUrl("qthelp://com.trolltech.qt.487/qdoc/overviews.html")
for i in range(2):
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 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 <B>similar</B> to:":"deploy",
"<B>without</B> the words:":"bookmark",
"with <B>exact phrase</B>:":"sql in qt",
"with <B>all</B> of the words:":"designer sql",
"with <B>at least one</B> 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, "<Tab>")
type(resultsView, "<Return>")
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, "<Return>")
verifySelection("printing")
verifyUrl("qthelp://com.trolltech.qt.487/qdoc/overviews.html")
for i in range(2):
type(resultsView, "<Tab>")
type(resultsView, "<Return>")
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")

View File

@@ -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)

View File

@@ -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"
1 text nestinglevel
7306 searchtaskhandler.h 4
7307 searchwidget.h 4
7308 textbrowserhelpviewer.h 4
webenginehelpviewer.h 4
7309 xbelsupport.h 4
7310 Sources 3
7311 centralwidget.cpp 4
7327 searchtaskhandler.cpp 4
7328 searchwidget.cpp 4
7329 textbrowserhelpviewer.cpp 4
webenginehelpviewer.cpp 4
7330 xbelsupport.cpp 4
7331 Forms 3
7332 docsettingspage.ui 4