Merge remote-tracking branch 'origin/4.7'

Conflicts:
	src/plugins/debugger/debuggerruncontrol.cpp

Change-Id: I72882df605bc3fc8a8d20118fd4e49207ac92664
This commit is contained in:
Eike Ziller
2018-08-07 09:42:02 +02:00
52 changed files with 306 additions and 360 deletions

View File

@@ -744,11 +744,10 @@
\section3 Null Pointers \section3 Null Pointers
Using a plain zero (0) for null pointer constants is always correct and Use nullptr for null pointer constants.
least effort to type.
\code \code
void *p = 0; void *p = nullptr;
-NOT- -NOT-
@@ -764,7 +763,7 @@
\endcode \endcode
\note As an exception, imported third party code as well as code \note As an exception, imported third party code as well as code
interfacing the native APIs (src/support/os_*) can use NULL. interfacing the native APIs (src/support/os_*) can use NULL or 0.
\section2 C++11 and C++14 Features \section2 C++11 and C++14 Features

View File

@@ -303,7 +303,7 @@ The minimum API level required by the kit is %1.</source>
</message> </message>
<message> <message>
<source>Android run settings</source> <source>Android run settings</source>
<translation>Настройки запуска Android</translation> <translation>Настройки запуска под Android</translation>
</message> </message>
<message> <message>
<source>The project file &quot;%1&quot; is currently being parsed.</source> <source>The project file &quot;%1&quot; is currently being parsed.</source>
@@ -357,7 +357,7 @@ The minimum API level required by the kit is %1.</source>
</message> </message>
<message> <message>
<source>Install the missing emulator tool (%1) to the installed Android SDK.</source> <source>Install the missing emulator tool (%1) to the installed Android SDK.</source>
<translation>Установите отсутствующую утилиту эмуляции (%1) в установленный Android SDK.</translation> <translation>Установите утилиту эмуляции (%1) в установленный Android SDK.</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -929,7 +929,7 @@ Do you want to uninstall the existing package?</source>
</message> </message>
<message> <message>
<source>Cannot attach jdb to the running application</source> <source>Cannot attach jdb to the running application</source>
<translation>Не удалось подключить jdb к работающему приложению</translation> <translation>Не удалось подключить jdb к запущенному приложению</translation>
</message> </message>
<message> <message>
<source>&quot;%1&quot; died.</source> <source>&quot;%1&quot; died.</source>
@@ -1909,7 +1909,7 @@ Executable: %2</source>
</message> </message>
<message> <message>
<source>Select on what grouping the tests should be based.</source> <source>Select on what grouping the tests should be based.</source>
<translation>Выберите основание для группировки тестов.</translation> <translation>Выберите критерий для группировки тестов.</translation>
</message> </message>
<message> <message>
<source>Directory</source> <source>Directory</source>
@@ -14156,7 +14156,7 @@ You can choose between waiting longer or aborting debugging.</source>
</message> </message>
<message> <message>
<source>Attached to running application.</source> <source>Attached to running application.</source>
<translation>Присоединено к работающему приложению.</translation> <translation>Присоединено к запущенному приложению.</translation>
</message> </message>
<message> <message>
<source>Failed to attach to application: %1</source> <source>Failed to attach to application: %1</source>

View File

@@ -49,8 +49,10 @@ public:
toReplace.append(':'); toReplace.append(':');
toReplace.append(lib.path()); toReplace.append(lib.path());
if (ldLibraryPath.startsWith(toReplace)) if (ldLibraryPath.startsWith(toReplace + ':'))
set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length())); set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length() + 1));
else if (ldLibraryPath == toReplace)
unset("LD_LIBRARY_PATH");
} }
} }
}; };

View File

@@ -238,7 +238,8 @@ void TestRunner::cancelCurrent(TestRunner::CancelReason reason)
void TestRunner::onProcessFinished() void TestRunner::onProcessFinished()
{ {
if (m_currentConfig) { if (m_executingTests && QTC_GUARD(m_currentConfig)) {
QTC_CHECK(m_fakeFutureInterface);
m_fakeFutureInterface->setProgressValue(m_fakeFutureInterface->progressValue() m_fakeFutureInterface->setProgressValue(m_fakeFutureInterface->progressValue()
+ m_currentConfig->testCaseCount()); + m_currentConfig->testCaseCount());
if (!m_fakeFutureInterface->isCanceled()) { if (!m_fakeFutureInterface->isCanceled()) {
@@ -257,6 +258,10 @@ void TestRunner::onProcessFinished()
} }
resetInternalPointers(); resetInternalPointers();
if (!m_fakeFutureInterface) {
QTC_ASSERT(!m_executingTests, m_executingTests = false);
return;
}
if (!m_selectedTests.isEmpty() && !m_fakeFutureInterface->isCanceled()) if (!m_selectedTests.isEmpty() && !m_fakeFutureInterface->isCanceled())
scheduleNext(); scheduleNext();
else else
@@ -552,8 +557,9 @@ void TestRunner::debugTests()
outputreader, &QObject::deleteLater); outputreader, &QObject::deleteLater);
} }
connect(this, &TestRunner::requestStopTestRun, runControl, m_stopDebugConnect = connect(this, &TestRunner::requestStopTestRun,
&ProjectExplorer::RunControl::initiateStop); runControl, &ProjectExplorer::RunControl::initiateStop);
connect(runControl, &ProjectExplorer::RunControl::stopped, this, &TestRunner::onFinished); connect(runControl, &ProjectExplorer::RunControl::stopped, this, &TestRunner::onFinished);
ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl); ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl);
} }
@@ -611,6 +617,7 @@ void TestRunner::onFinished()
qDeleteAll(m_selectedTests); qDeleteAll(m_selectedTests);
m_selectedTests.clear(); m_selectedTests.clear();
disconnect(m_stopDebugConnect);
disconnect(m_targetConnect); disconnect(m_targetConnect);
m_fakeFutureInterface = nullptr; m_fakeFutureInterface = nullptr;
m_executingTests = false; m_executingTests = false;

View File

@@ -98,6 +98,8 @@ private:
// temporarily used if building before running is necessary // temporarily used if building before running is necessary
QMetaObject::Connection m_buildConnect; QMetaObject::Connection m_buildConnect;
// temporarily used when debugging
QMetaObject::Connection m_stopDebugConnect;
// temporarily used for handling of switching the current target // temporarily used for handling of switching the current target
QMetaObject::Connection m_targetConnect; QMetaObject::Connection m_targetConnect;
}; };

View File

@@ -40,6 +40,7 @@ namespace CppTools {
class CPPTOOLS_EXPORT VirtualFunctionAssistProvider : public TextEditor::IAssistProvider class CPPTOOLS_EXPORT VirtualFunctionAssistProvider : public TextEditor::IAssistProvider
{ {
Q_OBJECT
public: public:
VirtualFunctionAssistProvider(); VirtualFunctionAssistProvider();

View File

@@ -2603,10 +2603,14 @@ void GdbEngine::changeBreakpoint(Breakpoint bp)
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }; cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); };
} else if (data.command != response.command) { } else if (data.command != response.command) {
cmd.function = "-break-commands " + bpnr; cmd.function = "-break-commands " + bpnr;
foreach (const QString &command, data.command.split(QLatin1String("\n"))) { for (QString command : data.command.split('\n')) {
if (!command.isEmpty()) if (!command.isEmpty()) {
// escape backslashes and quotes
command.replace('\\', "\\\\");
command.replace('"', "\\\"");
cmd.function += " \"" + command + '"'; cmd.function += " \"" + command + '"';
} }
}
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakIgnore(r, bp); }; cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakIgnore(r, bp); };
} else if (!data.conditionsMatch(response.condition)) { } else if (!data.conditionsMatch(response.condition)) {
cmd.function = "condition " + bpnr + ' ' + data.condition; cmd.function = "condition " + bpnr + ' ' + data.condition;

View File

@@ -78,8 +78,7 @@ GuiAppWizard::GuiAppWizard()
"Includes a Qt Designer-based main window.\n\n" "Includes a Qt Designer-based main window.\n\n"
"Preselects a desktop Qt for building the application if available.")); "Preselects a desktop Qt for building the application if available."));
setIcon(QIcon(QLatin1String(":/wizards/images/gui.png"))); setIcon(QIcon(QLatin1String(":/wizards/images/gui.png")));
auto qt5 = Core::Id::fromString(QString(QtSupport::Constants::FEATURE_QT_PREFIX).append(".5")); setRequiredFeatures({QtSupport::Constants::FEATURE_QWIDGETS});
setRequiredFeatures({QtSupport::Constants::FEATURE_QWIDGETS, qt5});
} }
Core::BaseFileWizard *GuiAppWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const Core::BaseFileWizard *GuiAppWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const

View File

@@ -84,7 +84,6 @@ QtProjectParameters GuiAppWizardDialog::projectParameters() const
rc.path = path(); rc.path = path();
rc.selectedModules = selectedModulesList(); rc.selectedModules = selectedModulesList();
rc.deselectedModules = deselectedModulesList(); rc.deselectedModules = deselectedModulesList();
rc.qtVersionSupport = QtProjectParameters::SupportQt5Only;
return rc; return rc;
} }

View File

@@ -512,7 +512,7 @@ bool CodeAssistantPrivate::isDestroyEvent(int key, const QString &keyText)
{ {
if (keyText.isEmpty()) if (keyText.isEmpty())
return key != Qt::LeftArrow && key != Qt::RightArrow && key != Qt::Key_Shift; return key != Qt::LeftArrow && key != Qt::RightArrow && key != Qt::Key_Shift;
else if (auto *provider = dynamic_cast<CompletionAssistProvider *>(m_requestProvider)) if (auto *provider = qobject_cast<CompletionAssistProvider *>(m_requestProvider))
return !provider->isContinuationChar(keyText.at(0)); return !provider->isContinuationChar(keyText.at(0));
return false; return false;
} }

View File

