summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-09-29 13:40:53 +0200
committerEike Ziller <eike.ziller@digia.com>2014-09-29 13:40:53 +0200
commitd008779bf779ba2d6eaae9248a49486e5ae428eb (patch)
tree61221545f33aa7b4474fc5dfddc3a87075e0285b
parentb2487e1683b82eef7f3d62297af843b4b5babc8b (diff)
parent6bf9a19276a65882f846455d282d157893b6ef48 (diff)
downloadqt-creator-d008779bf779ba2d6eaae9248a49486e5ae428eb.tar.gz
Merge remote-tracking branch 'origin/3.2'
Conflicts: src/plugins/projectexplorer/projectexplorer.cpp Change-Id: I6dffc1925e6bf35cf6e9fe0676c11d1a5143a208
-rw-r--r--share/qtcreator/qml/qmlpuppet/container/addimportcontainer.cpp1
-rw-r--r--src/libs/qmljs/qmljscodeformatter.h1
-rw-r--r--src/libs/utils/tooltip/tipcontents.h1
-rw-r--r--src/plugins/coreplugin/modemanager.cpp2
-rw-r--r--src/plugins/coreplugin/modemanager.h2
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp4
-rw-r--r--src/plugins/perforce/perforceplugin.cpp44
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp7
-rw-r--r--src/plugins/texteditor/texteditor.cpp3
-rw-r--r--src/shared/qtsingleapplication/qtlocalpeer.cpp1
-rw-r--r--src/tools/3rdparty/iossim/iphonesimulator.mm17
-rw-r--r--tests/system/objects.map3
-rw-r--r--tests/system/shared/clang.py79
-rw-r--r--tests/system/shared/qtcreator.py3
-rw-r--r--tests/system/suite_CSUP/tst_CSUP03/test.py71
-rw-r--r--tests/system/suite_CSUP/tst_CSUP04/test.py68
-rw-r--r--tests/system/suite_CSUP/tst_CSUP05/test.py101
-rw-r--r--tests/system/suite_CSUP/tst_CSUP06/test.py52
-rw-r--r--tests/system/suite_debugger/tst_simple_debug/test.py4
-rw-r--r--tests/system/suite_editors/tst_memberoperator/test.py46
20 files changed, 312 insertions, 198 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/container/addimportcontainer.cpp b/share/qtcreator/qml/qmlpuppet/container/addimportcontainer.cpp
index 9c08c81029..43047f383a 100644
--- a/share/qtcreator/qml/qmlpuppet/container/addimportcontainer.cpp
+++ b/share/qtcreator/qml/qmlpuppet/container/addimportcontainer.cpp
@@ -30,6 +30,7 @@
#include "addimportcontainer.h"
#include <QDebug>
+#include <QDataStream>
namespace QmlDesigner {
diff --git a/src/libs/qmljs/qmljscodeformatter.h b/src/libs/qmljs/qmljscodeformatter.h
index 5764ebe98c..38b0e1ce56 100644
--- a/src/libs/qmljs/qmljscodeformatter.h
+++ b/src/libs/qmljs/qmljscodeformatter.h
@@ -37,6 +37,7 @@
#include <QStack>
#include <QList>
#include <QVector>
+#include <QMetaObject>
QT_BEGIN_NAMESPACE
class QTextDocument;
diff --git a/src/libs/utils/tooltip/tipcontents.h b/src/libs/utils/tooltip/tipcontents.h
index 5cac25ee19..897a8e46e1 100644
--- a/src/libs/utils/tooltip/tipcontents.h
+++ b/src/libs/utils/tooltip/tipcontents.h
@@ -34,6 +34,7 @@
#include <QString>
#include <QColor>
+#include <QWidget>
namespace Utils {
diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp
index 9e387d4f44..349d93ef76 100644
--- a/src/plugins/coreplugin/modemanager.cpp
+++ b/src/plugins/coreplugin/modemanager.cpp
@@ -320,7 +320,7 @@ bool ModeManager::isModeSelectorVisible()
return d->m_modeSelectorVisible;
}
-QObject *ModeManager::instance()
+ModeManager *ModeManager::instance()
{
return m_instance;
}
diff --git a/src/plugins/coreplugin/modemanager.h b/src/plugins/coreplugin/modemanager.h
index a6689368be..9e708e0e02 100644
--- a/src/plugins/coreplugin/modemanager.h
+++ b/src/plugins/coreplugin/modemanager.h
@@ -52,7 +52,7 @@ class CORE_EXPORT ModeManager : public QObject
Q_OBJECT
public:
- static QObject *instance();
+ static ModeManager *instance();
static IMode *currentMode();
static IMode *mode(Id id);
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index bcdbc7aa25..ebedabf240 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -174,8 +174,8 @@ bool GenericProject::addFiles(const QStringList &filePaths)
QSet<QString> includes = projectIncludePaths().toSet();
QSet<QString> toAdd;
- foreach (const QString &filePaths, filePaths) {
- QString directory = QFileInfo(filePaths).absolutePath();
+ foreach (const QString &filePath, filePaths) {
+ QString directory = QFileInfo(filePath).absolutePath();
if (!includes.contains(directory)
&& !toAdd.contains(directory))
toAdd << directory;
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index 59c22ea1f7..5930518f08 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -792,13 +792,37 @@ void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName,
void PerforcePlugin::updateActions(VcsBasePlugin::ActionState as)
{
- if (!enableMenuAction(as, m_menuAction)) {
- m_commandLocator->setEnabled(false);
+ const bool menuActionEnabled = enableMenuAction(as, m_menuAction);
+ const bool enableActions = currentState().hasTopLevel() && menuActionEnabled;
+ m_commandLocator->setEnabled(enableActions);
+ m_logRepositoryAction->setEnabled(enableActions);
+ m_editAction->setEnabled(enableActions);
+ m_addAction->setEnabled(enableActions);
+ m_deleteAction->setEnabled(enableActions);
+ m_openedAction->setEnabled(enableActions);
+ m_revertFileAction->setEnabled(enableActions);
+ m_diffFileAction->setEnabled(enableActions);
+ m_diffProjectAction->setEnabled(enableActions);
+ m_updateProjectAction->setEnabled(enableActions);
+ m_revertProjectAction->setEnabled(enableActions);
+ m_revertUnchangedAction->setEnabled(enableActions);
+ m_diffAllAction->setEnabled(enableActions);
+ m_submitProjectAction->setEnabled(enableActions);
+ m_pendingAction->setEnabled(enableActions);
+ m_describeAction->setEnabled(enableActions);
+ m_annotateCurrentAction->setEnabled(enableActions);
+ m_annotateAction->setEnabled(enableActions);
+ m_filelogCurrentAction->setEnabled(enableActions);
+ m_filelogAction->setEnabled(enableActions);
+ m_logProjectAction->setEnabled(enableActions);
+ m_logRepositoryAction->setEnabled(enableActions);
+ m_submitCurrentLogAction->setEnabled(enableActions);
+ m_updateAllAction->setEnabled(enableActions);
+ m_diffSelectedFiles->setEnabled(enableActions);
+ m_undoAction->setEnabled(enableActions);
+ m_redoAction->setEnabled(enableActions);
+ if (!menuActionEnabled)
return;
- }
- const bool hasTopLevel = currentState().hasTopLevel();
- m_commandLocator->setEnabled(hasTopLevel);
- m_logRepositoryAction->setEnabled(hasTopLevel);
const QString fileName = currentState().currentFileName();
m_editAction->setParameter(fileName);
@@ -816,14 +840,6 @@ void PerforcePlugin::updateActions(VcsBasePlugin::ActionState as)
m_submitProjectAction->setParameter(projectName);
m_revertProjectAction->setParameter(projectName);
m_revertUnchangedAction->setParameter(projectName);
-
- m_diffAllAction->setEnabled(true);
- m_openedAction->setEnabled(true);
- m_describeAction->setEnabled(true);
- m_annotateAction->setEnabled(true);
- m_filelogAction->setEnabled(true);
- m_pendingAction->setEnabled(true);
- m_updateAllAction->setEnabled(true);
}
bool PerforcePlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */)
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 1b3c81e63f..94e53a96dc 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1344,6 +1344,8 @@ void ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu()
ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
{
+ disconnect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
+ this, SLOT(currentModeChanged(Core::IMode*,Core::IMode*)));
dd->m_proWindow->aboutToShutdown(); // disconnect from session
SessionManager::closeAllProjects();
dd->m_projectsMode = 0;
@@ -1730,9 +1732,8 @@ void ProjectExplorerPlugin::restoreSession()
SessionManager::loadSession(dd->m_sessionToRestoreAtStartup);
// update welcome page
- connect(ModeManager::instance(),
- SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
- SLOT(currentModeChanged(Core::IMode*,Core::IMode*)));
+ connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
+ this, SLOT(currentModeChanged(Core::IMode*,Core::IMode*)));
connect(dd->m_welcomePage, SIGNAL(requestSession(QString)), this, SLOT(loadSession(QString)));
connect(dd->m_welcomePage, SIGNAL(requestProject(QString)), this, SLOT(openProjectWelcomePage(QString)));
dd->m_arguments = arguments;
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 5a2c507618..d0a428858a 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -6254,7 +6254,8 @@ void BaseTextEditorWidget::cut()
void BaseTextEditorWidget::selectAll()
{
- d->disableBlockSelection();
+ if (d->m_inBlockSelectionMode)
+ d->disableBlockSelection();
QPlainTextEdit::selectAll();
}
diff --git a/src/shared/qtsingleapplication/qtlocalpeer.cpp b/src/shared/qtsingleapplication/qtlocalpeer.cpp
index 09c69ce525..33cca898a0 100644
--- a/src/shared/qtsingleapplication/qtlocalpeer.cpp
+++ b/src/shared/qtsingleapplication/qtlocalpeer.cpp
@@ -30,6 +30,7 @@
#include "qtlocalpeer.h"
#include <QCoreApplication>
+#include <QDataStream>
#include <QTime>
#if defined(Q_OS_WIN)
diff --git a/src/tools/3rdparty/iossim/iphonesimulator.mm b/src/tools/3rdparty/iossim/iphonesimulator.mm
index 7845a7af46..0e75fc51a9 100644
--- a/src/tools/3rdparty/iossim/iphonesimulator.mm
+++ b/src/tools/3rdparty/iossim/iphonesimulator.mm
@@ -261,16 +261,25 @@ static void ChildSignal(int /*arg*/) {
}
- (void)session:(DTiPhoneSimulatorSession *)session didStart:(BOOL)started withError:(NSError *)error {
+ if (started) {
+ // bring to front...
+ [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript"
+ arguments:[NSArray arrayWithObjects:
+ @"-e", @"tell application \"System Events\"",
+ @"-e", @" set listOfProcesses to (name of every process where background only is false)",
+ @"-e", @"end tell",
+ @"-e", @"repeat with processName in listOfProcesses",
+ @"-e", @" if processName starts with \"iOS Simulator\" or processName starts with \"iPhone Simulator\" then",
+ @"-e", @" tell application processName to activate",
+ @"-e", @" end if",
+ @"-e", @"end repeat", nil]];
+ }
if (startOnly && session) {
- [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript"
- arguments:[NSArray arrayWithObjects:@"-e", @"tell application \"iPhone Simulator\" to activate", nil]];
msgprintf(@"Simulator started (no session)");
[self doExit:EXIT_SUCCESS];
return;
}
if (started) {
- [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript"
- arguments:[NSArray arrayWithObjects:@"-e", @"tell application \"iPhone Simulator\" to activate", nil]];
int pid = [session simulatedApplicationPID];
if (shouldStartDebugger) {
char*args[4] = { NULL, NULL, (char*)[[[NSNumber numberWithInt:pid] description] UTF8String], NULL };
diff --git a/tests/system/objects.map b/tests/system/objects.map
index 1edc9a28f5..cdd0f91d53 100644
--- a/tests/system/objects.map
+++ b/tests/system/objects.map
@@ -47,6 +47,8 @@
:Cannot Open Project.Show Details..._QPushButton {text='Show Details...' type='QPushButton' unnamed='1' visible='1' window=':Cannot Open Project_QMessageBox'}
:Cannot Open Project_QMessageBox {text?='Failed to open project in *' type='QMessageBox' unnamed='1' visible='1'}
:Cannot Open Project_QTextEdit {type='QTextEdit' unnamed='1' visible='1' window=':Cannot Open Project_QMessageBox'}
+:Close Debugging Session.Yes_QPushButton {text='Yes' type='QPushButton' unnamed='1' visible='1' window=':Close Debugging Session_Utils::CheckableMessageBox'}
+:Close Debugging Session_Utils::CheckableMessageBox {type='Utils::CheckableMessageBox' unnamed='1' visible='1' windowTitle='Close Debugging Session'}
:CodePaster__Internal__PasteSelectDialog.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
:CodePaster__Internal__PasteSelectDialog.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
:CodePaster__Internal__PasteSelectDialog.listWidget_QListWidget {name='listWidget' type='QListWidget' visible='1' window=':CodePaster__Internal__PasteSelectDialog_CodePaster::PasteSelectDialog'}
@@ -188,6 +190,7 @@
:RunSettingsEnvironmentDetails_Utils::DetailsButton {leftWidget=':RunSettingsUseBuildEnvironment_QLabel' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:RunSettingsUseBuildEnvironment_QLabel {text~='Us(e|ing) <b>Build Environment</b>' type='QLabel' unnamed='1' visible='1'}
:Save Changes.Always save files before build_QCheckBox {name='saveBeforeBuildCheckBox' text='Always save files before build' type='QCheckBox' visible='1' window=':Save Changes_Core::Internal::SaveItemsDialog'}
+:Save Changes.Do not Save_QPushButton {text='Do not Save' type='QPushButton' unnamed='1' visible='1' window=':Save Changes_Core::Internal::SaveItemsDialog'}
:Save Changes.Save All_QPushButton {text='Save All' type='QPushButton' unnamed='1' visible='1' window=':Save Changes_Core::Internal::SaveItemsDialog'}
:Save Changes_Core::Internal::SaveItemsDialog {name='Core__Internal__SaveItemsDialog' type='Core::Internal::SaveItemsDialog' visible='1' windowTitle='Save Changes'}
:Select signal.signalList_QTreeWidget {container=':Go to slot.Select signal_QGroupBox' name='signalList' type='QTreeWidget' visible='1'}
diff --git a/tests/system/shared/clang.py b/tests/system/shared/clang.py
new file mode 100644
index 0000000000..dee70a0e6a
--- /dev/null
+++ b/tests/system/shared/clang.py
@@ -0,0 +1,79 @@
+#############################################################################
+##
+## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of Qt Creator.
+##
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+#############################################################################
+
+def startCreatorTryingClang():
+ try:
+ # start Qt Creator with enabled ClangCodeModel plugin (without modifying settings)
+ startApplication("qtcreator -load ClangCodeModel" + SettingsPath)
+ errorMsg = "{type='QMessageBox' unnamed='1' visible='1' windowTitle='Qt Creator'}"
+ errorOK = "{text='OK' type='QPushButton' unnamed='1' visible='1' window=%s}" % errorMsg
+ if waitFor("object.exists(errorOK)", 5000):
+ clickButton(errorOK) # Error message
+ clickButton(errorOK) # Help message
+ raise Exception("ClangCodeModel not found.")
+ return True
+ except:
+ # ClangCodeModel plugin has not been built - start without it
+ test.warning("ClangCodeModel plugin not available - performing test without.")
+ startApplication("qtcreator" + SettingsPath)
+ return False
+
+def __openCodeModelOptions__():
+ invokeMenuItem("Tools", "Options...")
+ waitForObjectItem(":Options_QListView", "C++")
+ clickItem(":Options_QListView", "C++", 14, 15, 0, Qt.LeftButton)
+ clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Code Model")
+
+def iterateAvailableCodeModels():
+ __openCodeModelOptions__()
+ cppChooser = findObject("{type='QComboBox' name='cppChooser' visible='1'}")
+ models = [str(cppChooser.currentText)] # Make sure default is first in list
+ if cppChooser.count > 1:
+ furtherModels = dumpItems(cppChooser.model())
+ furtherModels.remove(models[0])
+ models.extend(furtherModels)
+ clickButton(waitForObject(":Options.OK_QPushButton"))
+ return models
+
+def selectCodeModel(codeModel):
+ __openCodeModelOptions__()
+ expectedObjNames = ['cChooser', 'cppChooser', 'objcChooser', 'objcppChooser', 'hChooser']
+ for exp in expectedObjNames:
+ test.verify(checkIfObjectExists("{type='QComboBox' name='%s' visible='1'}" % exp),
+ "Verifying whether combobox '%s' exists." % exp)
+ combo = findObject("{type='QComboBox' name='%s' visible='1'}" % exp)
+ try:
+ selectFromCombo(combo, codeModel)
+ except:
+ test.fatal("Could not find code model '%s'. Canceling dialog." % codeModel)
+ clickButton(waitForObject(":Options.Cancel_QPushButton"))
+ return
+ test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"),
+ "Verifying whether 'Ignore pre-compiled headers' is checked by default.")
+ clickButton(waitForObject(":Options.OK_QPushButton"))
diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py
index 086aa9411e..ee54ebe858 100644
--- a/tests/system/shared/qtcreator.py
+++ b/tests/system/shared/qtcreator.py
@@ -54,7 +54,8 @@ source("../../shared/editor_utils.py")
source("../../shared/project_explorer.py")
source("../../shared/hook_utils.py")
source("../../shared/debugger.py")
-source("../../shared/workarounds.py")
+source("../../shared/clang.py")
+source("../../shared/workarounds.py") # include this at last
# ATTENTION: if a test case calls startApplication("qtcreator...") for several times this
# function must be called BEFORE any call except the first (which is done always automatically)
diff --git a/tests/system/suite_CSUP/tst_CSUP03/test.py b/tests/system/suite_CSUP/tst_CSUP03/test.py
index f05647b3c3..136a55b59b 100644
--- a/tests/system/suite_CSUP/tst_CSUP03/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP03/test.py
@@ -64,7 +64,7 @@ def constructExpectedCode(original, codeLines, funcSuffix):
return "\n".join(tmp) + "\n"
def main():
- startApplication("qtcreator" + SettingsPath)
+ startCreatorTryingClang()
if not startedWithoutPluginError():
return
projectName = createNewNonQtProject()
@@ -82,38 +82,45 @@ def main():
"while with braces" : ["", "int dummy = 0;", "while (dummy < 10) {", "++dummy;"],
"do while" : ["", "int dummy = 0;", "do", "++dummy;", "while (dummy < 10);"]
}
- editor = getEditorForFileSuffix("main.cpp")
- if not editor:
- test.fatal("Failed to get an editor - leaving test.")
- invokeMenuItem("File", "Exit")
- return
+ models = iterateAvailableCodeModels()
+ for current in models:
+ if current != models[0]:
+ selectCodeModel(current)
+ test.log("Testing code model: %s" % current)
+ openDocument("untitled.Sources.main\\.cpp")
+ editor = getEditorForFileSuffix("main.cpp")
+ if not editor:
+ test.fatal("Failed to get an editor - leaving test.")
+ invokeMenuItem("File", "Exit")
+ return
- originalContent = str(editor.plainText)
- for case, codeLines in code.items():
- funcSuffix = case.title().replace(" ", "")
- test.log("Testing: Extract Function for '%s'" % case)
- if not placeCursorToLine(editor, "{"):
- continue
- typeLines(editor, codeLines)
- if not placeCursorToLine(editor, codeLines[2]):
+ originalContent = str(editor.plainText)
+ for case, codeLines in code.items():
+ funcSuffix = case.title().replace(" ", "")
+ test.log("Testing: Extract Function for '%s'" % case)
+ if not placeCursorToLine(editor, "{"):
+ continue
+ typeLines(editor, codeLines)
+ if not placeCursorToLine(editor, codeLines[2]):
+ revertMainCpp()
+ continue
+ type(editor, home)
+ markText(editor, "Right", 2)
+ snooze(1) # avoid timing issue with the parser
+ invokeContextMenuItem(editor, 'Refactor', 'Extract Function')
+ funcEdit = waitForObject("{buddy={text='Enter function name' type='QLabel' unnamed='1' "
+ "visible='1' window=%s} type='QLineEdit' unnamed='1' visible='1'}"
+ % inputDialog)
+ replaceEditorContent(funcEdit, "myFunc%s" % funcSuffix)
+ clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' window=%s}"
+ % inputDialog))
+ waitFor("'void myFunc%s' in str(editor.plainText)" % funcSuffix, 2500)
+ # verify the change
+ modifiedCode = str(editor.plainText)
+ expectedCode = constructExpectedCode(originalContent, codeLines, funcSuffix)
+ test.compare(modifiedCode, expectedCode, "Verifying whether code matches expected.")
+ # reverting to initial state of main.cpp
revertMainCpp()
- continue
- type(editor, home)
- markText(editor, "Right", 2)
- snooze(1) # avoid timing issue with the parser
- invokeContextMenuItem(editor, 'Refactor', 'Extract Function')
- funcEdit = waitForObject("{buddy={text='Enter function name' type='QLabel' unnamed='1' "
- "visible='1' window=%s} type='QLineEdit' unnamed='1' visible='1'}"
- % inputDialog)
- replaceEditorContent(funcEdit, "myFunc%s" % funcSuffix)
- clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' window=%s}"
- % inputDialog))
- waitFor("'void myFunc%s' in str(editor.plainText)" % funcSuffix, 2500)
- # verify the change
- modifiedCode = str(editor.plainText)
- expectedCode = constructExpectedCode(originalContent, codeLines, funcSuffix)
- test.compare(modifiedCode, expectedCode, "Verifying whether code matches expected.")
- # reverting to initial state of main.cpp
- revertMainCpp()
+ invokeMenuItem('File', 'Close All')
invokeMenuItem('File', 'Exit')
diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py
index dd8fa406d5..280bd65544 100644
--- a/tests/system/suite_CSUP/tst_CSUP04/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP04/test.py
@@ -39,44 +39,48 @@ def main():
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = os.path.join(templateDir, proFile)
- startApplication("qtcreator" + SettingsPath)
+ startCreatorTryingClang()
if not startedWithoutPluginError():
return
# open example project
openQmakeProject(examplePath)
# wait for parsing to complete
progressBarWait(30000)
- # open .cpp file in editor
- if not openDocument("propertyanimation.Sources.main\\.cpp"):
- test.fatal("Could not open main.cpp")
- invokeMenuItem("File", "Exit")
- return
- test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
- "Verifying if: .cpp file is opened in Edit mode.")
- # place cursor on line "QmlApplicationViewer viewer;"
- editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
- # invoke find usages from context menu on word "viewer"
- if not invokeFindUsage(editorWidget, "QmlApplicationViewer viewer;", "<Left>", 10):
- invokeMenuItem("File", "Exit")
- return
- # wait until search finished and verify search results
- waitForSearchResults()
- validateSearchResult(14)
- result = re.search("QmlApplicationViewer", str(editorWidget.plainText))
- test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. "
- "File with used text is opened.")
- # move cursor to the other word and test Find Usages function by pressing Ctrl+Shift+U.
- openDocument("propertyanimation.Sources.main\\.cpp")
- if not placeCursorToLine(editorWidget, "viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);"):
- return
- for i in range(4):
- type(editorWidget, "<Left>")
- type(editorWidget, "<Ctrl+Shift+u>")
- # wait until search finished and verify search results
- waitForSearchResults()
- validateSearchResult(3)
- # exit qt creator
- invokeMenuItem("File", "Save All")
+ models = iterateAvailableCodeModels()
+ for current in models:
+ if current != models[0]:
+ selectCodeModel(current)
+ test.log("Testing code model: %s" % current)
+ # open .cpp file in editor
+ if not openDocument("propertyanimation.Sources.main\\.cpp"):
+ test.fatal("Could not open main.cpp")
+ invokeMenuItem("File", "Exit")
+ return
+ test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
+ "Verifying if: .cpp file is opened in Edit mode.")
+ # place cursor on line "QmlApplicationViewer viewer;"
+ editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
+ # invoke find usages from context menu on word "viewer"
+ if not invokeFindUsage(editorWidget, "QmlApplicationViewer viewer;", "<Left>", 10):
+ invokeMenuItem("File", "Exit")
+ return
+ # wait until search finished and verify search results
+ waitForSearchResults()
+ validateSearchResult(14)
+ result = re.search("QmlApplicationViewer", str(editorWidget.plainText))
+ test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. "
+ "File with used text is opened.")
+ # move cursor to the other word and test Find Usages function by pressing Ctrl+Shift+U.
+ openDocument("propertyanimation.Sources.main\\.cpp")
+ if not placeCursorToLine(editorWidget, "viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);"):
+ return
+ for i in range(4):
+ type(editorWidget, "<Left>")
+ type(editorWidget, "<Ctrl+Shift+u>")
+ # wait until search finished and verify search results
+ waitForSearchResults()
+ validateSearchResult(3)
+ invokeMenuItem("File", "Close All")
invokeMenuItem("File", "Exit")
def waitForSearchResults():
diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py
index 32271b0ae7..457b177621 100644
--- a/tests/system/suite_CSUP/tst_CSUP05/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP05/test.py
@@ -39,59 +39,64 @@ def main():
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = os.path.join(templateDir, proFile)
- startApplication("qtcreator" + SettingsPath)
+ startCreatorTryingClang()
if not startedWithoutPluginError():
return
# open example project
openQmakeProject(examplePath)
# wait for parsing to complete
progressBarWait(30000)
- # open .cpp file in editor
- if not openDocument("propertyanimation.Sources.main\\.cpp"):
- test.fatal("Could not open main.cpp")
- invokeMenuItem("File", "Exit")
- return
- test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
- "Verifying if: .cpp file is opened in Edit mode.")
- # select some word for example "viewer" and press Ctrl+F.
- editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
- if not placeCursorToLine(editorWidget, "QmlApplicationViewer viewer;"):
- invokeMenuItem("File", "Exit")
- return
- type(editorWidget, "<Left>")
- markText(editorWidget, "Left", 6)
- type(editorWidget, "<Ctrl+f>")
- # verify if find toolbar exists and if search text contains selected word
- test.verify(checkIfObjectExists(":*Qt Creator.Find_Find::Internal::FindToolBar"),
- "Verifying if: Find/Replace pane is displayed at the bottom of the view.")
- test.compare(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit").displayText, "viewer",
- "Verifying if: Find line edit contains 'viewer' text.")
- # insert some word to "Replace with:" field and select "Replace All".
- replaceEditorContent(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), "find")
- oldCodeText = str(editorWidget.plainText)
- clickButton(waitForObject(":Qt Creator.Replace All_QToolButton"))
- mouseClick(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), 5, 5, 0, Qt.LeftButton)
- newCodeText = str(editorWidget.plainText)
- test.compare(newCodeText, oldCodeText.replace("viewer", "find").replace("Viewer", "find"),
- "Verifying if: Found text is replaced with new word properly.")
- # select some other word in .cpp file and select "Edit" -> "Find/Replace".
- clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
- placeCursorToLine(editorWidget, "find.setOrientation(QmlApplicationfind::ScreenOrientationAuto);")
- for i in range(25):
+ models = iterateAvailableCodeModels()
+ for current in models:
+ if current != models[0]:
+ selectCodeModel(current)
+ test.log("Testing code model: %s" % current)
+ # open .cpp file in editor
+ if not openDocument("propertyanimation.Sources.main\\.cpp"):
+ test.fatal("Could not open main.cpp")
+ invokeMenuItem("File", "Exit")
+ return
+ test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
+ "Verifying if: .cpp file is opened in Edit mode.")
+ # select some word for example "viewer" and press Ctrl+F.
+ editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
+ if not placeCursorToLine(editorWidget, "QmlApplicationViewer viewer;"):
+ invokeMenuItem("File", "Exit")
+ return
type(editorWidget, "<Left>")
- markText(editorWidget, "Left", 18)
- invokeMenuItem("Edit", "Find/Replace", "Find/Replace")
- replaceEditorContent(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), "QmlApplicationViewer")
- oldCodeText = str(editorWidget.plainText)
- clickButton(waitForObject(":Qt Creator.Replace_QToolButton"))
- newCodeText = str(editorWidget.plainText)
- # "::" is used to replace only one occurrence by python
- test.compare(newCodeText, oldCodeText.replace("QmlApplicationfind::", "QmlApplicationViewer::"),
- "Verifying if: Only selected word is replaced, the rest of found words are not replaced.")
- # close Find/Replace tab.
- clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
- test.verify(checkIfObjectExists(":*Qt Creator.Find_Find::Internal::FindToolBar", False),
- "Verifying if: Find/Replace tab is closed.")
- # exit qt creator
- invokeMenuItem("File", "Save All")
+ markText(editorWidget, "Left", 6)
+ type(editorWidget, "<Ctrl+f>")
+ # verify if find toolbar exists and if search text contains selected word
+ test.verify(checkIfObjectExists(":*Qt Creator.Find_Find::Internal::FindToolBar"),
+ "Verifying if: Find/Replace pane is displayed at the bottom of the view.")
+ test.compare(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit").displayText, "viewer",
+ "Verifying if: Find line edit contains 'viewer' text.")
+ # insert some word to "Replace with:" field and select "Replace All".
+ replaceEditorContent(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), "find")
+ oldCodeText = str(editorWidget.plainText)
+ clickButton(waitForObject(":Qt Creator.Replace All_QToolButton"))
+ mouseClick(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), 5, 5, 0, Qt.LeftButton)
+ newCodeText = str(editorWidget.plainText)
+ test.compare(newCodeText, oldCodeText.replace("viewer", "find").replace("Viewer", "find"),
+ "Verifying if: Found text is replaced with new word properly.")
+ # select some other word in .cpp file and select "Edit" -> "Find/Replace".
+ clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
+ placeCursorToLine(editorWidget, "find.setOrientation(QmlApplicationfind::ScreenOrientationAuto);")
+ for i in range(25):
+ type(editorWidget, "<Left>")
+ markText(editorWidget, "Left", 18)
+ invokeMenuItem("Edit", "Find/Replace", "Find/Replace")
+ replaceEditorContent(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), "QmlApplicationViewer")
+ oldCodeText = str(editorWidget.plainText)
+ clickButton(waitForObject(":Qt Creator.Replace_QToolButton"))
+ newCodeText = str(editorWidget.plainText)
+ # "::" is used to replace only one occurrence by python
+ test.compare(newCodeText, oldCodeText.replace("QmlApplicationfind::", "QmlApplicationViewer::"),
+ "Verifying if: Only selected word is replaced, the rest of found words are not replaced.")
+ # close Find/Replace tab.
+ clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
+ test.verify(checkIfObjectExists(":*Qt Creator.Find_Find::Internal::FindToolBar", False),
+ "Verifying if: Find/Replace tab is closed.")
+ invokeMenuItem("File", "Close All")
+ clickButton(waitForObject(":Save Changes.Do not Save_QPushButton"))
invokeMenuItem("File", "Exit")
diff --git a/tests/system/suite_CSUP/tst_CSUP06/test.py b/tests/system/suite_CSUP/tst_CSUP06/test.py
index 03076d1843..7d313ca6ee 100644
--- a/tests/system/suite_CSUP/tst_CSUP06/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP06/test.py
@@ -29,28 +29,6 @@
source("../../shared/qtcreator.py")
-def makeClangDefaultCodeModel(pluginAvailable):
- invokeMenuItem("Tools", "Options...")
- waitForObjectItem(":Options_QListView", "C++")
- clickItem(":Options_QListView", "C++", 14, 15, 0, Qt.LeftButton)
- clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Code Model")
- expectedObjNames = ['cChooser', 'cppChooser', 'objcChooser', 'objcppChooser', 'hChooser']
- for exp in expectedObjNames:
- test.verify(checkIfObjectExists("{type='QComboBox' name='%s' visible='1'}" % exp),
- "Verifying whether combobox '%s' exists." % exp)
- combo = findObject("{type='QComboBox' name='%s' visible='1'}" % exp)
- if test.verify(combo.enabled == pluginAvailable, "Verifying whether combobox is enabled."):
- if test.compare(combo.currentText, "Qt Creator Built-in",
- "Verifying whether default is Qt Creator's builtin code model"):
- items = dumpItems(combo.model())
- if (pluginAvailable and
- test.verify("Clang" in items,
- "Verifying whether clang code model can be chosen.")):
- selectFromCombo(combo, "Clang")
- test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"),
- "Verifying whether 'Ignore pre-compiled headers' is checked by default.")
- clickButton(waitForObject(":Options.OK_QPushButton"))
-
def moveDownToNextNonEmptyLine(editor):
currentLine = "" # there's no do-while in python - so use empty line which fails
while not currentLine:
@@ -176,30 +154,22 @@ def main():
examplePath = os.path.join(srcPath, "creator", "tests", "manual", "cplusplus-tools")
if not neededFilePresent(os.path.join(examplePath, "cplusplus-tools.pro")):
return
- try:
- # start Qt Creator with enabled ClangCodeModel plugin (without modifying settings)
- startApplication("qtcreator -load ClangCodeModel" + SettingsPath)
- errorMsg = "{type='QMessageBox' unnamed='1' visible='1' windowTitle='Qt Creator'}"
- errorOK = "{text='OK' type='QPushButton' unnamed='1' visible='1' window=%s}" % errorMsg
- if waitFor("object.exists(errorOK)", 5000):
- clickButton(errorOK) # Error message
- clickButton(errorOK) # Help message
- raise Exception("ClangCodeModel not found.")
- clangCodeModelPluginAvailable = True
- models = ["builtin", "clang"]
- except:
- # ClangCodeModel plugin has not been built - start without it
- test.warning("ClangCodeModel plugin not available - performing test without.")
- startApplication("qtcreator" + SettingsPath)
- clangCodeModelPluginAvailable = False
- models = ["builtin"]
+ clangLoaded = startCreatorTryingClang()
if not startedWithoutPluginError():
return
templateDir = prepareTemplate(examplePath)
examplePath = os.path.join(templateDir, "cplusplus-tools.pro")
openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT)
+ models = iterateAvailableCodeModels()
+ test.compare(len(models), 1 + clangLoaded, "Verifying number of available code models")
+ test.compare("Qt Creator Built-in", models[0],
+ "Verifying whether default is Qt Creator's builtin code model")
+ test.compare("Clang" in models, clangLoaded,
+ "Verifying whether clang code model can be chosen.")
for current in models:
+ if current != models[0]:
+ selectCodeModel(current)
test.log("Testing code model: %s" % current)
if not openDocument("cplusplus-tools.Sources.main\\.cpp"):
earlyExit("Failed to open main.cpp.")
@@ -207,11 +177,9 @@ def main():
editor = getEditorForFileSuffix("main.cpp")
if editor:
checkIncludeCompletion(editor)
- checkSymbolCompletion(editor, current != "builtin")
+ checkSymbolCompletion(editor, current == "Clang")
invokeMenuItem('File', 'Revert "main.cpp" to Saved')
clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
- if current == "builtin":
- makeClangDefaultCodeModel(clangCodeModelPluginAvailable)
snooze(1) # 'Close "main.cpp"' might still be disabled
# editor must be closed to get the second code model applied on re-opening the file
invokeMenuItem('File', 'Close "main.cpp"')
diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py
index d7a0f6b5f6..b4cb9ba48d 100644
--- a/tests/system/suite_debugger/tst_simple_debug/test.py
+++ b/tests/system/suite_debugger/tst_simple_debug/test.py
@@ -84,6 +84,10 @@ def main():
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
clickButton(waitForObject("{type='CloseButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"))
+ try:
+ clickButton(waitForObject(":Close Debugging Session.Yes_QPushButton", 2000))
+ except:
+ pass
if platform.system() == 'Darwin' and JIRA.isBugStillOpen(11595):
try:
expectedBreakpointsOrder.remove({os.path.join(workingDir, projectName, "main.cpp"):10})
diff --git a/tests/system/suite_editors/tst_memberoperator/test.py b/tests/system/suite_editors/tst_memberoperator/test.py
index 04c992fe04..4f976fdbde 100644
--- a/tests/system/suite_editors/tst_memberoperator/test.py
+++ b/tests/system/suite_editors/tst_memberoperator/test.py
@@ -30,26 +30,38 @@
source("../../shared/qtcreator.py")
def main():
- startApplication("qtcreator" + SettingsPath)
+ startCreatorTryingClang()
if not startedWithoutPluginError():
return
createProject_Qt_Console(tempDir(), "SquishProject")
- selectFromLocator("main.cpp")
- cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
+ models = iterateAvailableCodeModels()
+ for current in models:
+ if current != models[0]:
+ selectCodeModel(current)
+ test.log("Testing code model: %s" % current)
+ selectFromLocator("main.cpp")
+ cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
- for record in testData.dataset("usages.tsv"):
- include = testData.field(record, "include")
- if include:
- placeCursorToLine(cppwindow, "#include <QCoreApplication>")
- typeLines(cppwindow, ("", "#include " + include))
- placeCursorToLine(cppwindow, "return a.exec();")
- typeLines(cppwindow, ("<Up>", testData.field(record, "declaration")))
- type(cppwindow, testData.field(record, "usage"))
- snooze(1) # maybe find something better
- type(cppwindow, testData.field(record, "operator"))
- waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500)
- test.compare(str(lineUnderCursor(cppwindow)).strip(), testData.field(record, "expected"))
- invokeMenuItem("File", 'Revert "main.cpp" to Saved')
- clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
+ for record in testData.dataset("usages.tsv"):
+ include = testData.field(record, "include")
+ if include:
+ placeCursorToLine(cppwindow, "#include <QCoreApplication>")
+ typeLines(cppwindow, ("", "#include " + include))
+ placeCursorToLine(cppwindow, "return a.exec();")
+ typeLines(cppwindow, ("<Up>", testData.field(record, "declaration")))
+ type(cppwindow, testData.field(record, "usage"))
+ snooze(1) # maybe find something better
+ type(cppwindow, testData.field(record, "operator"))
+ waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500)
+ found = str(lineUnderCursor(cppwindow)).strip()
+ exp = testData.field(record, "expected")
+ if current == "Clang" and exp[-2:] == "->":
+ test.xcompare(found, exp) # QTCREATORBUG-11581
+ else:
+ test.compare(found, exp)
+ invokeMenuItem("File", 'Revert "main.cpp" to Saved')
+ clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
+ snooze(1)
+ invokeMenuItem("File", "Close All")
invokeMenuItem("File", "Exit")