@@ -159,7 +159,6 @@
:Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView {type='QmlJSEditor::Internal::QmlJSOutlineTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView {type='QmlJSEditor::Internal::QmlJSOutlineTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::Internal::QmlJSEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::Internal::QmlJSEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_SystemSettings.Details_Utils::DetailsButton {occurrence='4' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_TextEditor::TextEditorWidget {type='TextEditor::TextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_TextEditor::TextEditorWidget {type='TextEditor::TextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Utils::BuildDirectoryLineEdit {name='shadowBuildDirEditLineEdit' type='Utils::FancyLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::BuildDirectoryLineEdit {name='shadowBuildDirEditLineEdit' type='Utils::FancyLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
@@ -220,7 +219,6 @@
:scrollArea.Edit build configuration:_QComboBox {leftWidget=':scrollArea.Edit build configuration:_QLabel' type='QComboBox' unnamed='1' visible='1'} :scrollArea.Edit build configuration:_QComboBox {leftWidget=':scrollArea.Edit build configuration:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:scrollArea.Edit build configuration:_QLabel {text='Edit build configuration:' type='QLabel' unnamed='1' visible='1'} :scrollArea.Edit build configuration:_QLabel {text='Edit build configuration:' type='QLabel' unnamed='1' visible='1'}
:scrollArea.Library not available_QLabel {name='qmlDebuggingWarningText' text?='Library not available*' type='QLabel' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :scrollArea.Library not available_QLabel {name='qmlDebuggingWarningText' text?='Library not available*' type='QLabel' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:scrollArea.environment_QTreeView {container=':Qt Creator.scrollArea_QScrollArea' type='QTreeView' unnamed='1' visible='1'}
:scrollArea.qmlDebuggingLibraryCheckBox_QCheckBox {name='qmlDebuggingLibraryCheckBox' type='QCheckBox' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :scrollArea.qmlDebuggingLibraryCheckBox_QCheckBox {name='qmlDebuggingLibraryCheckBox' type='QCheckBox' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:sourceFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Source file:_QLabel' name='sourceFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} :sourceFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Source file:_QLabel' name='sourceFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
:splitter.Commit File(s)_VcsBase::QActionPushButton {text~='(Commit .+/.+ File.*)' type='VcsBase::QActionPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :splitter.Commit File(s)_VcsBase::QActionPushButton {text~='(Commit .+/.+ File.*)' type='VcsBase::QActionPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}

View File

@@ -25,6 +25,11 @@
import re; import re;
def getBuildIssues():
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
model = waitForObject(":Qt Creator.Issues_QListView").model()
return dumpBuildIssues(model)
# this method checks the last build (if there's one) and logs the number of errors, warnings and # this method checks the last build (if there's one) and logs the number of errors, warnings and
# lines within the Issues output # lines within the Issues output
# param expectedToFail can be used to tell this function if the build was expected to fail or not # param expectedToFail can be used to tell this function if the build was expected to fail or not
@@ -32,20 +37,17 @@ import re;
def checkLastBuild(expectedToFail=False, createTasksFileOnError=True): def checkLastBuild(expectedToFail=False, createTasksFileOnError=True):
try: try:
# can't use waitForObject() 'cause visible is always 0 # can't use waitForObject() 'cause visible is always 0
buildProg = findObject("{type='ProjectExplorer::Internal::BuildProgress' unnamed='1' }") findObject("{type='ProjectExplorer::Internal::BuildProgress' unnamed='1' }")
except LookupError: except LookupError:
test.log("checkLastBuild called without a build") test.log("checkLastBuild called without a build")
return return
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton") buildIssues = getBuildIssues()
model = waitForObject(":Qt Creator.Issues_QListView").model()
buildIssues = dumpBuildIssues(model)
types = map(lambda i: i[5], buildIssues) types = map(lambda i: i[5], buildIssues)
errors = types.count("1") errors = types.count("1")
warnings = types.count("2") warnings = types.count("2")
gotErrors = errors != 0 gotErrors = errors != 0
test.verify(not (gotErrors ^ expectedToFail), "Errors: %s | Warnings: %s" % (errors, warnings)) test.verify(not (gotErrors ^ expectedToFail), "Errors: %s | Warnings: %s" % (errors, warnings))
# additional stuff - could be removed... or improved :) # additional stuff - could be removed... or improved :)
test.log("Rows inside issues: %d" % model.rowCount())
if gotErrors and createTasksFileOnError: if gotErrors and createTasksFileOnError:
createTasksFile(buildIssues) createTasksFile(buildIssues)
return not gotErrors return not gotErrors
@@ -129,15 +131,14 @@ def createTasksFile(buildIssues):
file.close() file.close()
test.log("Written tasks file %s" % outfile) test.log("Written tasks file %s" % outfile)
# returns a list of pairs each containing the zero based number of a kit # returns a list of pairs each containing the ID of a kit (see class Targets)
# and the name of the matching build configuration # and the name of the matching build configuration
# param kitCount specifies the number of kits currently defined (must be correct!)
# param filter is a regular expression to filter the configuration by their name # param filter is a regular expression to filter the configuration by their name
def iterateBuildConfigs(kitCount, filter = ""): def iterateBuildConfigs(filter = ""):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
configs = [] configs = []
for currentKit in range(kitCount): for currentKit in iterateConfiguredKits():
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.BUILD) switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.BUILD)
model = waitForObject(":scrollArea.Edit build configuration:_QComboBox").model() model = waitForObject(":scrollArea.Edit build configuration:_QComboBox").model()
prog = re.compile(filter) prog = re.compile(filter)
# for each row in the model, write its data to a list # for each row in the model, write its data to a list
@@ -149,21 +150,23 @@ def iterateBuildConfigs(kitCount, filter = ""):
return configs return configs
# selects a build configuration for building the current project # selects a build configuration for building the current project
# param targetCount specifies the number of targets currently defined (must be correct!) # param wantedKit specifies the ID of the kit to select (see class Targets)
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
# param configName is the name of the configuration that should be selected # param configName is the name of the configuration that should be selected
# param afterSwitchTo the ViewConstant of the mode to switch to after selecting or None # param afterSwitchTo the ViewConstant of the mode to switch to after selecting or None
# returns information about the selected kit, see getQtInformationForBuildSettings def selectBuildConfig(wantedKit, configName, afterSwitchTo=ViewConstants.EDIT):
def selectBuildConfig(targetCount, currentTarget, configName, afterSwitchTo=ViewConstants.EDIT):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD) if any((switchToBuildOrRunSettingsFor(wantedKit, ProjectSettings.BUILD),
if selectFromCombo(":scrollArea.Edit build configuration:_QComboBox", configName) or targetCount > 1: selectFromCombo(":scrollArea.Edit build configuration:_QComboBox", configName))):
progressBarWait(30000) progressBarWait(30000)
return getQtInformationForBuildSettings(targetCount, True, afterSwitchTo) if afterSwitchTo:
if ViewConstants.FIRST_AVAILABLE <= afterSwitchTo <= ViewConstants.LAST_AVAILABLE:
switchViewTo(afterSwitchTo)
else:
test.warning("Don't know where you trying to switch to (%s)" % afterSwitchTo)
# This will not trigger a rebuild. If needed, caller has to do this. # This will not trigger a rebuild. If needed, caller has to do this.
def verifyBuildConfig(targetCount, currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, enableQmlDebug=False): def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, enableQmlDebug=False):
qtInfo = selectBuildConfig(targetCount, currentTarget, configName, None) selectBuildConfig(currentTarget, configName, None)
ensureChecked(waitForObject(":scrollArea.Details_Utils::DetailsButton")) ensureChecked(waitForObject(":scrollArea.Details_Utils::DetailsButton"))
ensureChecked("{name='shadowBuildCheckBox' type='QCheckBox' visible='1'}", enableShadowBuild) ensureChecked("{name='shadowBuildCheckBox' type='QCheckBox' visible='1'}", enableShadowBuild)
buildCfCombo = waitForObject("{type='QComboBox' name='buildConfigurationComboBox' visible='1' " buildCfCombo = waitForObject("{type='QComboBox' name='buildConfigurationComboBox' visible='1' "
@@ -201,7 +204,6 @@ def verifyBuildConfig(targetCount, currentTarget, configName, shouldBeDebug=Fals
clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000))
clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton")) clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton"))
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
return qtInfo
# verify if building and running of project was successful # verify if building and running of project was successful
def verifyBuildAndRun(): def verifyBuildAndRun():
@@ -216,15 +218,15 @@ def verifyBuildAndRun():
"Verifying if built app started and closed successfully.") "Verifying if built app started and closed successfully.")
# run project for debug and release # run project for debug and release
def runVerify(checkedTargets): def runVerify():
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs()
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found build configurations, quitting") test.fatal("Haven't found build configurations, quitting")
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
# select debug configuration # select debug configuration
for kit, config in availableConfigs: for kit, config in availableConfigs:
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(kit, config)
test.log("Using build config '%s'" % config) test.log("Using build config '%s'" % config)
if runAndCloseApp() == None: if runAndCloseApp() == None:
checkCompile() checkCompile()

View File

@@ -24,7 +24,6 @@
############################################################################ ############################################################################
import __builtin__ import __builtin__
import operator
# for easier re-usage (because Python hasn't an enum type) # for easier re-usage (because Python hasn't an enum type)
class Targets: class Targets:
@@ -81,6 +80,13 @@ class Targets:
test.fatal("You've passed at least one unknown target!") test.fatal("You've passed at least one unknown target!")
return result return result
@staticmethod
def getIdForTargetName(targetName):
for id in Targets.ALL_TARGETS:
if Targets.getStringForTarget(id) == targetName:
return id
raise Exception("'%s' is not a known target name" % targetName)
@staticmethod @staticmethod
def getDefaultKit(): def getDefaultKit():
return Targets.DESKTOP_5_6_1_DEFAULT return Targets.DESKTOP_5_6_1_DEFAULT

View File

@@ -23,8 +23,6 @@
# #
############################################################################ ############################################################################
import re
def handleDebuggerWarnings(config, isMsvcBuild=False): def handleDebuggerWarnings(config, isMsvcBuild=False):
if isMsvcBuild: if isMsvcBuild:
try: try:
@@ -71,7 +69,7 @@ def setBreakpointsForCurrentProject(filesAndLines):
if not filesAndLines or not isinstance(filesAndLines, (list,tuple)): if not filesAndLines or not isinstance(filesAndLines, (list,tuple)):
test.fatal("This function only takes a non-empty list/tuple holding dicts.") test.fatal("This function only takes a non-empty list/tuple holding dicts.")
return False return False
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' " waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}") "window=':Qt Creator_Core::Internal::MainWindow'}")
for current in filesAndLines: for current in filesAndLines:
for curFile,curLine in current.iteritems(): for curFile,curLine in current.iteritems():
@@ -115,25 +113,24 @@ def removeOldBreakpoints():
return test.compare(model.rowCount(), 0, "Check if all breakpoints have been removed.") return test.compare(model.rowCount(), 0, "Check if all breakpoints have been removed.")
# function to do simple debugging of the current (configured) project # function to do simple debugging of the current (configured) project
# param kitCount specifies the number of kits currently defined (must be correct!) # param currentKit specifies the ID of the kit to use (see class Targets)
# param currentKit specifies the target to use (zero based index)
# param currentConfigName is the name of the configuration that should be used # param currentConfigName is the name of the configuration that should be used
# param pressContinueCount defines how often it is expected to press # param pressContinueCount defines how often it is expected to press
# the 'Continue' button while debugging # the 'Continue' button while debugging
# param expectedBPOrder holds a list of dicts where the dicts contain always # param expectedBPOrder holds a list of dicts where the dicts contain always
# only 1 key:value pair - the key is the name of the file, the value is # only 1 key:value pair - the key is the name of the file, the value is
# line number where the debugger should stop # line number where the debugger should stop
def doSimpleDebugging(kitCount, currentKit, currentConfigName, pressContinueCount=1, def doSimpleDebugging(currentKit, currentConfigName, pressContinueCount=1,
expectedBPOrder=[], enableQml=True): expectedBPOrder=[], enableQml=True):
expectedLabelTexts = ['Stopped\.', 'Stopped at breakpoint \d+ \(\d+\) in thread \d+\.'] expectedLabelTexts = ['Stopped\.', 'Stopped at breakpoint \d+ \(\d+\) in thread \d+\.']
if len(expectedBPOrder) == 0: if len(expectedBPOrder) == 0:
expectedLabelTexts.append("Running\.") expectedLabelTexts.append("Running\.")
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.RUN) switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.RUN)
ensureChecked(waitForObject("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' " ensureChecked(waitForObject("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' "
"type='QCheckBox' unnamed='1' visible='1'}"), enableQml) "type='QCheckBox' unnamed='1' visible='1'}"), enableQml)
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
if not __startDebugger__(kitCount, currentKit, currentConfigName): if not __startDebugger__(currentKit, currentConfigName):
return False return False
statusLabel = findObject(":Debugger Toolbar.StatusText_Utils::StatusLabel") statusLabel = findObject(":Debugger Toolbar.StatusText_Utils::StatusLabel")
test.log("Continuing debugging %d times..." % pressContinueCount) test.log("Continuing debugging %d times..." % pressContinueCount)
@@ -167,20 +164,18 @@ def doSimpleDebugging(kitCount, currentKit, currentConfigName, pressContinueCoun
# if stopping failed - debugger had already stopped # if stopping failed - debugger had already stopped
return True return True
# param kitCount specifies the number of kits currently defined (must be correct!) # param currentKit specifies the ID of the kit to use (see class Targets)
# param currentKit specifies the target to use (zero based index) def isMsvcConfig(currentKit):
def isMsvcConfig(kitCount, currentKit):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.BUILD) switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.BUILD)
isMsvc = " -spec win32-msvc" in str(waitForObject(":qmakeCallEdit").text) isMsvc = " -spec win32-msvc" in str(waitForObject(":qmakeCallEdit").text)
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
return isMsvc return isMsvc
# param kitCount specifies the number of kits currently defined (must be correct!) # param currentKit specifies the ID of the kit to use (see class Targets)
# param currentKit specifies the target to use (zero based index)
# param config is the name of the configuration that should be used # param config is the name of the configuration that should be used
def __startDebugger__(kitCount, currentKit, config): def __startDebugger__(currentKit, config):
isMsvcBuild = isMsvcConfig(kitCount, currentKit) isMsvcBuild = isMsvcConfig(currentKit)
clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton")) clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton"))
handleDebuggerWarnings(config, isMsvcBuild) handleDebuggerWarnings(config, isMsvcBuild)
try: try:

View File

@@ -106,7 +106,7 @@ def openContextMenuOnTextCursorPosition(editor):
# param direction is one of "Left", "Right", "Up", "Down", but "End" and combinations work as well # param direction is one of "Left", "Right", "Up", "Down", but "End" and combinations work as well
# param typeCount defines how often the cursor will be moved in the given direction (while marking) # param typeCount defines how often the cursor will be moved in the given direction (while marking)
def markText(editor, direction, typeCount=1): def markText(editor, direction, typeCount=1):
for i in range(typeCount): for _ in range(typeCount):
type(editor, "<Shift+%s>" % direction) type(editor, "<Shift+%s>" % direction)
# works for all standard editors # works for all standard editors
@@ -173,7 +173,7 @@ def verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, e
# param expectedVals a dict holding property value pairs that must match # param expectedVals a dict holding property value pairs that must match
def __handleTextTips__(textTip, expectedVals, alternativeVals): def __handleTextTips__(textTip, expectedVals, alternativeVals):
props = object.properties(textTip) props = object.properties(textTip)
expFail = altFail = False expFail = False
eResult = verifyProperties(props, expectedVals) eResult = verifyProperties(props, expectedVals)
for val in eResult.itervalues(): for val in eResult.itervalues():
if not val: if not val:
@@ -182,7 +182,6 @@ def __handleTextTips__(textTip, expectedVals, alternativeVals):
if expFail and alternativeVals != None: if expFail and alternativeVals != None:
aResult = verifyProperties(props, alternativeVals) aResult = verifyProperties(props, alternativeVals)
else: else:
altFail = True
aResult = None aResult = None
if not expFail: if not expFail:
test.passes("TextTip verified") test.passes("TextTip verified")
@@ -360,7 +359,7 @@ def invokeContextMenuItem(editorArea, command1, command2 = None):
def invokeFindUsage(editor, line, typeOperation, n=1): def invokeFindUsage(editor, line, typeOperation, n=1):
if not placeCursorToLine(editor, line, True): if not placeCursorToLine(editor, line, True):
return False return False
for i in range(n): for _ in range(n):
type(editor, typeOperation) type(editor, typeOperation)
snooze(1) snooze(1)
invokeContextMenuItem(editor, "Find Usages") invokeContextMenuItem(editor, "Find Usages")

View File

@@ -50,10 +50,9 @@ def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWe
clickButton(waitForObject("{text='Yes' type='QPushButton' unnamed='1' visible='1'}")) clickButton(waitForObject("{text='Yes' type='QPushButton' unnamed='1' visible='1'}"))
except: except:
pass pass
checkedTargets = __chooseTargets__(targets) __chooseTargets__(targets)
configureButton = waitForObject(":Qt Creator.Configure Project_QPushButton") configureButton = waitForObject(":Qt Creator.Configure Project_QPushButton")
clickButton(configureButton) clickButton(configureButton)
return checkedTargets
def openCmakeProject(projectPath, buildDir): def openCmakeProject(projectPath, buildDir):
def additionalFunction(): def additionalFunction():
@@ -156,8 +155,12 @@ def __createProjectHandleQtQuickSelection__(minimumQtVersion):
# Selects the Qt versions for a project # Selects the Qt versions for a project
# param checks turns tests in the function on if set to True # param checks turns tests in the function on if set to True
# param available a list holding the available targets # param available a list holding the available targets
def __selectQtVersionDesktop__(checks, available=None): # withoutQt4 if True Qt4 will get unchecked / not selected while checking the targets
checkedTargets = __chooseTargets__(Targets.desktopTargetClasses(), available) def __selectQtVersionDesktop__(checks, available=None, withoutQt4=False):
wanted = Targets.desktopTargetClasses()
if withoutQt4 and Targets.DESKTOP_4_8_7_DEFAULT in wanted:
wanted.remove(Targets.DESKTOP_4_8_7_DEFAULT)
checkedTargets = __chooseTargets__(wanted, available)
if checks: if checks:
for target in checkedTargets: for target in checkedTargets:
detailsWidget = waitForObject("{type='Utils::DetailsWidget' unnamed='1' visible='1' " detailsWidget = waitForObject("{type='Utils::DetailsWidget' unnamed='1' visible='1' "
@@ -171,7 +174,6 @@ def __selectQtVersionDesktop__(checks, available=None):
verifyChecked(cbObject % ("Release", objectMap.realName(detailsWidget))) verifyChecked(cbObject % ("Release", objectMap.realName(detailsWidget)))
clickButton(detailsButton) clickButton(detailsButton)
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
return checkedTargets
def __createProjectHandleLastPage__(expectedFiles=[], addToVersionControl="<None>", addToProject=None): def __createProjectHandleLastPage__(expectedFiles=[], addToVersionControl="<None>", addToProject=None):
if len(expectedFiles): if len(expectedFiles):
@@ -216,7 +218,7 @@ def createProject_Qt_GUI(path, projectName, checks = True, addToVersionControl =
template = "Qt Widgets Application" template = "Qt Widgets Application"
available = __createProjectOrFileSelectType__(" Application", template) available = __createProjectOrFileSelectType__(" Application", template)
__createProjectSetNameAndPath__(path, projectName, checks) __createProjectSetNameAndPath__(path, projectName, checks)
checkedTargets = __selectQtVersionDesktop__(checks, available) __selectQtVersionDesktop__(checks, available, True)
if checks: if checks:
exp_filename = "mainwindow" exp_filename = "mainwindow"
@@ -247,7 +249,6 @@ def createProject_Qt_GUI(path, projectName, checks = True, addToVersionControl =
progressBarWait(20000) progressBarWait(20000)
if checks: if checks:
__verifyFileCreation__(path, expectedFiles) __verifyFileCreation__(path, expectedFiles)
return checkedTargets
# Creates a Qt Console project # Creates a Qt Console project
# param path specifies where to create the project # param path specifies where to create the project
@@ -257,7 +258,7 @@ def createProject_Qt_Console(path, projectName, checks = True, buildSystem = Non
available = __createProjectOrFileSelectType__(" Application", "Qt Console Application") available = __createProjectOrFileSelectType__(" Application", "Qt Console Application")
__createProjectSetNameAndPath__(path, projectName, checks) __createProjectSetNameAndPath__(path, projectName, checks)
__handleBuildSystem__(buildSystem) __handleBuildSystem__(buildSystem)
checkedTargets = __selectQtVersionDesktop__(checks, available) __selectQtVersionDesktop__(checks, available)
expectedFiles = [] expectedFiles = []
if checks: if checks:
@@ -273,7 +274,6 @@ def createProject_Qt_Console(path, projectName, checks = True, buildSystem = Non
progressBarWait(10000) progressBarWait(10000)
if checks: if checks:
__verifyFileCreation__(path, expectedFiles) __verifyFileCreation__(path, expectedFiles)
return checkedTargets
def createNewQtQuickApplication(workingDir, projectName = None, def createNewQtQuickApplication(workingDir, projectName = None,
targets=Targets.desktopTargetClasses(), minimumQtVersion="5.6", targets=Targets.desktopTargetClasses(), minimumQtVersion="5.6",
@@ -320,7 +320,7 @@ def createNewQmlExtension(workingDir, targets=[Targets.DESKTOP_5_6_1_DEFAULT]):
if workingDir == None: if workingDir == None:
workingDir = tempDir() workingDir = tempDir()
__createProjectSetNameAndPath__(workingDir) __createProjectSetNameAndPath__(workingDir)
checkedTargets = __chooseTargets__(targets, available) __chooseTargets__(targets, available)
nextButton = waitForObject(":Next_QPushButton") nextButton = waitForObject(":Next_QPushButton")
clickButton(nextButton) clickButton(nextButton)
nameLineEd = waitForObject("{buddy={type='QLabel' text='Object class-name:' unnamed='1' visible='1'} " nameLineEd = waitForObject("{buddy={type='QLabel' text='Object class-name:' unnamed='1' visible='1'} "
@@ -331,18 +331,17 @@ def createNewQmlExtension(workingDir, targets=[Targets.DESKTOP_5_6_1_DEFAULT]):
replaceEditorContent(uriLineEd, "org.qt-project.test.qmlcomponents") replaceEditorContent(uriLineEd, "org.qt-project.test.qmlcomponents")
clickButton(nextButton) clickButton(nextButton)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return checkedTargets
def createEmptyQtProject(workingDir=None, projectName=None, targets=Targets.desktopTargetClasses()): def createEmptyQtProject(workingDir=None, projectName=None, targets=Targets.desktopTargetClasses()):
__createProjectOrFileSelectType__(" Other Project", "Empty qmake Project") __createProjectOrFileSelectType__(" Other Project", "Empty qmake Project")
if workingDir == None: if workingDir == None:
workingDir = tempDir() workingDir = tempDir()
projectName = __createProjectSetNameAndPath__(workingDir, projectName) projectName = __createProjectSetNameAndPath__(workingDir, projectName)
checkedTargets = __chooseTargets__(targets) __chooseTargets__(targets)
snooze(1) snooze(1)
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return projectName, checkedTargets return projectName
def createNewNonQtProject(workingDir=None, projectName=None, target=[Targets.DESKTOP_4_8_7_DEFAULT], def createNewNonQtProject(workingDir=None, projectName=None, target=[Targets.DESKTOP_4_8_7_DEFAULT],
plainC=False, cmake=False, qbs=False): plainC=False, cmake=False, qbs=False):
@@ -382,13 +381,13 @@ def createNewCPPLib(projectDir = None, projectName = None, className = None, fro
if projectDir == None: if projectDir == None:
projectDir = tempDir() projectDir = tempDir()
projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, libType) projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, libType)
checkedTargets = __chooseTargets__(target, available) __chooseTargets__(target, available)
snooze(1) snooze(1)
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
__createProjectHandleModuleSelection__(modules) __createProjectHandleModuleSelection__(modules)
className = __createProjectHandleClassInformation__(className) className = __createProjectHandleClassInformation__(className)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return checkedTargets, projectName, className return projectName, className
def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWelcome=False, def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWelcome=False,
target=[Targets.DESKTOP_4_8_7_DEFAULT], baseClass="QGenericPlugin"): target=[Targets.DESKTOP_4_8_7_DEFAULT], baseClass="QGenericPlugin"):
@@ -396,12 +395,12 @@ def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWel
if projectDir == None: if projectDir == None:
projectDir = tempDir() projectDir = tempDir()
projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, LibType.QT_PLUGIN) projectName = __createProjectSetNameAndPath__(projectDir, projectName, False, LibType.QT_PLUGIN)
checkedTargets = __chooseTargets__(target, available) __chooseTargets__(target, available)
snooze(1) snooze(1)
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
className = __createProjectHandleClassInformation__(className, baseClass) className = __createProjectHandleClassInformation__(className, baseClass)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return checkedTargets, projectName, className return projectName, className
# parameter target can be a list of Targets # parameter target can be a list of Targets
# parameter availableTargets should be the result of __createProjectOrFileSelectType__() # parameter availableTargets should be the result of __createProjectOrFileSelectType__()
@@ -541,7 +540,7 @@ def __getSupportedPlatforms__(text, templateName, getAsStrings=False):
supports = text[text.find('Supported Platforms'):].split(":")[1].strip().split(" ") supports = text[text.find('Supported Platforms'):].split(":")[1].strip().split(" ")
result = [] result = []
if 'Desktop' in supports: if 'Desktop' in supports:
if (version == None or version < "5.0") and templateName != "Qt Widgets Application": if (version == None or version < "5.0"):
result.append(Targets.DESKTOP_4_8_7_DEFAULT) result.append(Targets.DESKTOP_4_8_7_DEFAULT)
if platform.system() in ("Linux", "Darwin"): if platform.system() in ("Linux", "Darwin"):
result.append(Targets.EMBEDDED_LINUX) result.append(Targets.EMBEDDED_LINUX)

View File

@@ -48,126 +48,67 @@ def switchViewTo(view):
mouseClick(waitForObject("{type='Core::Internal::FancyTabBar' unnamed='1' visible='1' " mouseClick(waitForObject("{type='Core::Internal::FancyTabBar' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"), 20, 20 + 52 * view, 0, Qt.LeftButton) "window=':Qt Creator_Core::Internal::MainWindow'}"), 20, 20 + 52 * view, 0, Qt.LeftButton)
# this function is used to make sure that simple building prerequisites are met def __kitIsActivated__(kit):
# param targetCount specifies how many build targets had been selected (it's important that this one is correct)
# param currentTarget specifies which target should be selected for the next build (zero based index)
# param setReleaseBuild defines whether the current target(s) will be set to a Release or a Debug build
# param disableShadowBuild defines whether to disable shadow build or leave it unchanged (no matter what is defined)
# param setForAll defines whether to set Release or Debug and ShadowBuild option for all targets or only for the currentTarget
def prepareBuildSettings(targetCount, currentTarget, setReleaseBuild=True, disableShadowBuild=True, setForAll=True):
switchViewTo(ViewConstants.PROJECTS)
success = True
for current in range(targetCount):
if setForAll or current == currentTarget:
switchToBuildOrRunSettingsFor(targetCount, current, ProjectSettings.BUILD)
# TODO: Improve selection of Release/Debug version
if setReleaseBuild:
chooseThis = "Release"
else:
chooseThis = "Debug"
editBuildCfg = waitForObject("{leftWidget={text='Edit build configuration:' type='QLabel' "
"unnamed='1' visible='1'} unnamed='1' type='QComboBox' visible='1'}")
selectFromCombo(editBuildCfg, chooseThis)
ensureChecked("{name='shadowBuildCheckBox' type='QCheckBox' visible='1'}", not disableShadowBuild)
# get back to the current target
if currentTarget < 0 or currentTarget >= targetCount:
test.warning("Parameter currentTarget is out of range - will be ignored this time!")
else:
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
switchViewTo(ViewConstants.EDIT)
return success
# this function switches to the build or the run settings (inside the Projects view)
# if you haven't already switched to the Projects view this will fail and return False
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
# param targetCount specifies the number of targets currently defined (must be correct!)
# param projectSettings specifies where to switch to (must be one of ProjectSettings.BUILD or ProjectSettings.RUN)
def switchToBuildOrRunSettingsFor(targetCount, currentTarget, projectSettings):
def kitIsActivated(kit):
return not (str(kit.toolTip).startswith("<h3>Click to activate:</h3>") return not (str(kit.toolTip).startswith("<h3>Click to activate:</h3>")
or str(kit.toolTip).startswith("<h3>Kit is unsuited for project</h3>")) or str(kit.toolTip).startswith("<h3>Kit is unsuited for project</h3>"))
try: # returns a list of the IDs (see class Targets) of all kits
# which are currently configured for the active project
# Creator must be in projects mode when calling
def iterateConfiguredKits():
treeView = waitForObject(":Projects.ProjectNavigationTreeView") treeView = waitForObject(":Projects.ProjectNavigationTreeView")
except LookupError:
return False
bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView") bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView")
kitIndices = dumpIndices(treeView.model(), waitForObject(bAndRIndex))
configuredKitNames = map(lambda t: str(t.data(0)),
filter(__kitIsActivated__, kitIndices))
return map(Targets.getIdForTargetName, configuredKitNames)
targetIndices = dumpIndices(treeView.model(), waitForObject(bAndRIndex))
targets = map(lambda t: str(t.data(0)), # This function switches to the build or the run settings (inside the Projects view).
filter(kitIsActivated, targetIndices)) # If you haven't already switched to the Projects view this will raise a LookupError.
if not test.compare(targetCount, len(targets), "Check whether all chosen targets are listed."): # It will return a boolean value indicating whether the selected Kit was changed by the function.
return False # Note that a 'False' return does not indicate any error.
# we assume the targets are still ordered the same way # param wantedKit specifies the ID of the kit (see class Targets)
currentTargetIndex = getQModelIndexStr("text='%s'" % targets[currentTarget], bAndRIndex) # for which to switch into the specified settings
if not test.verify(kitIsActivated(findObject(currentTargetIndex)), # param projectSettings specifies where to switch to (must be one of
"Verifying target '%s' is enabled." % targets[currentTarget]): # ProjectSettings.BUILD or ProjectSettings.RUN)
return False def switchToBuildOrRunSettingsFor(wantedKit, projectSettings):
index = waitForObject(currentTargetIndex) treeView = waitForObject(":Projects.ProjectNavigationTreeView")
bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView")
wantedKitName = Targets.getStringForTarget(wantedKit)
wantedKitIndexString = getQModelIndexStr("text='%s'" % wantedKitName, bAndRIndex)
if not test.verify(__kitIsActivated__(findObject(wantedKitIndexString)),
"Verifying target '%s' is enabled." % wantedKitName):
raise Exception("Kit '%s' is not activated in the project." % wantedKitName)
index = waitForObject(wantedKitIndexString)
projectAlreadySelected = index.font.bold
if projectAlreadySelected:
test.log("Kit '%s' is already selected." % wantedKitName)
else:
test.log("Selecting kit '%s'..." % wantedKitName)
treeView.scrollTo(index) treeView.scrollTo(index)
mouseClick(index) mouseClick(index)
if projectSettings == ProjectSettings.BUILD: if projectSettings == ProjectSettings.BUILD:
settingsIndex = getQModelIndexStr("text='Build'", currentTargetIndex) settingsIndex = getQModelIndexStr("text='Build'", wantedKitIndexString)
elif projectSettings == ProjectSettings.RUN: elif projectSettings == ProjectSettings.RUN:
settingsIndex = getQModelIndexStr("text='Run'", currentTargetIndex) settingsIndex = getQModelIndexStr("text='Run'", wantedKitIndexString)
else: else:
test.fatal("Don't know what you're trying to switch to") raise Exception("Unexpected projectSettings parameter (%s), needs to be BUILD or RUN."
return False % str(projectSettings))
mouseClick(waitForObject(settingsIndex)) mouseClick(waitForObject(settingsIndex))
return True return not projectAlreadySelected
# this function switches "Run in terminal" on or off in a project's run settings # this function switches "Run in terminal" on or off in a project's run settings
# param targetCount specifies the number of targets currently defined (must be correct!) # param wantedKit specifies the ID of the kit to edit (see class Targets)
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
# param runInTerminal specifies if "Run in terminal should be turned on (True) or off (False) # param runInTerminal specifies if "Run in terminal should be turned on (True) or off (False)
def setRunInTerminal(targetCount, currentTarget, runInTerminal=True): def setRunInTerminal(wantedKit, runInTerminal=True):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.RUN) switchToBuildOrRunSettingsFor(wantedKit, ProjectSettings.RUN)
ensureChecked("{window=':Qt Creator_Core::Internal::MainWindow' text='Run in terminal'\ ensureChecked("{window=':Qt Creator_Core::Internal::MainWindow' text='Run in terminal'\
type='QCheckBox' unnamed='1' visible='1'}", runInTerminal) type='QCheckBox' unnamed='1' visible='1'}", runInTerminal)
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
# helper function to get some Qt information for the current (already configured) project
# param kitCount is the number of kits cofigured for the current project
# param alreadyOnProjectsBuildSettings if set to True you have to make sure that you're
# on the Projects view on the Build settings page (otherwise this function will end
# up in a ScriptError)
# param afterSwitchTo if you want to leave the Projects view/Build settings when returning
# from this function you can set this parameter to one of the ViewConstants
# this function returns an array of 4 elements (all could be None):
# * the first element holds the Qt version
# * the second element holds the mkspec
# * the third element holds the Qt bin path
# * the fourth element holds the Qt lib path
# of the current active project
def getQtInformationForBuildSettings(kitCount, alreadyOnProjectsBuildSettings=False, afterSwitchTo=None):
if not alreadyOnProjectsBuildSettings:
switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.BUILD)
clickButton(waitForObject(":Qt Creator_SystemSettings.Details_Utils::DetailsButton"))
model = waitForObject(":scrollArea.environment_QTreeView").model()
qtDir = None
for row in range(model.rowCount()):
index = model.index(row, 0)
text = str(model.data(index).toString())
if text == "QTDIR":
qtDir = str(model.data(model.index(row, 1)).toString())
break
if qtDir == None:
test.fatal("UI seems to have changed - couldn't get QTDIR for this configuration.")
return None, None, None, None
qmakeCallLabel = waitForObject("{text?='<b>qmake:</b> qmake*' type='QLabel' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}")
qtVersion = getQtInformationByQMakeCall(qtDir)
if afterSwitchTo:
if ViewConstants.FIRST_AVAILABLE <= afterSwitchTo <= ViewConstants.LAST_AVAILABLE:
switchViewTo(afterSwitchTo)
else:
test.warning("Don't know where you trying to switch to (%s)" % afterSwitchTo)
return qtVersion
def __getTargetFromToolTip__(toolTip): def __getTargetFromToolTip__(toolTip):
if toolTip == None or not isinstance(toolTip, (str, unicode)): if toolTip == None or not isinstance(toolTip, (str, unicode)):
test.warning("Parameter toolTip must be of type str or unicode and can't be None!") test.warning("Parameter toolTip must be of type str or unicode and can't be None!")
@@ -192,19 +133,6 @@ def getExecutableAndTargetFromToolTip(toolTip):
return None, target return None, target
return exe.group(1).strip(), target return exe.group(1).strip(), target
# this function queries the version number from qmake
# param qtDir set this to a path that holds a valid Qt
# the function will return the wanted information or None if something went wrong
def getQtInformationByQMakeCall(qtDir):
qmake = os.path.join(qtDir, "bin", "qmake")
if platform.system() in ('Microsoft', 'Windows'):
qmake += ".exe"
if not os.path.exists(qmake):
test.fatal("Given Qt directory does not exist or does not contain bin/qmake.",
"Constructed path: '%s'" % qmake)
return None
return getOutputFromCmdline([qmake, "-query", "QT_VERSION"]).strip()
def invokeContextMenuOnProject(projectName, menuItem): def invokeContextMenuOnProject(projectName, menuItem):
try: try:
projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", projectName, 3000) projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", projectName, 3000)
@@ -230,7 +158,7 @@ def addAndActivateKit(kit):
kitString = Targets.getStringForTarget(kit) kitString = Targets.getStringForTarget(kit)
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
try: try:
treeView = waitForObject(":Projects.ProjectNavigationTreeView") waitForObject(":Projects.ProjectNavigationTreeView")
wanted = getQModelIndexStr("text='%s'" % kitString, bAndRIndex) wanted = getQModelIndexStr("text='%s'" % kitString, bAndRIndex)
index = findObject(wanted) index = findObject(wanted)
if str(index.toolTip).startswith(clickToActivate): if str(index.toolTip).startswith(clickToActivate):

View File

@@ -458,7 +458,7 @@ def iterateQtVersions(keepOptionsOpen=False, alreadyOnOptionsDialog=False,
currResult = additionalFunction(target, version, *argsForAdditionalFunc) currResult = additionalFunction(target, version, *argsForAdditionalFunc)
except: except:
import sys import sys
t,v,tb = sys.exc_info() t,v,_ = sys.exc_info()
currResult = None currResult = None
test.fatal("Function to additionally execute on Options Dialog could not be found or " test.fatal("Function to additionally execute on Options Dialog could not be found or "
"an exception occurred while executing it.", "%s(%s)" % (str(t), str(v))) "an exception occurred while executing it.", "%s(%s)" % (str(t), str(v)))
@@ -521,7 +521,7 @@ def iterateKits(keepOptionsOpen=False, alreadyOnOptionsDialog=False,
currResult = additionalFunction(item, kitName, *argsForAdditionalFunc) currResult = additionalFunction(item, kitName, *argsForAdditionalFunc)
except: except:
import sys import sys
t,v,tb = sys.exc_info() t,v,_ = sys.exc_info()
currResult = None currResult = None
test.fatal("Function to additionally execute on Options Dialog could not be " test.fatal("Function to additionally execute on Options Dialog could not be "
"found or an exception occurred while executing it.", "%s(%s)" % "found or an exception occurred while executing it.", "%s(%s)" %
@@ -605,10 +605,8 @@ def progressBarWait(timeout=60000, warn=True):
checkIfObjectExists(":Qt Creator_Core::Internal::ProgressBar", False, timeout) checkIfObjectExists(":Qt Creator_Core::Internal::ProgressBar", False, timeout)
def readFile(filename): def readFile(filename):
f = open(filename, "r") with open(filename, "r") as f:
content = f.read() return f.read()
f.close()
return content
def simpleFileName(navigatorFileName): def simpleFileName(navigatorFileName):
# try to find the last part of the given name, assume it's inside a (folder) structure # try to find the last part of the given name, assume it's inside a (folder) structure

View File

@@ -32,8 +32,8 @@ def main():
startCreator(False) startCreator(False)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
checkedTargets = createProject_Qt_GUI(tempDir(), "SampleApp") createProject_Qt_GUI(tempDir(), "SampleApp")
# run project for debug and release and verify results # run project for debug and release and verify results
runVerify(checkedTargets) runVerify()
#close Qt Creator #close Qt Creator
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")

View File

@@ -30,8 +30,8 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp") createNewQtQuickApplication(tempDir(), "SampleApp")
# run project for debug and release and verify results # run project for debug and release and verify results
runVerify(checkedTargets) runVerify()
#close Qt Creator #close Qt Creator
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")

View File

@@ -56,11 +56,11 @@ def handleInsertVirtualFunctions(expected):
clickButton("{text='OK' type='QPushButton' unnamed='1' visible='1'}") clickButton("{text='OK' type='QPushButton' unnamed='1' visible='1'}")
def checkSimpleCppLib(projectName, static): def checkSimpleCppLib(projectName, static):
checkedTargets, projectName, className = createNewCPPLib(tempDir(), projectName, "MyClass", projectName, className = createNewCPPLib(tempDir(), projectName, "MyClass",
target=Targets.desktopTargetClasses(), target=Targets.desktopTargetClasses(),
isStatic=static) isStatic=static)
for kit, config in iterateBuildConfigs(len(checkedTargets), "Release"): for kit, config in iterateBuildConfigs("Release"):
verifyBuildConfig(len(checkedTargets), kit, config, False, True) verifyBuildConfig(kit, config, False, True)
invokeMenuItem('Build', 'Build Project "%s"' % projectName) invokeMenuItem('Build', 'Build Project "%s"' % projectName)
waitForCompile(10000) waitForCompile(10000)
checkCompile() checkCompile()
@@ -81,12 +81,12 @@ def main():
# Qt Plugin needs Qt4.8 for QGenericPlugin which is tested by default # Qt Plugin needs Qt4.8 for QGenericPlugin which is tested by default
targets = Targets.desktopTargetClasses() targets = Targets.desktopTargetClasses()
checkedTargets, projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin", projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin",
target=targets) target=targets)
virtualFunctionsAdded = False virtualFunctionsAdded = False
for kit, config in iterateBuildConfigs(len(checkedTargets), "Debug"): for kit, config in iterateBuildConfigs("Debug"):
is487Kit = checkedTargets[kit] in (Targets.DESKTOP_4_8_7_DEFAULT, Targets.EMBEDDED_LINUX) is487Kit = kit in (Targets.DESKTOP_4_8_7_DEFAULT, Targets.EMBEDDED_LINUX)
verifyBuildConfig(len(checkedTargets), kit, config, True, True) verifyBuildConfig(kit, config, True, True)
if virtualFunctionsAdded and platform.system() in ('Microsoft', 'Windows') and is487Kit: if virtualFunctionsAdded and platform.system() in ('Microsoft', 'Windows') and is487Kit:
test.warning("Skipping building of Qt4.8 targets because of QTCREATORBUG-12251.") test.warning("Skipping building of Qt4.8 targets because of QTCREATORBUG-12251.")
continue continue
@@ -98,7 +98,7 @@ def main():
test.fail("Could not open %s.h - continuing." % className.lower()) test.fail("Could not open %s.h - continuing." % className.lower())
continue continue
editor = getEditorForFileSuffix("%s.h" % className.lower()) editor = getEditorForFileSuffix("%s.h" % className.lower())
oldContent = str(editor.plainText) str(editor.plainText)
placeCursorToLine(editor, "class %s.*" % className, True) placeCursorToLine(editor, "class %s.*" % className, True)
snooze(4) # avoid timing issue with the parser snooze(4) # avoid timing issue with the parser
invokeContextMenuItem(editor, "Refactor", "Insert Virtual Functions of Base Classes") invokeContextMenuItem(editor, "Refactor", "Insert Virtual Functions of Base Classes")

View File

@@ -42,13 +42,13 @@ def main():
# open example project, supports only Qt 5 # open example project, supports only Qt 5
targets = Targets.desktopTargetClasses() targets = Targets.desktopTargetClasses()
targets.remove(Targets.DESKTOP_4_8_7_DEFAULT) targets.remove(Targets.DESKTOP_4_8_7_DEFAULT)
checkedTargets = openQmakeProject(examplePath, targets) openQmakeProject(examplePath, targets)
# build and wait until finished - on all build configurations # build and wait until finished - on all build configurations
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs()
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.") test.fatal("Haven't found a suitable Qt version - leaving without building.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(kit, config)
# try to build project # try to build project
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)
invokeMenuItem("Build", "Build All") invokeMenuItem("Build", "Build All")

View File

@@ -70,7 +70,7 @@ def main():
openDocument("openglwindow.Sources.main\\.cpp") openDocument("openglwindow.Sources.main\\.cpp")
if not placeCursorToLine(editorWidget, 'm_posAttr = m_program->attributeLocation("posAttr");'): if not placeCursorToLine(editorWidget, 'm_posAttr = m_program->attributeLocation("posAttr");'):
return return
for i in range(13): for _ in range(13):
type(editorWidget, "<Left>") type(editorWidget, "<Left>")
type(editorWidget, "<Ctrl+Shift+u>") type(editorWidget, "<Ctrl+Shift+u>")
# wait until search finished and verify search results # wait until search finished and verify search results

View File

@@ -76,7 +76,7 @@ def main():
# select some other word in .cpp file and select "Edit" -> "Find/Replace". # select some other word in .cpp file and select "Edit" -> "Find/Replace".
clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton")) clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
placeCursorToLine(editorWidget, "void Trianglefind::render()") placeCursorToLine(editorWidget, "void Trianglefind::render()")
for i in range(10): for _ in range(10):
type(editorWidget, "<Left>") type(editorWidget, "<Left>")
markText(editorWidget, "Left", 12) markText(editorWidget, "Left", 12)
invokeMenuItem("Edit", "Find/Replace", "Find/Replace") invokeMenuItem("Edit", "Find/Replace", "Find/Replace")

View File

@@ -107,7 +107,7 @@ def main():
checkIfObjectExists(manualQModelIndex, verboseOnFail = True), checkIfObjectExists(manualQModelIndex, verboseOnFail = True),
"Verifying if all folders and bookmarks are present") "Verifying if all folders and bookmarks are present")
mouseClick(waitForObject(":Qt Creator_Bookmarks_TreeView"), 5, 5, 0, Qt.LeftButton) mouseClick(waitForObject(":Qt Creator_Bookmarks_TreeView"), 5, 5, 0, Qt.LeftButton)
for i in range(6): for _ in range(6):
type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Right>") type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Right>")
type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Return>") type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Return>")
test.verify(textForQtVersion("Building and Running an Example") in getHelpTitle(), test.verify(textForQtVersion("Building and Running an Example") in getHelpTitle(),

View File

@@ -48,7 +48,7 @@ def main():
"Verifying if error is properly reported") "Verifying if error is properly reported")
# repair error - go to written line # repair error - go to written line
placeCursorToLine(editorArea, testingCodeLine) placeCursorToLine(editorArea, testingCodeLine)
for i in range(14): for _ in range(14):
type(editorArea, "<Left>") type(editorArea, "<Left>")
markText(editorArea, "Right") markText(editorArea, "Right")
type(editorArea, "c") type(editorArea, "c")

View File

@@ -90,7 +90,7 @@ def main():
if not placeCursorToLine(editorArea, "Rectangle {"): if not placeCursorToLine(editorArea, "Rectangle {"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
for i in range(5): for _ in range(5):
type(editorArea, "<Left>") type(editorArea, "<Left>")
invokeContextMenuItem(editorArea, "Find Usages") invokeContextMenuItem(editorArea, "Find Usages")
# check if usage was properly found # check if usage was properly found
@@ -109,7 +109,7 @@ def main():
if not placeCursorToLine(editorArea, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"): if not placeCursorToLine(editorArea, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
for i in range(87): for _ in range(87):
type(editorArea, "<Left>") type(editorArea, "<Left>")
invokeMenuItem("Tools", "QML/JS", "Find Usages") invokeMenuItem("Tools", "QML/JS", "Find Usages")
# check if usage was properly found # check if usage was properly found
@@ -128,7 +128,7 @@ def main():
if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"): if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
for i in range(5): for _ in range(5):
type(editorArea, "<Left>") type(editorArea, "<Left>")
type(editorArea, "<Ctrl+Shift+u>") type(editorArea, "<Ctrl+Shift+u>")
# check if usage was properly found # check if usage was properly found

View File

@@ -37,7 +37,7 @@ def main():
saveAndExit() saveAndExit()
return return
placeCursorToLine(editorArea, "TextEdit {") placeCursorToLine(editorArea, "TextEdit {")
for i in range(5): for _ in range(5):
type(editorArea, "<Left>") type(editorArea, "<Left>")
# invoke Refactoring - Move Component into separate file # invoke Refactoring - Move Component into separate file
invokeContextMenuItem(editorArea, "Refactoring", "Move Component into Separate File") invokeContextMenuItem(editorArea, "Refactoring", "Move Component into Separate File")

View File

@@ -32,13 +32,13 @@ def main():
homeKey = "<Home>" homeKey = "<Home>"
if platform.system() == "Darwin": if platform.system() == "Darwin":
homeKey = "<Ctrl+Left>" homeKey = "<Ctrl+Left>"
for i in range(2): for _ in range(2):
type(editorArea, homeKey) type(editorArea, homeKey)
type(editorArea, "<Return>") type(editorArea, "<Return>")
type(editorArea, "<Up>") type(editorArea, "<Up>")
type(editorArea, "<Tab>") type(editorArea, "<Tab>")
type(editorArea, "Item { x: 10; y: 20; width: 10 }") type(editorArea, "Item { x: 10; y: 20; width: 10 }")
for i in range(30): for _ in range(30):
type(editorArea, "<Left>") type(editorArea, "<Left>")
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
# activate menu and apply 'Refactoring - Split initializer' # activate menu and apply 'Refactoring - Split initializer'

View File

@@ -32,14 +32,14 @@ def main():
homeKey = "<Home>" homeKey = "<Home>"
if platform.system() == "Darwin": if platform.system() == "Darwin":
homeKey = "<Ctrl+Left>" homeKey = "<Ctrl+Left>"
for i in range(2): for _ in range(2):
type(editorArea, homeKey) type(editorArea, homeKey)
type(editorArea, "<Return>") type(editorArea, "<Return>")
type(editorArea, "<Up>") type(editorArea, "<Up>")
type(editorArea, "<Tab>") type(editorArea, "<Tab>")
testingItemText = "Item { x: 10; y: 20; width: 10 }" testingItemText = "Item { x: 10; y: 20; width: 10 }"
type(editorArea, testingItemText) type(editorArea, testingItemText)
for i in range(30): for _ in range(30):
type(editorArea, "<Left>") type(editorArea, "<Left>")
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
# invoke Refactoring - Wrap Component in Loader # invoke Refactoring - Wrap Component in Loader

View File

@@ -31,7 +31,7 @@ def main():
return return
type(editorArea, "<Return>") type(editorArea, "<Return>")
type(editorArea, "Color") type(editorArea, "Color")
for i in range(3): for _ in range(3):
type(editorArea, "<Left>") type(editorArea, "<Left>")
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
# invoke Refactoring - Add a message suppression comment. # invoke Refactoring - Add a message suppression comment.

View File

@@ -71,7 +71,7 @@ def main():
return return
# cancel indentation # cancel indentation
type(editorArea, "<Ctrl+a>") type(editorArea, "<Ctrl+a>")
for i in range(5): for _ in range(5):
type(editorArea, "<Shift+Backtab>") type(editorArea, "<Shift+Backtab>")
# select unindented block # select unindented block
type(editorArea, "<Ctrl+a>") type(editorArea, "<Ctrl+a>")

View File

@@ -31,13 +31,13 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# create qt quick application # create qt quick application
checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp") createNewQtQuickApplication(tempDir(), "SampleApp")
# build it - on all build configurations # build it - on all build configurations
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs()
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.") test.fatal("Haven't found a suitable Qt version - leaving without building.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(kit, config)
# try to compile # try to compile
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton")) clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))

View File

@@ -39,7 +39,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# create qt quick application # create qt quick application
checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp") createNewQtQuickApplication(tempDir(), "SampleApp")
# create syntax error in cpp file # create syntax error in cpp file
openDocument("SampleApp.Sources.main\\.cpp") openDocument("SampleApp.Sources.main\\.cpp")
if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "QQmlApplicationEngine engine;", "SyntaxError"): if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "QQmlApplicationEngine engine;", "SyntaxError"):
@@ -48,11 +48,11 @@ def main():
# save all # save all
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
# build it - on all build configurations # build it - on all build configurations
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs()
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.") test.fatal("Haven't found a suitable Qt version - leaving without building.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(kit, config)
# try to compile # try to compile
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton")) clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))

View File

@@ -31,12 +31,12 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
checkedTargets = createProject_Qt_Console(tempDir(), project) createProject_Qt_Console(tempDir(), project)
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs()
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.") test.fatal("Haven't found a suitable Qt version - leaving without building.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(kit, config)
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)
if runAndCloseApp() == None: if runAndCloseApp() == None:
checkCompile() checkCompile()

View File

@@ -34,7 +34,7 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
checkedTargets = createProject_Qt_Console(tempDir(), project) createProject_Qt_Console(tempDir(), project)
mainEditor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") mainEditor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
replaceEditorContent(mainEditor, "") replaceEditorContent(mainEditor, "")
@@ -52,15 +52,15 @@ def main():
test.verify("CONFIG += c++11 console" in str(proEditor.plainText), test.verify("CONFIG += c++11 console" in str(proEditor.plainText),
"Verifying that program is configured with console") "Verifying that program is configured with console")
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs()
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.") test.fatal("Haven't found a suitable Qt version - leaving without building.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(kit, config)
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)
test.log("Running application") test.log("Running application")
setRunInTerminal(len(checkedTargets), kit, False) setRunInTerminal(kit, False)
clickButton(waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton")) clickButton(waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton"))
outputButton = waitForObject(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") outputButton = waitForObject(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
waitFor("outputButton.checked", 20000) # Not ensureChecked(), avoid race condition waitFor("outputButton.checked", 20000) # Not ensureChecked(), avoid race condition
@@ -71,7 +71,7 @@ def main():
appOutput = str(waitForObject(":Qt Creator_Core::OutputWindow").plainText) appOutput = str(waitForObject(":Qt Creator_Core::OutputWindow").plainText)
verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output") verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output")
verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output") verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output")
if (checkedTargets[kit] == Targets.DESKTOP_5_4_1_GCC if (kit == Targets.DESKTOP_5_4_1_GCC
and platform.system() in ('Windows', 'Microsoft')): and platform.system() in ('Windows', 'Microsoft')):
test.log("Skipping qDebug() from %s (unstable, QTCREATORBUG-15067)" test.log("Skipping qDebug() from %s (unstable, QTCREATORBUG-15067)"
% Targets.getStringForTarget(Targets.DESKTOP_5_4_1_GCC)) % Targets.getStringForTarget(Targets.DESKTOP_5_4_1_GCC))
@@ -84,7 +84,7 @@ def main():
"Did the application run at all?") "Did the application run at all?")
test.log("Debugging application") test.log("Debugging application")
isMsvc = isMsvcConfig(len(checkedTargets), kit) isMsvc = isMsvcConfig(kit)
invokeMenuItem("Debug", "Start Debugging", "Start Debugging") invokeMenuItem("Debug", "Start Debugging", "Start Debugging")
handleDebuggerWarnings(config, isMsvc) handleDebuggerWarnings(config, isMsvc)
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")

View File

@@ -50,12 +50,12 @@ def main():
# empty Qt # empty Qt
workingDir = tempDir() workingDir = tempDir()
projectName, checkedTargets = createEmptyQtProject(workingDir, "EmptyQtProj", targets) projectName = createEmptyQtProject(workingDir, "EmptyQtProj", targets)
addFileToProject(os.path.join(workingDir, projectName), " C++", "C++ Source File", "main.cpp") addFileToProject(os.path.join(workingDir, projectName), " C++", "C++ Source File", "main.cpp")
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
typeLines(editor, ["int main() {"]) typeLines(editor, ["int main() {"])
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
performDebugging(projectName, checkedTargets) performDebugging(projectName)
invokeMenuItem("File", "Close All Projects and Editors") invokeMenuItem("File", "Close All Projects and Editors")
# C/C++ # C/C++
for name,isC in {"C":True, "CPP":False}.items(): for name,isC in {"C":True, "CPP":False}.items():
@@ -74,8 +74,8 @@ def main():
typeLines(editor, ["int main() {"]) typeLines(editor, ["int main() {"])
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
progressBarWait(15000) progressBarWait(15000)
setRunInTerminal(1, 0, False) setRunInTerminal(singleTarget, False)
performDebugging(projectName, [singleTarget]) performDebugging(projectName)
invokeMenuItem("File", "Close All Projects and Editors") invokeMenuItem("File", "Close All Projects and Editors")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
@@ -89,14 +89,14 @@ def __handleAppOutputWaitForDebuggerFinish__():
invokeMenuItem("Debug", "Abort Debugging") invokeMenuItem("Debug", "Abort Debugging")
waitFor("str(appOutput.plainText).endswith('Debugging has finished')", 5000) waitFor("str(appOutput.plainText).endswith('Debugging has finished')", 5000)
def performDebugging(projectName, checkedTargets): def performDebugging(projectName):
for kit, config in iterateBuildConfigs(len(checkedTargets), "Debug"): for kit, config in iterateBuildConfigs("Debug"):
test.log("Selecting '%s' as build config" % config) test.log("Selecting '%s' as build config" % config)
verifyBuildConfig(len(checkedTargets), kit, config, True, True) verifyBuildConfig(kit, config, True, True)
waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton") waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton")
invokeMenuItem("Build", "Rebuild All") invokeMenuItem("Build", "Rebuild All")
waitForCompile() waitForCompile()
isMsvc = isMsvcConfig(len(checkedTargets), kit) isMsvc = isMsvcConfig(kit)
clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton")) clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton"))
handleDebuggerWarnings(config, isMsvc) handleDebuggerWarnings(config, isMsvc)
waitForObject(":Qt Creator.DebugModeWidget_QSplitter") waitForObject(":Qt Creator.DebugModeWidget_QSplitter")

View File

@@ -68,7 +68,6 @@ def debuggerHasStopped():
def getQmlJSConsoleOutput(): def getQmlJSConsoleOutput():
try: try:
result = []
consoleView = waitForObject(":DebugModeWidget_Debugger::Internal::ConsoleView") consoleView = waitForObject(":DebugModeWidget_Debugger::Internal::ConsoleView")
model = consoleView.model() model = consoleView.model()
# old input, output, new input > 2 # old input, output, new input > 2
@@ -129,13 +128,13 @@ def main():
if test.verify(waitFor('fancyDebugButton.enabled', 5000), "Start Debugging is enabled."): if test.verify(waitFor('fancyDebugButton.enabled', 5000), "Start Debugging is enabled."):
# make sure QML Debugging is enabled # make sure QML Debugging is enabled
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(1, 0, ProjectSettings.RUN) switchToBuildOrRunSettingsFor(Targets.getDefaultKit(), ProjectSettings.RUN)
ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' " ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' "
"type='QCheckBox' unnamed='1' visible='1'}") "type='QCheckBox' unnamed='1' visible='1'}")
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
# start debugging # start debugging
clickButton(fancyDebugButton) clickButton(fancyDebugButton)
locAndExprTV = waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView") waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView")
rootIndex = getQModelIndexStr("text='Rectangle'", rootIndex = getQModelIndexStr("text='Rectangle'",
":Locals and Expressions_Debugger::Internal::WatchTreeView") ":Locals and Expressions_Debugger::Internal::WatchTreeView")
# make sure the items inside the root item are visible # make sure the items inside the root item are visible

View File

@@ -56,7 +56,7 @@ def main():
earlyExit("Something went wrong opening Qml project - probably missing Qt5.") earlyExit("Something went wrong opening Qml project - probably missing Qt5.")
return return
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(1, 0, ProjectSettings.RUN) switchToBuildOrRunSettingsFor(Targets.getDefaultKit(), ProjectSettings.RUN)
ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' " ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' "
"type='QCheckBox' unnamed='1' visible='1'}") "type='QCheckBox' unnamed='1' visible='1'}")
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)

View File

@@ -31,9 +31,7 @@ def main():
return return
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
# we need a Qt >= 5.3 - we use checkedTargets, so we should get only valid targets projectName = createNewQtQuickApplication(workingDir)[1]
analyzerTargets = Targets.desktopTargetClasses()
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=analyzerTargets)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if placeCursorToLine(editor, "}"): if placeCursorToLine(editor, "}"):
type(editor, '<Left>') type(editor, '<Left>')
@@ -52,14 +50,14 @@ def main():
'var j = i * i;', 'var j = i * i;',
'console.log(j);']) 'console.log(j);'])
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug") availableConfigs = iterateBuildConfigs("Debug")
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (need Qt 5.3+) - leaving without debugging.") test.fatal("Haven't found a suitable Qt version (need Qt 5.3+) - leaving without debugging.")
else: else:
performTest(workingDir, projectName, len(checkedTargets), availableConfigs) performTest(workingDir, projectName, availableConfigs)
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
def performTest(workingDir, projectName, targetCount, availableConfigs): def performTest(workingDir, projectName, availableConfigs):
def __elapsedTime__(elapsedTimeLabelText): def __elapsedTime__(elapsedTimeLabelText):
return float(re.search("Elapsed:\s+(-?\d+\.\d+) s", elapsedTimeLabelText).group(1)) return float(re.search("Elapsed:\s+(-?\d+\.\d+) s", elapsedTimeLabelText).group(1))
@@ -67,7 +65,8 @@ def performTest(workingDir, projectName, targetCount, availableConfigs):
# switching from MSVC to MinGW build will fail on the clean step of 'Rebuild All' because # switching from MSVC to MinGW build will fail on the clean step of 'Rebuild All' because
# of differences between MSVC's and MinGW's Makefile (so clean before switching kits) # of differences between MSVC's and MinGW's Makefile (so clean before switching kits)
invokeMenuItem('Build', 'Clean Project "%s"' % projectName) invokeMenuItem('Build', 'Clean Project "%s"' % projectName)
qtVersion = verifyBuildConfig(targetCount, kit, config, True, True, True) verifyBuildConfig(kit, config, True, True, True)
qtVersion = "5.6.1" if kit == Targets.DESKTOP_5_6_1_DEFAULT else "5.10.1"
test.log("Selected kit using Qt %s" % qtVersion) test.log("Selected kit using Qt %s" % qtVersion)
# explicitly build before start debugging for adding the executable as allowed program to WinFW # explicitly build before start debugging for adding the executable as allowed program to WinFW
invokeMenuItem("Build", "Rebuild All") invokeMenuItem("Build", "Rebuild All")

View File

@@ -29,11 +29,9 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# Requires Qt 4.8
targets = Targets.desktopTargetClasses()
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets) projectName = createNewQtQuickApplication(workingDir)[1]
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if placeCursorToLine(editor, "}"): if placeCursorToLine(editor, "}"):
type(editor, '<Left>') type(editor, '<Left>')
@@ -54,13 +52,13 @@ def main():
if result: if result:
expectedBreakpointsOrder = [{os.path.join(workingDir, projectName, "main.cpp"):10}, expectedBreakpointsOrder = [{os.path.join(workingDir, projectName, "main.cpp"):10},
{os.path.join(workingDir, projectName, "main.qml"):13}] {os.path.join(workingDir, projectName, "main.qml"):13}]
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug") availableConfigs = iterateBuildConfigs("Debug")
progressBarWait() progressBarWait()
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without debugging.") test.fatal("Haven't found a suitable Qt version - leaving without debugging.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
test.log("Selecting '%s' as build config" % config) test.log("Selecting '%s' as build config" % config)
verifyBuildConfig(len(checkedTargets), kit, config, True, True, True) verifyBuildConfig(kit, config, True, True, True)
# explicitly build before start debugging for adding the executable as allowed program to WinFW # explicitly build before start debugging for adding the executable as allowed program to WinFW
invokeMenuItem("Build", "Rebuild All") invokeMenuItem("Build", "Rebuild All")
waitForCompile(300000) waitForCompile(300000)
@@ -69,12 +67,12 @@ def main():
continue continue
if platform.system() in ('Microsoft' 'Windows'): if platform.system() in ('Microsoft' 'Windows'):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(len(checkedTargets), kit, ProjectSettings.BUILD) switchToBuildOrRunSettingsFor(kit, ProjectSettings.BUILD)
buildDir = os.path.join(str(waitForObject(":Qt Creator_Utils::BuildDirectoryLineEdit").text), buildDir = os.path.join(str(waitForObject(":Qt Creator_Utils::BuildDirectoryLineEdit").text),
"debug") "debug")
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
allowAppThroughWinFW(buildDir, projectName, None) allowAppThroughWinFW(buildDir, projectName, None)
if not doSimpleDebugging(len(checkedTargets), kit, config, if not doSimpleDebugging(kit, config,
len(expectedBreakpointsOrder), expectedBreakpointsOrder): len(expectedBreakpointsOrder), expectedBreakpointsOrder):
try: try:
stopB = findObject(':Qt Creator.Stop_QToolButton') stopB = findObject(':Qt Creator.Stop_QToolButton')

View File

@@ -44,7 +44,6 @@ def prepareQmlFile():
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
isDarwin = platform.system() == 'Darwin' isDarwin = platform.system() == 'Darwin'
for i in range(3): for i in range(3):
content = "%s" % editor.plainText
if not placeCursorToLine(editor, 'title: qsTr("Hello World")'): if not placeCursorToLine(editor, 'title: qsTr("Hello World")'):
test.fatal("Couldn't find line(s) I'm looking for - QML file seems to " test.fatal("Couldn't find line(s) I'm looking for - QML file seems to "
"have changed!\nLeaving test...") "have changed!\nLeaving test...")

View File

@@ -118,7 +118,7 @@ def testRenameMacroAfterSourceMoving():
return True return True
def performMacroRenaming(newMacroName): def performMacroRenaming(newMacroName):
for i in range(10): for _ in range(10):
type(cppEditorStr, "<Left>") type(cppEditorStr, "<Left>")
invokeContextMenuItem(waitForObject(cppEditorStr), "Refactor", invokeContextMenuItem(waitForObject(cppEditorStr), "Refactor",
"Rename Symbol Under Cursor") "Rename Symbol Under Cursor")

View File

@@ -24,7 +24,6 @@
############################################################################ ############################################################################
source("../../shared/qtcreator.py") source("../../shared/qtcreator.py")
import re
SpeedCrunchPath = "" SpeedCrunchPath = ""
@@ -42,16 +41,16 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
checkedTargets = openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_4_8_7_DEFAULT]) openQmakeProject(SpeedCrunchPath, [Targets.DESKTOP_4_8_7_DEFAULT])
progressBarWait(30000) progressBarWait(30000)
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton") fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Release") availableConfigs = iterateBuildConfigs("Release")
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.") test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(kit, config)
buildConfig = buildConfigFromFancyToolButton(fancyToolButton) buildConfig = buildConfigFromFancyToolButton(fancyToolButton)
if buildConfig != config: if buildConfig != config:
test.fatal("Build configuration %s is selected instead of %s" % (buildConfig, config)) test.fatal("Build configuration %s is selected instead of %s" % (buildConfig, config))

View File

@@ -45,7 +45,6 @@ def main():
projects = catModel.index(0, 0) projects = catModel.index(0, 0)
test.compare("Projects", str(projects.data())) test.compare("Projects", str(projects.data()))
comboBox = findObject(":New.comboBox_QComboBox") comboBox = findObject(":New.comboBox_QComboBox")
targets = zip(*kits.values())[0]
test.verify(comboBox.enabled, "Verifying whether combobox is enabled.") test.verify(comboBox.enabled, "Verifying whether combobox is enabled.")
test.compare(comboBox.currentText, "All Templates") test.compare(comboBox.currentText, "All Templates")
try: try:

View File

@@ -26,8 +26,6 @@
source("../../shared/qtcreator.py") source("../../shared/qtcreator.py")
import re import re
import tempfile
import __builtin__
currentSelectedTreeItem = None currentSelectedTreeItem = None
warningOrError = re.compile('<p><b>((Error|Warning).*?)</p>') warningOrError = re.compile('<p><b>((Error|Warning).*?)</p>')

View File

@@ -46,4 +46,9 @@ def main():
else: else:
test.warning("Parsing project timed out") test.warning("Parsing project timed out")
compareProjectTree(rootNodeTemplate % "Qt Creator", "projecttree_creator.tsv") compareProjectTree(rootNodeTemplate % "Qt Creator", "projecttree_creator.tsv")
buildIssuesTexts = map(lambda i: str(i[3]), getBuildIssues())
deprecationWarnings = filter(lambda s: "deprecated" in s, buildIssuesTexts)
if deprecationWarnings:
test.warning("Creator claims that the .qbs file uses deprecated features.",
"\n".join(set(deprecationWarnings)))
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")

View File

@@ -34,12 +34,11 @@ def main():
for qtVersion, controls in available: for qtVersion, controls in available:
targ = [Targets.DESKTOP_5_6_1_DEFAULT] targ = [Targets.DESKTOP_5_6_1_DEFAULT]
quick = "2.6"
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targ, checkedTargets = createNewQtQuickApplication(workingDir, targets=targ,
minimumQtVersion=qtVersion, minimumQtVersion=qtVersion,
withControls = controls) withControls = controls)[0]
if len(checkedTargets) == 0: if len(checkedTargets) == 0:
if controls and qtVersion < "5.7": if controls and qtVersion < "5.7":
test.xfail("Could not check wanted target.", "Quick Controls 2 wizard needs Qt5.7+") test.xfail("Could not check wanted target.", "Quick Controls 2 wizard needs Qt5.7+")

View File

@@ -25,10 +25,14 @@
source("../../shared/qtcreator.py") source("../../shared/qtcreator.py")
import random import random
from datetime import date
def __platformToBeRunToday__():
return (('Linux'), ('Darwin'), ('Microsoft', 'Windows'))[date.today().day % 3]
# Be careful with Pastebin.Com, there are only 10 pastes per 24h # Be careful with Pastebin.Com, there are only 10 pastes per 24h
# for all machines using the same IP-address like you. # for all machines using the same IP-address like you.
skipPastingToPastebinCom = True skipPastingToPastebinCom = platform.system() not in __platformToBeRunToday__()
NAME_KDE = "Paste.KDE.Org" NAME_KDE = "Paste.KDE.Org"
NAME_PBCA = "Pastebin.Ca" NAME_PBCA = "Pastebin.Ca"
@@ -43,6 +47,7 @@ def invalidPasteId(protocol):
return -1 return -1
def closeHTTPStatusAndPasterDialog(protocol, pasterDialog): def closeHTTPStatusAndPasterDialog(protocol, pasterDialog):
try:
mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol
mBox = waitForObject(mBoxStr, 1000) mBox = waitForObject(mBoxStr, 1000)
text = str(mBox.text) text = str(mBox.text)
@@ -52,6 +57,10 @@ def closeHTTPStatusAndPasterDialog(protocol, pasterDialog):
if 'Service Unavailable' in text: if 'Service Unavailable' in text:
test.warning(text) test.warning(text)
return True return True
except:
t,v = sys.exc_info()[:2]
test.warning("An exception occurred in closeHTTPStatusAndPasterDialog(): %s(%s)"
% (str(t), str(v)))
test.log("Closed dialog without expected error.", text) test.log("Closed dialog without expected error.", text)
return False return False
@@ -90,11 +99,9 @@ def pasteFile(sourceFile, protocol):
output = str(outputWindow.plainText).splitlines()[-1] output = str(outputWindow.plainText).splitlines()[-1]
except: except:
output = "" output = ""
try:
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'): if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
resetFiles()
raise Exception(serverProblems) raise Exception(serverProblems)
except:
pass
stdErrOut = aut.readStderr() stdErrOut = aut.readStderr()
match = re.search("^%s protocol error: (.*)$" % protocol, stdErrOut, re.MULTILINE) match = re.search("^%s protocol error: (.*)$" % protocol, stdErrOut, re.MULTILINE)
if match: if match:
@@ -123,11 +130,8 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting):
try: try:
pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model() pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model()
except: except:
try: closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog')
if closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog'):
return -1 return -1
except:
pass
waitFor("pasteModel.rowCount() > 1", 20000) waitFor("pasteModel.rowCount() > 1", 20000)
if (not skippedPasting and not protocol == NAME_PBCA if (not skippedPasting and not protocol == NAME_PBCA
and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))): and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))):
@@ -177,6 +181,7 @@ def main():
openGeneralMessages() openGeneralMessages()
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
for protocol in protocolsToTest: for protocol in protocolsToTest:
with TestSection(protocol):
skippedPasting = True skippedPasting = True
description = "Paste from 2017-05-11" description = "Paste from 2017-05-11"
if protocol == NAME_KDE: if protocol == NAME_KDE:
@@ -196,7 +201,15 @@ def main():
else: # if it was not our own exception re-raise else: # if it was not our own exception re-raise
raise e raise e
if not pasteId: if not pasteId:
test.fatal("Could not get id of paste to %s" % protocol) message = "Could not get id of paste to %s" % protocol
if protocol == NAME_PBCOM:
test.log("%s, using prepasted file instead" % message)
skippedPasting = True
pasteId = "8XHP0ZgH"
pastedText = readFile(os.path.join(os.getcwd(),
"testdata", "main-prepasted.cpp"))
else:
test.fatal(message)
continue continue
pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting) pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting)
if pasteId == -1: if pasteId == -1:

View File

@@ -92,7 +92,7 @@ def __clickCommit__(count):
test.fail("Could not find the %d. commit - leaving test" % count) test.fail("Could not find the %d. commit - leaving test" % count)
return False return False
placeCursorToLine(gitEditor, line) placeCursorToLine(gitEditor, line)
for i in range(30): for _ in range(30):
type(gitEditor, "<Left>") type(gitEditor, "<Left>")
# get the current cursor rectangle which should be positioned on the commit ID # get the current cursor rectangle which should be positioned on the commit ID
rect = gitEditor.cursorRect() rect = gitEditor.cursorRect()
@@ -234,7 +234,7 @@ def deleteProject():
if os.path.exists(path): if os.path.exists(path):
try: try:
# Make files in .git writable to remove them # Make files in .git writable to remove them
for root, dirs, files in os.walk(path): for root, _, files in os.walk(path):
for name in files: for name in files:
os.chmod(os.path.join(root, name), stat.S_IWUSR) os.chmod(os.path.join(root, name), stat.S_IWUSR)
shutil.rmtree(path) shutil.rmtree(path)