forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: qtcreator.pri qtcreator.qbs src/plugins/fakevim/fakevimhandler.cpp src/plugins/qtsupport/baseqtversion.cpp tests/auto/cplusplus/cxx11/cxx11.pro tests/auto/cplusplus/cxx11/tst_cxx11.cpp tests/auto/icheckbuild/icheckbuild.pro Change-Id: I3c8351ad35617f56d15b788c8a46d8a6f453ef70
This commit is contained in:
@@ -312,7 +312,8 @@
|
||||
\image qtcreator-cpp-class-wizard.png "Enter Class Name dialog"
|
||||
|
||||
The names of the header and source file are based on the class name. To
|
||||
change the default suffix of a file, click \gui Configure.
|
||||
change the default suffix of a file, select \gui Tools > \gui Options >
|
||||
\gui {C++} > \gui {File Naming}.
|
||||
|
||||
You can create your own project and class wizards. For more information,
|
||||
see \l{Adding New Custom Wizards}.
|
||||
|
@@ -72,8 +72,6 @@ defineTest(minQtVersion) {
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
|
||||
QTESTLIB = testlib
|
||||
|
||||
# For use in custom compilers which just copy files
|
||||
defineReplace(stripSrcDir) {
|
||||
return($$relative_path($$absolute_path($$1, $$OUT_PWD), $$_PRO_FILE_PWD_))
|
||||
@@ -81,8 +79,6 @@ defineReplace(stripSrcDir) {
|
||||
|
||||
} else { # qt5
|
||||
|
||||
QTESTLIB = qtestlib
|
||||
|
||||
# For use in custom compilers which just copy files
|
||||
win32:i_flag = i
|
||||
defineReplace(stripSrcDir) {
|
||||
|
@@ -104,7 +104,7 @@
|
||||
<name>Utils::NewClassWidget</name>
|
||||
<message>
|
||||
<source>Invalid base class name</source>
|
||||
<translation>Niepoprawna nazwa klasy podstawowej</translation>
|
||||
<translation>Niepoprawna nazwa klasy bazowej</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid header file name: '%1'</source>
|
||||
@@ -120,7 +120,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>Inherits QObject</source>
|
||||
<translation>Wywiedziony z QObject</translation>
|
||||
<translation>Dziedziczy z QObject</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
@@ -128,7 +128,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>Inherits QWidget</source>
|
||||
<translation>Wywiedziony z QWidget</translation>
|
||||
<translation>Dziedziczy z QWidget</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Class name:</source>
|
||||
@@ -136,7 +136,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>&Base class:</source>
|
||||
<translation>Klasa &podstawowa:</translation>
|
||||
<translation>Klasa &bazowa:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Type information:</source>
|
||||
@@ -168,7 +168,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>Inherits QDeclarativeItem</source>
|
||||
<translation>Wywiedziony z QDeclarativeItem</translation>
|
||||
<translation>Dziedziczy z QDeclarativeItem</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -1187,7 +1187,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>Widget &base class:</source>
|
||||
<translation>Klasa podsta&wowa widżetu:</translation>
|
||||
<translation>Klasa &bazowa widżetu:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>QWidget</source>
|
||||
@@ -1793,7 +1793,7 @@ Przyczyna: %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Plugin is not valid (does not derive from IPlugin)</source>
|
||||
<translation>Wtyczka jest niepoprawna (nie jest wywiedziona z IPlugin)</translation>
|
||||
<translation>Wtyczka jest niepoprawna (nie dziedziczy z IPlugin)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Initializing the plugin failed because state != Loaded</source>
|
||||
@@ -9246,7 +9246,7 @@ Wstępnie wybiera wersję desktopową Qt do budowania aplikacji (jeśli jest dos
|
||||
<name>Qt4ProjectManager::Internal::ConsoleAppWizardDialog</name>
|
||||
<message>
|
||||
<source>This wizard generates a Qt4 console application project. The application derives from QCoreApplication and does not provide a GUI.</source>
|
||||
<translation>Ten kreator generuje projekt aplikacji konsolowej Qt4. Aplikacja wywiedziona jest z QCoreApplication i nie używa GUI.</translation>
|
||||
<translation>Ten kreator generuje projekt aplikacji konsolowej Qt4. Aplikacja dziedziczy z QCoreApplication i nie używa GUI.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -9297,7 +9297,7 @@ Wstępnie wybiera wersję desktopową Qt do budowania aplikacji (jeśli jest dos
|
||||
<name>Qt4ProjectManager::Internal::GuiAppWizardDialog</name>
|
||||
<message>
|
||||
<source>This wizard generates a Qt4 GUI application project. The application derives by default from QApplication and includes an empty widget.</source>
|
||||
<translation>Ten kreator generuje projekt aplikacji GUI Qt4. Aplikacja wywiedziona jest domyślnie z QApplication i zawiera pusty widżet.</translation>
|
||||
<translation>Ten kreator generuje projekt aplikacji GUI Qt4. Aplikacja domyślnie dziedziczy z QApplication i zawiera pusty widżet.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Details</source>
|
||||
@@ -13872,18 +13872,18 @@ Wymaga <b>Qt 4.7.4</b> lub nowszego.</translation>
|
||||
<name>Qt4ProjectManager::Internal::TestWizard</name>
|
||||
<message>
|
||||
<source>Qt Unit Test</source>
|
||||
<translation>Test grupowy Qt</translation>
|
||||
<translation>Test jednostkowy Qt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Creates a QTestLib-based unit test for a feature or a class. Unit tests allow you to verify that the code is fit for use and that there are no regressions.</source>
|
||||
<translation>Tworzy grupowy test funkcjonalności lub klasy w oparciu o QTestLib. Grupowe testy pozwalają na weryfikowanie działania kodu i wykrywanie regresji.</translation>
|
||||
<translation>Tworzy testy jednostkowe funkcjonalności lub klasy, dziedzicząc z QTestLib. Testy jednostkowe pozwalają na weryfikowanie działania kodu i wykrywanie regresji.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qt4ProjectManager::Internal::TestWizardDialog</name>
|
||||
<message>
|
||||
<source>This wizard generates a Qt unit test consisting of a single source file with a test class.</source>
|
||||
<translation>Ten kreator generuje test grupowy składający się z pojedynczego pliku źródłowego z klasą testową.</translation>
|
||||
<translation>Ten kreator generuje test jednostkowy składający się z pojedynczego pliku źródłowego z klasą testową.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Details</source>
|
||||
@@ -15426,7 +15426,7 @@ Lista serwera: %2.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Derived</source>
|
||||
<translation>Klasy wywiedzione</translation>
|
||||
<translation>Klasy pochodne</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -25472,7 +25472,7 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>Displays names of QThread based threads.</source>
|
||||
<translation>Wyświetlaj nazwy wątków wywiedzionych z QThread.</translation>
|
||||
<translation>Wyświetla nazwy wątków dziedziczących z QThread.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display thread names</source>
|
||||
@@ -27669,8 +27669,6 @@ Sprawdź dokumentację SSH zmienną środowiskową SSH_ASKPASS.</translation>
|
||||
<source>Zeroconf for [%1] accumulated %n consecutive errors, aborting.</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
void clear(const T *item)
|
||||
{
|
||||
if (_class != item)
|
||||
if (_class != item || _container.size() == 1)
|
||||
_container.clear();
|
||||
}
|
||||
|
||||
|
@@ -72,8 +72,11 @@ bool MakefileParser::parse()
|
||||
m_makefiles.clear();
|
||||
|
||||
QFile *file = new QFile(m_makefile);
|
||||
if (!file->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qWarning("%s: %s", qPrintable(m_makefile), qPrintable(file->errorString()));
|
||||
delete file;
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo info(m_makefile);
|
||||
m_makefiles.append(info.fileName());
|
||||
|
@@ -174,6 +174,8 @@ QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, N
|
||||
{
|
||||
QList<GeneratorInfo> results;
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||
if (!tc)
|
||||
return results;
|
||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||
if (n != ForceNinja) {
|
||||
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
||||
@@ -574,9 +576,6 @@ void CMakeRunPage::initializePage()
|
||||
ProjectExplorer::KitManager::instance()->kits();
|
||||
|
||||
foreach (ProjectExplorer::Kit *k, kitList) {
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||
if (!tc)
|
||||
continue;
|
||||
QList<GeneratorInfo> infos = GeneratorInfo::generatorInfosFor(k,
|
||||
hasNinjaGenerator ? GeneratorInfo::OfferNinja : GeneratorInfo::NoNinja,
|
||||
hasCodeBlocksGenerator);
|
||||
|
@@ -66,6 +66,7 @@
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/winutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/savedaction.h>
|
||||
@@ -681,7 +682,8 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
|
||||
case StartExternal:
|
||||
if (!nativeArguments.isEmpty())
|
||||
nativeArguments.push_back(blank);
|
||||
nativeArguments += QDir::toNativeSeparators(sp.executable);
|
||||
Utils::QtcProcess::addArgs(&nativeArguments,
|
||||
QStringList(QDir::toNativeSeparators(sp.executable)));
|
||||
break;
|
||||
case AttachToRemoteServer:
|
||||
break;
|
||||
|
@@ -1765,6 +1765,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
|
||||
sp.startMode = AttachToRemoteProcess;
|
||||
sp.closeMode = KillAtClose;
|
||||
sp.languages = QmlLanguage;
|
||||
sp.masterEngineType = QmlEngineType;
|
||||
|
||||
//
|
||||
// get files from all the projects in the session
|
||||
|
@@ -420,17 +420,21 @@ void QmlEngine::beginConnection(quint16 port)
|
||||
|
||||
QTC_ASSERT(state() == EngineRunRequested, return);
|
||||
|
||||
QString host = startParameters().qmlServerAddress;
|
||||
// Use localhost as default
|
||||
if (host.isEmpty())
|
||||
host = QLatin1String("localhost");
|
||||
|
||||
if (port > 0) {
|
||||
QTC_ASSERT(startParameters().connParams.port == 0
|
||||
|| startParameters().connParams.port == port,
|
||||
qWarning() << "Port " << port << "from application output does not match"
|
||||
<< startParameters().connParams.port << "from start parameters.");
|
||||
m_adapter.beginConnectionTcp(startParameters().qmlServerAddress, port);
|
||||
m_adapter.beginConnectionTcp(host, port);
|
||||
return;
|
||||
}
|
||||
// no port from application output, use the one from start parameters ...
|
||||
m_adapter.beginConnectionTcp(startParameters().qmlServerAddress,
|
||||
startParameters().qmlServerPort);
|
||||
m_adapter.beginConnectionTcp(host, startParameters().qmlServerPort);
|
||||
}
|
||||
|
||||
void QmlEngine::connectionStartupFailed()
|
||||
|
@@ -2373,12 +2373,12 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
|
||||
}
|
||||
// cut 'git version 1.6.5.1.sha'
|
||||
const QString output = commandOutputFromLocal8Bit(outputText);
|
||||
QRegExp versionPattern(QLatin1String("^[^\\d]+([\\d])\\.([\\d])\\.([\\d]).*$"));
|
||||
QRegExp versionPattern(QLatin1String("^[^\\d]+(\\d+)\\.(\\d+)\\.(\\d+).*$"));
|
||||
QTC_ASSERT(versionPattern.isValid(), return 0);
|
||||
QTC_ASSERT(versionPattern.exactMatch(output), return 0);
|
||||
const unsigned major = versionPattern.cap(1).toUInt();
|
||||
const unsigned minor = versionPattern.cap(2).toUInt();
|
||||
const unsigned patch = versionPattern.cap(3).toUInt();
|
||||
const unsigned major = versionPattern.cap(1).toUInt(0, 16);
|
||||
const unsigned minor = versionPattern.cap(2).toUInt(0, 16);
|
||||
const unsigned patch = versionPattern.cap(3).toUInt(0, 16);
|
||||
return version(major, minor, patch);
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#define QMLDESIGNER_PLUGIN_INTERFACE "com.Nokia.QmlDesigner.IPlugin.v10"
|
||||
#define QMLDESIGNER_PLUGIN_INTERFACE "com.Digia.QmlDesigner.IPlugin.v10"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#define QMLDESIGNER_WIDGETPLUGIN_INTERFACE "com.Nokia.QmlDesigner.IWidgetPlugin.v10"
|
||||
#define QMLDESIGNER_WIDGETPLUGIN_INTERFACE "com.Digia.QmlDesigner.IWidgetPlugin.v10"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
|
@@ -627,9 +627,11 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const
|
||||
ensureMkSpecParsed();
|
||||
switch (binary) {
|
||||
case QmlScene:
|
||||
case QmlViewer:
|
||||
baseDir = m_mkspecValues.value(QLatin1String("QT.qml.bins"));
|
||||
break;
|
||||
case QmlViewer:
|
||||
baseDir = m_mkspecValues.value(QLatin1String("QT.declarative.bins"));
|
||||
break;
|
||||
case Designer:
|
||||
case Linguist:
|
||||
baseDir = m_mkspecValues.value(QLatin1String("QT.designer.bins"));
|
||||
@@ -772,8 +774,10 @@ void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
||||
m_defaultConfigIsDebugAndRelease = true;
|
||||
}
|
||||
const QString designerBins = QLatin1String("QT.designer.bins");
|
||||
const QString declarativeBins = QLatin1String("QT.qml.bins");
|
||||
const QString qmlBins = QLatin1String("QT.qml.bins");
|
||||
const QString declarativeBins = QLatin1String("QT.declarative.bins");
|
||||
m_mkspecValues.insert(designerBins, evaluator->value(designerBins));
|
||||
m_mkspecValues.insert(qmlBins, evaluator->value(qmlBins));
|
||||
m_mkspecValues.insert(declarativeBins, evaluator->value(declarativeBins));
|
||||
}
|
||||
|
||||
@@ -1260,61 +1264,69 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &ver
|
||||
if (baseMkspecDir.isEmpty())
|
||||
return FileName();
|
||||
|
||||
FileName mkspecFullPath = FileName::fromString(baseMkspecDir.toString() + QLatin1String("/default"));
|
||||
bool qt5 = false;
|
||||
QString theSpec = qmakeProperty(versionInfo, "QMAKE_XSPEC");
|
||||
if (theSpec.isEmpty())
|
||||
theSpec = QLatin1String("default");
|
||||
else
|
||||
qt5 = true;
|
||||
|
||||
FileName mkspecFullPath = baseMkspecDir;
|
||||
mkspecFullPath.appendPath(theSpec);
|
||||
|
||||
// qDebug() << "default mkspec is located at" << mkspecFullPath;
|
||||
|
||||
switch (HostOsInfo::hostOs()) {
|
||||
case HostOsInfo::HostOsWindows: {
|
||||
QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
|
||||
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
||||
while (!f2.atEnd()) {
|
||||
QByteArray line = f2.readLine();
|
||||
if (line.startsWith("QMAKESPEC_ORIGINAL")) {
|
||||
const QList<QByteArray> &temp = line.split('=');
|
||||
if (temp.size() == 2) {
|
||||
QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
|
||||
// We sometimes get a mix of different slash styles here...
|
||||
possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
||||
if (QFileInfo(possibleFullPath).exists()) // Only if the path exists
|
||||
mkspecFullPath = FileName::fromUserInput(possibleFullPath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
f2.close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HostOsInfo::HostOsMac: {
|
||||
QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
|
||||
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
||||
while (!f2.atEnd()) {
|
||||
QByteArray line = f2.readLine();
|
||||
if (line.startsWith("MAKEFILE_GENERATOR")) {
|
||||
const QList<QByteArray> &temp = line.split('=');
|
||||
if (temp.size() == 2) {
|
||||
const QByteArray &value = temp.at(1);
|
||||
if (value.contains("XCODE")) {
|
||||
// we don't want to generate xcode projects...
|
||||
// qDebug() << "default mkspec is xcode, falling back to g++";
|
||||
mkspecFullPath = baseMkspecDir.appendPath(QLatin1String("macx-g++"));
|
||||
if (HostOsInfo::isWindowsHost()) {
|
||||
if (!qt5) {
|
||||
QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
|
||||
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
||||
while (!f2.atEnd()) {
|
||||
QByteArray line = f2.readLine();
|
||||
if (line.startsWith("QMAKESPEC_ORIGINAL")) {
|
||||
const QList<QByteArray> &temp = line.split('=');
|
||||
if (temp.size() == 2) {
|
||||
QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
|
||||
// We sometimes get a mix of different slash styles here...
|
||||
possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
||||
if (QFileInfo(possibleFullPath).exists()) // Only if the path exists
|
||||
mkspecFullPath = FileName::fromUserInput(possibleFullPath);
|
||||
}
|
||||
//resolve mkspec link
|
||||
mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
f2.close();
|
||||
}
|
||||
f2.close();
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
|
||||
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
||||
while (!f2.atEnd()) {
|
||||
QByteArray line = f2.readLine();
|
||||
if (line.startsWith("MAKEFILE_GENERATOR")) {
|
||||
const QList<QByteArray> &temp = line.split('=');
|
||||
if (temp.size() == 2) {
|
||||
const QByteArray &value = temp.at(1);
|
||||
if (value.contains("XCODE")) {
|
||||
// we don't want to generate xcode projects...
|
||||
// qDebug() << "default mkspec is xcode, falling back to g++";
|
||||
return baseMkspecDir.appendPath(QLatin1String("macx-g++"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
f2.close();
|
||||
}
|
||||
}
|
||||
if (!qt5) {
|
||||
//resolve mkspec link
|
||||
QString rspec = mkspecFullPath.toFileInfo().readLink();
|
||||
if (!rspec.isEmpty())
|
||||
mkspecFullPath = FileName::fromUserInput(
|
||||
QDir(baseMkspecDir.toString()).absoluteFilePath(rspec));
|
||||
}
|
||||
}
|
||||
default:
|
||||
mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
|
||||
break;
|
||||
}
|
||||
|
||||
return mkspecFullPath;
|
||||
}
|
||||
|
||||
|
@@ -205,7 +205,7 @@ QString ProFileEvaluator::propertyValue(const QString &name) const
|
||||
|
||||
QString ProFileEvaluator::resolvedMkSpec() const
|
||||
{
|
||||
return d->m_qmakespecFull;
|
||||
return d->m_qmakespec;
|
||||
}
|
||||
|
||||
#ifdef PROEVALUATOR_CUMULATIVE
|
||||
|
@@ -199,7 +199,6 @@ void QMakeEvaluator::initFrom(const QMakeEvaluator &other)
|
||||
m_valuemapStack = other.m_valuemapStack;
|
||||
m_valuemapInited = true;
|
||||
m_qmakespec = other.m_qmakespec;
|
||||
m_qmakespecFull = other.m_qmakespecFull;
|
||||
m_qmakespecName = other.m_qmakespecName;
|
||||
m_mkspecPaths = other.m_mkspecPaths;
|
||||
m_featureRoots = other.m_featureRoots;
|
||||
@@ -1116,17 +1115,26 @@ bool QMakeEvaluator::loadSpecInternal()
|
||||
evalError(fL1S("Could not read qmake configuration file %1.").arg(spec));
|
||||
return false;
|
||||
}
|
||||
#ifdef Q_OS_UNIX
|
||||
m_qmakespecFull = QFileInfo(m_qmakespec).canonicalFilePath();
|
||||
#else
|
||||
#ifndef QT_BUILD_QMAKE
|
||||
// Legacy support for Qt4 default specs
|
||||
# ifdef Q_OS_UNIX
|
||||
if (m_qmakespec.endsWith(QLatin1String("/default-host"))
|
||||
|| m_qmakespec.endsWith(QLatin1String("/default"))) {
|
||||
QString rspec = QFileInfo(m_qmakespec).readLink();
|
||||
if (!rspec.isEmpty())
|
||||
m_qmakespec = QDir::cleanPath(QDir(m_qmakespec).absoluteFilePath(rspec));
|
||||
}
|
||||
# else
|
||||
// We can't resolve symlinks as they do on Unix, so configure.exe puts
|
||||
// the source of the qmake.conf at the end of the default/qmake.conf in
|
||||
// the QMAKESPEC_ORIGINAL variable.
|
||||
const ProString &orig_spec = first(ProKey("QMAKESPEC_ORIGINAL"));
|
||||
m_qmakespecFull = orig_spec.isEmpty() ? m_qmakespec : orig_spec.toQString();
|
||||
if (!orig_spec.isEmpty())
|
||||
m_qmakespec = orig_spec.toQString();
|
||||
# endif
|
||||
#endif
|
||||
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespecFull);
|
||||
m_qmakespecName = IoUtils::fileName(m_qmakespecFull).toString();
|
||||
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespec);
|
||||
m_qmakespecName = IoUtils::fileName(m_qmakespec).toString();
|
||||
if (!evaluateFeatureFile(QLatin1String("spec_post.prf")))
|
||||
return false;
|
||||
// The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it
|
||||
@@ -1167,8 +1175,13 @@ bool QMakeEvaluator::loadSpec()
|
||||
}
|
||||
|
||||
updateMkspecPaths();
|
||||
if (qmakespec.isEmpty())
|
||||
qmakespec = propertyValue(ProKey(m_hostBuild ? "QMAKE_SPEC" : "QMAKE_XSPEC")).toQString();
|
||||
#ifndef QT_BUILD_QMAKE
|
||||
// Legacy support for Qt4 qmake in Qt Creator, etc.
|
||||
if (qmakespec.isEmpty())
|
||||
qmakespec = m_hostBuild ? QLatin1String("default-host") : QLatin1String("default");
|
||||
#endif
|
||||
if (IoUtils::isRelativePath(qmakespec)) {
|
||||
foreach (const QString &root, m_mkspecPaths) {
|
||||
QString mkspec = root + QLatin1Char('/') + qmakespec;
|
||||
@@ -1409,12 +1422,12 @@ void QMakeEvaluator::updateFeaturePaths()
|
||||
foreach (const QString &item, m_qmakepath)
|
||||
feature_bases << (item + mkspecs_concat);
|
||||
|
||||
if (!m_qmakespecFull.isEmpty()) {
|
||||
if (!m_qmakespec.isEmpty()) {
|
||||
// The spec is already platform-dependent, so no subdirs here.
|
||||
feature_roots << (m_qmakespecFull + features_concat);
|
||||
feature_roots << (m_qmakespec + features_concat);
|
||||
|
||||
// Also check directly under the root directory of the mkspecs collection
|
||||
QDir specdir(m_qmakespecFull);
|
||||
QDir specdir(m_qmakespec);
|
||||
while (!specdir.isRoot() && specdir.cdUp()) {
|
||||
const QString specpath = specdir.path();
|
||||
if (specpath.endsWith(mkspecs_concat)) {
|
||||
|
@@ -262,7 +262,6 @@ public:
|
||||
bool m_valuemapInited;
|
||||
bool m_hostBuild;
|
||||
QString m_qmakespec;
|
||||
QString m_qmakespecFull;
|
||||
QString m_qmakespecName;
|
||||
QString m_superfile;
|
||||
QString m_conffile;
|
||||
|
@@ -314,7 +314,7 @@ bool QMakeGlobals::initProperties()
|
||||
}
|
||||
#endif
|
||||
foreach (QByteArray line, data.split('\n'))
|
||||
if (!line.startsWith("QMAKE_")) {
|
||||
{
|
||||
int off = line.indexOf(':');
|
||||
if (off < 0) // huh?
|
||||
continue;
|
||||
@@ -340,7 +340,6 @@ bool QMakeGlobals::initProperties()
|
||||
}
|
||||
}
|
||||
}
|
||||
properties.insert(ProKey("QMAKE_VERSION"), ProString("2.01a"));
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
@@ -27,7 +27,6 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QTextDocument>
|
||||
#include <QTextCursor>
|
||||
@@ -35,6 +34,15 @@
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
// Qt5: QTextDocument needs access to Fonts via QGuiApplication.
|
||||
#include <QGuiApplication>
|
||||
typedef QGuiApplication MyQApplication;
|
||||
#else
|
||||
#include <QCoreApplication>
|
||||
typedef QCoreApplication MyQApplication;
|
||||
#endif
|
||||
|
||||
#include <Control.h>
|
||||
#include <Parser.h>
|
||||
#include <AST.h>
|
||||
@@ -1064,9 +1072,7 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir)
|
||||
QTextDocument cpp_document;
|
||||
cpp_document.setPlainText(source);
|
||||
|
||||
Document::Ptr AST_cpp_document = Document::create(fileName);
|
||||
const QByteArray preprocessedCode = snapshot.preprocessedCode(source, fileName);
|
||||
AST_cpp_document->setUtf8Source(preprocessedCode);
|
||||
Document::Ptr AST_cpp_document = snapshot.preprocessedDocument(source, fileName);
|
||||
AST_cpp_document->check();
|
||||
|
||||
Overview oo;
|
||||
@@ -1368,9 +1374,7 @@ QStringList generateAST_H(const Snapshot &snapshot, const QDir &cplusplusDir, co
|
||||
QTextDocument document;
|
||||
document.setPlainText(source);
|
||||
|
||||
AST_h_document = Document::create(fileName);
|
||||
const QByteArray preprocessedCode = snapshot.preprocessedCode(source, fileName);
|
||||
AST_h_document->setUtf8Source(preprocessedCode);
|
||||
AST_h_document = snapshot.preprocessedDocument(source, fileName);
|
||||
AST_h_document->check();
|
||||
|
||||
FindASTNodes process(AST_h_document, &document);
|
||||
@@ -1514,10 +1518,7 @@ void generateASTFwd_h(const Snapshot &snapshot, const QDir &cplusplusDir, const
|
||||
|
||||
QTextDocument document;
|
||||
document.setPlainText(source);
|
||||
|
||||
Document::Ptr doc = Document::create(fileName);
|
||||
const QByteArray preprocessedCode = snapshot.preprocessedCode(source, fileName);
|
||||
doc->setUtf8Source(preprocessedCode);
|
||||
Document::Ptr doc = snapshot.preprocessedDocument(source, fileName);
|
||||
doc->check();
|
||||
|
||||
FindASTForwards process(doc, &document);
|
||||
@@ -1667,7 +1668,8 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
MyQApplication app(argc, argv);
|
||||
|
||||
QStringList files = app.arguments();
|
||||
files.removeFirst();
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
include(../../qttest.pri)
|
||||
include(../shared/shared.pri)
|
||||
|
||||
DEFINES+=TESTSRCDIR=\\\"$$PWD\\\"
|
||||
# Inject the source dir for referencing test data from shadow builds.
|
||||
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||
|
||||
SOURCES += tst_cxx11.cpp
|
||||
OTHER_FILES += \
|
||||
|
@@ -58,7 +58,8 @@ class tst_cxx11: public QObject
|
||||
*/
|
||||
static QString testdata(const QString &name = QString())
|
||||
{
|
||||
static const QString dataDirectory = QLatin1String(TESTSRCDIR) + QLatin1String("/data");
|
||||
static const QString dataDirectory = QLatin1String(SRCDIR "/data");
|
||||
|
||||
QString result = dataDirectory;
|
||||
if (!name.isEmpty()) {
|
||||
result += QLatin1Char('/');
|
||||
|
@@ -1,7 +1,10 @@
|
||||
include(../../qttest.pri)
|
||||
include(../shared/shared.pri)
|
||||
SOURCES += tst_preprocessor.cpp
|
||||
|
||||
# Inject the source dir for referencing test data from shadow builds.
|
||||
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||
|
||||
SOURCES += tst_preprocessor.cpp
|
||||
OTHER_FILES = \
|
||||
data/noPP.1.cpp \
|
||||
data/noPP.2.cpp \
|
||||
|
@@ -39,7 +39,7 @@ using namespace CPlusPlus;
|
||||
|
||||
QByteArray loadSource(const QString &fileName)
|
||||
{
|
||||
QFile inf(fileName);
|
||||
QFile inf(QLatin1String(SRCDIR) + QLatin1Char('/') + fileName);
|
||||
if (!inf.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qDebug("Cannot open \"%s\"", fileName.toUtf8().constData());
|
||||
return QByteArray();
|
||||
@@ -53,7 +53,7 @@ QByteArray loadSource(const QString &fileName)
|
||||
|
||||
void saveData(const QByteArray &data, const QString &fileName)
|
||||
{
|
||||
QFile inf(fileName);
|
||||
QFile inf(QLatin1String(SRCDIR) + QLatin1Char('/') + fileName);
|
||||
if (!inf.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug("Cannot open \"%s\"", fileName.toUtf8().constData());
|
||||
return;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
include(../../../../../qtcreator.pri)
|
||||
#include(../../../../../src/plugins/qmldesigner/config.pri)
|
||||
QT += $$QTESTLIB
|
||||
QT += testlib
|
||||
CONFIG += testcase
|
||||
|
||||
##DEFINES += DONT_MESS_WITH_QDEBUG
|
||||
|
@@ -1,6 +1,6 @@
|
||||
include(../../../../../qtcreator.pri)
|
||||
TEMPLATE = app
|
||||
QT += script declarative webkit $$QTESTLIB
|
||||
QT += script declarative webkit testlib
|
||||
CONFIG += testcase
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
@@ -1,6 +1,6 @@
|
||||
include(../../../../../qtcreator.pri)
|
||||
TEMPLATE = app
|
||||
QT += $$QTESTLIB
|
||||
QT += testlib
|
||||
CONFIG += qt warn_on console depend_includepath testcase
|
||||
include(../../../../../src/libs/qmljs/qmljs-lib.pri)
|
||||
DEFINES += QML_BUILD_STATIC_LIB
|
||||
|
@@ -2,7 +2,7 @@ include(../../qtcreator.pri)
|
||||
include(qttestrpath.pri)
|
||||
|
||||
isEmpty(TEMPLATE):TEMPLATE=app
|
||||
QT += $$QTESTLIB
|
||||
QT += testlib
|
||||
CONFIG += qt warn_on console depend_includepath testcase
|
||||
CONFIG -= app_bundle
|
||||
|
||||
|
@@ -232,7 +232,8 @@ void dummyStatement(...) {}
|
||||
|
||||
#if USE_AUTOBREAK
|
||||
# ifdef Q_CC_MSVC
|
||||
# define BREAK_HERE __asm { int 3 }; __asm { mov eax, eax }
|
||||
# include <crtdbg.h>
|
||||
# define BREAK_HERE _CrtDbgReport(_CRT_WARN, NULL, NULL, "simple_test_app", NULL)
|
||||
# else
|
||||
# define BREAK_HERE asm("int $3; mov %eax, %eax")
|
||||
# endif
|
||||
@@ -242,7 +243,8 @@ void dummyStatement(...) {}
|
||||
|
||||
#if USE_UNINITIALIZED_AUTOBREAK
|
||||
# ifdef Q_CC_MSVC
|
||||
# define BREAK_UNINITIALIZED_HERE __asm { int 3 }; __asm { mov eax, eax }
|
||||
# include <crtdbg.h>
|
||||
# define BREAK_UNINITIALIZED_HERE _CrtDbgReport(_CRT_WARN, NULL, NULL, "simple_test_app", NULL)
|
||||
# else
|
||||
# define BREAK_UNINITIALIZED_HERE asm("int $3; mov %eax, %eax")
|
||||
# endif
|
||||
|
@@ -1,5 +1,36 @@
|
||||
Preface
|
||||
-------
|
||||
Prerequisites - general information
|
||||
-----------------------------------
|
||||
Squish tests inside this folder have several prerequisites to get them running.
|
||||
|
||||
First - and most important - you have to own a valid Squish license.
|
||||
Actually it's recommended to use Squish 4.2.2 - but 4.1.1 should be capable of running all tests.
|
||||
For Squish on Mac it's necessary to change the used Python version to 2.6 inside the <SQUISHDIR>/etc/paths.ini
|
||||
|
||||
Second - some of the test suites/test cases expect an installed QtSDK in its default location.
|
||||
On Linux/Mac this is ~/QtSDK, and on Windows this is C:\QtSDK.
|
||||
After installing the QtSDK you should use the package manager of the QtSDK (SDKMaintenanceTool) to add some more packages.
|
||||
You'll need at least Desktop Qt versions 4.7.4, 4.8.0, Harmattan stuff (except QEmu), Maemo Toolchain, Qt Examples, Simulator, Documentation files.
|
||||
|
||||
Third - you'll have to provide some additional repositories (and for the hooking into subprocesses even some more Squish bundles, see below).
|
||||
These additional repositories are located inside ~/QtSDK/src or C:\QtSDK\src (depending on the OS you're on).
|
||||
You can also just provide them inside a different folder and specify the folder with the environment variable SYSTEST_SRCPATH.
|
||||
This folder must contain the following:
|
||||
* a QtCreator repository (or source copy) of tag v2.5.0 named 'creator'
|
||||
* a subfolder called 'creator-test-data'
|
||||
* a speedcrunch repository (or source copy) inside 'creator-test-data' named 'speedcrunch'
|
||||
* additional Squish versions for hooking into subprocesses inside different folders inside 'creator-test-data' following the information below
|
||||
|
||||
Fourth - you'll have to make sure that some needed tools are available (no matter on which OS you're on).
|
||||
* cmake
|
||||
* wget or curl
|
||||
Normally it should be okay to just install them as usual and add their executables' path(s) to the PATH variable.
|
||||
|
||||
|
||||
Attention! If any of these prerequisites cannot be satisfied the tests will likely fail (or not run at all).
|
||||
|
||||
|
||||
Prerequisites - hooking into subprocesses
|
||||
-----------------------------------------
|
||||
The usage of the hook-into subprocess has following prerequisites:
|
||||
Either:
|
||||
* have no firewall at all enabled (sure that's a bad idea)
|
||||
|
@@ -42,6 +42,9 @@
|
||||
:Dialog_QmlJSEditor::Internal::ComponentNameDialog {name='QmlJSEditor__Internal__ComponentNameDialog' type='QmlJSEditor::Internal::ComponentNameDialog' visible='1' windowTitle='Move Component into Separate File'}
|
||||
:Edit Environment_ProjectExplorer::EnvironmentItemsDialog {type='ProjectExplorer::EnvironmentItemsDialog' unnamed='1' visible='1' windowTitle='Edit Environment'}
|
||||
:Failed to start application_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Failed to start application'}
|
||||
:File has been removed.Close_QPushButton {text='Close' type='QPushButton' unnamed='1' visible='1' window=':File has been removed_QMessageBox'}
|
||||
:File has been removed.Save_QPushButton {text='Save' type='QPushButton' unnamed='1' visible='1' window=':File has been removed_QMessageBox'}
|
||||
:File has been removed_QMessageBox {text?='The file * removed*. Do you want to save it under a different name, or close the editor?' type='QMessageBox' unnamed='1' visible='1'}
|
||||
:Form.Startup_QGroupBox {container=':qt_tabwidget_stackedwidget.Form_QWidget' name='startupGroupBox' title='Startup' type='QGroupBox' visible='1'}
|
||||
:Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'}
|
||||
:Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
@@ -54,6 +57,7 @@
|
||||
:Next_QPushButton {text~='(Next.*|Continue)' type='QPushButton' visible='1'}
|
||||
:Open File.File name:_QLabel {name='fileNameLabel' text='File name:' type='QLabel' visible='1' window=':Open File_QFileDialog'}
|
||||
:Open File_QFileDialog {name='QFileDialog' type='QFileDialog' visible='1' windowTitle='Open File'}
|
||||
:OpenDocuments_QTreeView {name='editorList' type='QTreeView' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:OpenProject_QStyleItem {clip='false' container=':Qt Creator_QDeclarativeView' enabled='true' text='Open Project' type='LinkedText' unnamed='1' visible='true'}
|
||||
:Options.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
|
||||
:Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
|
||||
@@ -87,10 +91,12 @@
|
||||
:Qt Creator_Core::Internal::CommandComboBox {type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'}
|
||||
:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_FilenameQComboBox {type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::HelpViewer' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_HelpSelector_QComboBox {occurrence='3' type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Issues_Core::Internal::OutputPaneToggleButton {occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_ProFileEditorWidget {type='Qt4ProjectManager::Internal::ProFileEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_QDeclarativeView {type='QDeclarativeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_QHelpContentWidget {type='QHelpContentWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_QTableView {type='QTableView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
|
@@ -68,7 +68,7 @@ def checkLastBuild(expectedToFail=False):
|
||||
test.fail("Errors: %s | Warnings: %s" % (errors, warnings))
|
||||
# additional stuff - could be removed... or improved :)
|
||||
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
|
||||
list=waitForObject(":Qt Creator.Issues_QListView", 20000)
|
||||
list=waitForObject(":Qt Creator.Issues_QListView")
|
||||
model = list.model()
|
||||
test.log("Rows inside issues: %d" % model.rowCount())
|
||||
if gotErrors and createTasksFileOnError:
|
||||
@@ -78,7 +78,7 @@ def checkLastBuild(expectedToFail=False):
|
||||
# helper function to check the compilation when build wasn't successful
|
||||
def checkCompile():
|
||||
ensureChecked(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton")
|
||||
output = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow", 20000)
|
||||
output = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow")
|
||||
waitFor("len(str(output.plainText))>0",5000)
|
||||
success = str(output.plainText).endswith("exited normally.")
|
||||
if success:
|
||||
@@ -132,19 +132,22 @@ def createTasksFile(list):
|
||||
file.close()
|
||||
test.log("Written tasks file %s" % outfile)
|
||||
|
||||
# returns a list of the build configurations for a target
|
||||
# param targetCount specifies the number of targets currently defined (must be correct!)
|
||||
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
|
||||
# returns a list of pairs each containing the zero based number of a kit
|
||||
# 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
|
||||
def iterateBuildConfigs(targetCount, currentTarget, filter = ""):
|
||||
def iterateBuildConfigs(kitCount, filter = ""):
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
|
||||
model = waitForObject(":scrollArea.Edit build configuration:_QComboBox", 20000).model()
|
||||
prog = re.compile(filter)
|
||||
# for each row in the model, write its data to a list
|
||||
configNames = dumpItems(model)
|
||||
# pick only those configuration names which pass the filter
|
||||
configs = [config for config in configNames if prog.match(config)]
|
||||
configs = []
|
||||
for currentKit in range(kitCount):
|
||||
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.BUILD)
|
||||
model = waitForObject(":scrollArea.Edit build configuration:_QComboBox").model()
|
||||
prog = re.compile(filter)
|
||||
# for each row in the model, write its data to a list
|
||||
configNames = dumpItems(model)
|
||||
# pick only those configuration names which pass the filter
|
||||
configs += zip([currentKit] * len(configNames),
|
||||
[config for config in configNames if prog.match(config)])
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
return configs
|
||||
|
||||
|
@@ -19,7 +19,7 @@ def handleDebuggerWarnings(config):
|
||||
pass # No warning. Fine.
|
||||
else:
|
||||
if "Release" in config and not platform.system() in ("Darwin", "Microsoft", "Windows"):
|
||||
message = waitForObject("{container=':Qt Creator.DebugModeWidget_QSplitter' name='qt_msgbox_label' type='QLabel' visible='1'}", 20000)
|
||||
message = waitForObject("{container=':Qt Creator.DebugModeWidget_QSplitter' name='qt_msgbox_label' type='QLabel' visible='1'}")
|
||||
messageText = str(message.text)
|
||||
test.verify(messageText.startswith('This does not seem to be a "Debug" build.\nSetting breakpoints by file name and line number may fail.'),
|
||||
"Got warning: %s" % messageText)
|
||||
@@ -27,7 +27,7 @@ def handleDebuggerWarnings(config):
|
||||
|
||||
def takeDebuggerLog():
|
||||
invokeMenuItem("Window", "Views", "Debugger Log")
|
||||
debuggerLogWindow = waitForObject("{container=':DebugModeWidget.Debugger Log_QDockWidget' type='Debugger::Internal::CombinedPane' unnamed='1' visible='1'}", 20000)
|
||||
debuggerLogWindow = waitForObject("{container=':DebugModeWidget.Debugger Log_QDockWidget' type='Debugger::Internal::CombinedPane' unnamed='1' visible='1'}")
|
||||
debuggerLog = str(debuggerLogWindow.plainText)
|
||||
mouseClick(debuggerLogWindow, 5, 5, 0, Qt.LeftButton)
|
||||
activateItem(waitForObjectItem(openContextMenuOnTextCursorPosition(debuggerLogWindow),
|
||||
@@ -58,7 +58,7 @@ def setBreakpointsForCurrentProject(filesAndLines):
|
||||
test.fatal("This function only takes a non-empty list/tuple holding dicts.")
|
||||
return False
|
||||
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
for current in filesAndLines:
|
||||
for curFile,curLine in current.iteritems():
|
||||
fName = __doubleClickFile__(navTree, curFile)
|
||||
@@ -180,7 +180,7 @@ def __startDebugger__(config):
|
||||
def __stopDebugger__():
|
||||
clickButton(waitForObject(":Debugger Toolbar.Exit Debugger_QToolButton"))
|
||||
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
|
||||
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
|
||||
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}")
|
||||
waitFor("'Debugging has finished' in str(output.plainText)", 20000)
|
||||
return __logDebugResult__()
|
||||
|
||||
|
@@ -218,13 +218,11 @@ def getEditorForFileSuffix(curFile):
|
||||
glslEditorSuffixes= ["frag", "vert", "fsh", "vsh", "glsl", "shader", "gsh"]
|
||||
suffix = __getFileSuffix__(curFile)
|
||||
if suffix in cppEditorSuffixes:
|
||||
editor = waitForObject("{type='CppEditor::Internal::CPPEditorWidget' unnamed='1' "
|
||||
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
||||
elif suffix in qmlEditorSuffixes:
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
elif suffix in proEditorSuffixes:
|
||||
editor = waitForObject("{type='Qt4ProjectManager::Internal::ProFileEditorWidget' unnamed='1' "
|
||||
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
editor = waitForObject(":Qt Creator_ProFileEditorWidget")
|
||||
elif suffix in glslEditorSuffixes:
|
||||
editor = waitForObject("{type='GLSLEditor::GLSLTextEditorWidget' unnamed='1' "
|
||||
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
|
33
tests/system/shared/fs_utils.py
Normal file
33
tests/system/shared/fs_utils.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import stat
|
||||
|
||||
# this function modifies all (regular) files inside the given dirPath to have specified permissions
|
||||
# ATTENTION: it won't process the directory recursively
|
||||
def changeFilePermissions(dirPath, readPerm, writePerm, excludeFileNames=None):
|
||||
permission = 0
|
||||
if readPerm:
|
||||
permission |= stat.S_IREAD
|
||||
if writePerm:
|
||||
permission |= stat.S_IWRITE
|
||||
if excludeFileNames == None:
|
||||
excludeFileNames = []
|
||||
elif isinstance(excludeFileNames, (str, unicode)):
|
||||
excludeFileNames = [excludeFileNames]
|
||||
if not isinstance(excludeFileNames, (tuple, list)):
|
||||
test.warning("File names to exclude must be of type str, unicode, list, tuple or None - "
|
||||
"ignoring parameter this time.")
|
||||
excludeFileNames = []
|
||||
if not os.path.isdir(dirPath):
|
||||
test.warning("Could not find directory '%s'." % dirPath)
|
||||
return False
|
||||
filePaths = [os.path.join(dirPath, fileName) for fileName in os.listdir(dirPath)
|
||||
if fileName not in excludeFileNames]
|
||||
for filePath in filter(os.path.isfile, filePaths):
|
||||
os.chmod(filePath, permission)
|
||||
return True
|
||||
|
||||
def isWritable(pathToFile):
|
||||
if os.path.exists(pathToFile):
|
||||
return os.access(pathToFile, os.W_OK)
|
||||
else:
|
||||
test.warning("Path to check for writability does not exist.")
|
||||
return False
|
@@ -161,38 +161,6 @@ def __getMkspecFromQmake__(qmakeCall):
|
||||
"QMAKE_MKSPECS returned: '%s'" % QmakeConfPath)
|
||||
return None
|
||||
|
||||
def getQMakeFromQtVersion(qtVersion):
|
||||
invokeMenuItem("Tools", "Options...")
|
||||
buildAndRun = waitForObject("{type='QModelIndex' text='Build & Run' "
|
||||
"container={type='QListView' unnamed='1' visible='1' "
|
||||
"window=':Options_Core::Internal::SettingsDialog'}}")
|
||||
mouseClick(buildAndRun, 5, 5, 0, Qt.LeftButton)
|
||||
qtVersionTab = waitForObject("{container=':Options.qt_tabwidget_tabbar_QTabBar' text='Qt Versions' type='TabItem'}")
|
||||
mouseClick(qtVersionTab, 5, 5, 0, Qt.LeftButton)
|
||||
qtVersionsTree = waitForObject("{name='qtdirList' type='QTreeWidget' visible='1'}")
|
||||
rootIndex = qtVersionsTree.invisibleRootItem()
|
||||
for current in dumpChildren(rootIndex):
|
||||
child = getTreeWidgetChildByText(current, qtVersion)
|
||||
if child != None:
|
||||
break
|
||||
if child != None:
|
||||
qmake = "%s" % child.text(1)
|
||||
if not os.path.exists(qmake):
|
||||
test.warning("Qt version ('%s') found inside SettingsDialog does not exist." % qtVersion)
|
||||
qmake = None
|
||||
else:
|
||||
test.warning("Could not find the Qt version ('%s') inside SettingsDialog." % qtVersion)
|
||||
qmake = None
|
||||
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1' "
|
||||
"window=':Options_Core::Internal::SettingsDialog'}"))
|
||||
return qmake
|
||||
|
||||
def getTreeWidgetChildByText(parent, text, column=0):
|
||||
for child in dumpChildren(parent):
|
||||
if child.text(column)==text:
|
||||
return child
|
||||
return None
|
||||
|
||||
# helper that double clicks the table view at specified row and column
|
||||
# returns the QExpandingLineEdit (the editable table cell)
|
||||
def __doubleClickQTableView__(qtableView, row, column):
|
||||
|
@@ -31,7 +31,7 @@ def openQmakeProject(projectPath, targets = QtQuickConstants.Targets.DESKTOP_474
|
||||
pass
|
||||
__chooseTargets__(targets)
|
||||
configureButton = waitForObject("{text='Configure Project' type='QPushButton' unnamed='1' visible='1'"
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
clickButton(configureButton)
|
||||
|
||||
def openCmakeProject(projectPath, buildDir):
|
||||
@@ -39,7 +39,7 @@ def openCmakeProject(projectPath, buildDir):
|
||||
selectFromFileDialog(projectPath)
|
||||
replaceEditorContent("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'"
|
||||
"window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}", buildDir)
|
||||
clickButton(waitForObject(":CMake Wizard.Next_QPushButton", 20000))
|
||||
clickButton(waitForObject(":CMake Wizard.Next_QPushButton"))
|
||||
generatorCombo = waitForObject(":Generator:_QComboBox")
|
||||
mkspec = __getMkspecFromQmake__("qmake")
|
||||
test.log("Using mkspec '%s'" % mkspec)
|
||||
@@ -56,7 +56,7 @@ def openCmakeProject(projectPath, buildDir):
|
||||
else:
|
||||
generatorCombo.setCurrentIndex(index)
|
||||
|
||||
clickButton(waitForObject(":CMake Wizard.Run CMake_QPushButton", 20000))
|
||||
clickButton(waitForObject(":CMake Wizard.Run CMake_QPushButton"))
|
||||
try:
|
||||
clickButton(waitForObject(":CMake Wizard.Finish_QPushButton", 60000))
|
||||
except LookupError:
|
||||
@@ -77,22 +77,22 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i
|
||||
mouseClick(waitForObject(":CreateProject_QStyleItem"), 5, 5, 0, Qt.LeftButton)
|
||||
else:
|
||||
invokeMenuItem("File", "New File or Project...")
|
||||
categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000)
|
||||
categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView'}")
|
||||
if isProject:
|
||||
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
|
||||
else:
|
||||
clickItem(categoriesView, "Files and Classes." + category, 5, 5, 0, Qt.LeftButton)
|
||||
templatesView = waitForObject("{name='templatesView' type='QListView'}", 20000)
|
||||
templatesView = waitForObject("{name='templatesView' type='QListView'}")
|
||||
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
|
||||
text = waitForObject("{type='QTextBrowser' name='templateDescription' visible='1'}").plainText
|
||||
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
|
||||
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
|
||||
return __getSupportedPlatforms__(str(text))[0]
|
||||
|
||||
def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
|
||||
directoryEdit = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
|
||||
directoryEdit = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
|
||||
replaceEditorContent(directoryEdit, path)
|
||||
projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' "
|
||||
"type='Utils::ProjectNameValidatingLineEdit'}", 20000)
|
||||
"type='Utils::ProjectNameValidatingLineEdit'}")
|
||||
if projectName == None:
|
||||
projectName = projectNameEdit.text
|
||||
else:
|
||||
@@ -128,7 +128,7 @@ def __createProjectHandleLastPage__(expectedFiles = None):
|
||||
test.verify(index > lastIndex, "'" + filename + "' found at index " + str(index))
|
||||
lastIndex = index
|
||||
selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>")
|
||||
clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
|
||||
clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}"))
|
||||
|
||||
def __verifyFileCreation__(path, expectedFiles):
|
||||
for filename in expectedFiles:
|
||||
@@ -208,13 +208,13 @@ def createNewQtQuickApplication(workingDir, projectName = None, templateFile = N
|
||||
% qtQuickVersion, fromWelcome)
|
||||
projectName = __createProjectSetNameAndPath__(workingDir, projectName)
|
||||
if templateFile:
|
||||
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
|
||||
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
|
||||
type(baseLineEd, templateFile)
|
||||
nextButton = waitForObject(":Next_QPushButton", 20000)
|
||||
nextButton = waitForObject(":Next_QPushButton")
|
||||
clickButton(nextButton)
|
||||
__chooseTargets__(targets, available)
|
||||
snooze(1)
|
||||
nextButton = waitForObject(":Next_QPushButton", 20000)
|
||||
nextButton = waitForObject(":Next_QPushButton")
|
||||
clickButton(nextButton)
|
||||
__createProjectHandleLastPage__()
|
||||
return projectName
|
||||
@@ -236,10 +236,10 @@ def createNewQmlExtension(workingDir):
|
||||
nextButton = waitForObject(":Next_QPushButton")
|
||||
clickButton(nextButton)
|
||||
nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} "
|
||||
"type='QLineEdit' unnamed='1' visible='1'}", 20000)
|
||||
"type='QLineEdit' unnamed='1' visible='1'}")
|
||||
replaceEditorContent(nameLineEd, "TestItem")
|
||||
uriLineEd = waitForObject("{buddy={type='QLabel' text='URI:' unnamed='1' visible='1'} "
|
||||
"type='QLineEdit' unnamed='1' visible='1'}", 20000)
|
||||
"type='QLineEdit' unnamed='1' visible='1'}")
|
||||
replaceEditorContent(uriLineEd, "org.qt-project.test.qmlcomponents")
|
||||
clickButton(nextButton)
|
||||
__createProjectHandleLastPage__()
|
||||
@@ -247,7 +247,7 @@ def createNewQmlExtension(workingDir):
|
||||
# parameter components can only be one of the Constants defined in QtQuickConstants.Components
|
||||
def __chooseComponents__(components=QtQuickConstants.Components.BUILTIN):
|
||||
rbComponentToChoose = waitForObject("{type='QRadioButton' text='%s' visible='1'}"
|
||||
% QtQuickConstants.getStringForComponents(components), 20000)
|
||||
% QtQuickConstants.getStringForComponents(components))
|
||||
if rbComponentToChoose.checked:
|
||||
test.passes("Selected QRadioButton is '%s'" % QtQuickConstants.getStringForComponents(components))
|
||||
else:
|
||||
@@ -298,7 +298,7 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None
|
||||
overrideInstallLazySignalHandler()
|
||||
installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processStarted()", "__handleProcessStarted__")
|
||||
installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processExited(int)", "__handleProcessExited__")
|
||||
runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}", 20000)
|
||||
runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}")
|
||||
clickButton(runButton)
|
||||
if sType != SubprocessType.QT_QUICK_UI:
|
||||
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
|
||||
@@ -358,7 +358,7 @@ def __closeSubprocessByPushingStop__(sType):
|
||||
def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefType):
|
||||
global processExited
|
||||
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
|
||||
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
|
||||
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}")
|
||||
if port == None:
|
||||
test.warning("I need a port number or attaching might fail.")
|
||||
else:
|
||||
|
@@ -41,7 +41,7 @@ def prepareBuildSettings(targetCount, currentTarget, setReleaseBuild=True, disab
|
||||
else:
|
||||
chooseThis = "Debug"
|
||||
editBuildCfg = waitForObject("{leftWidget={text='Edit build configuration:' type='QLabel' "
|
||||
"unnamed='1' visible='1'} unnamed='1' type='QComboBox' visible='1'}", 20000)
|
||||
"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
|
||||
|
@@ -17,6 +17,7 @@ testSettings.logScreenshotOnError = True
|
||||
|
||||
source("../../shared/classes.py")
|
||||
source("../../shared/utils.py")
|
||||
source("../../shared/fs_utils.py")
|
||||
source("../../shared/build_utils.py")
|
||||
source("../../shared/project.py")
|
||||
source("../../shared/editor_utils.py")
|
||||
|
@@ -18,7 +18,7 @@ def deleteDirIfExists(path):
|
||||
shutil.rmtree(path, True)
|
||||
|
||||
def verifyChecked(objectName):
|
||||
object = waitForObject(objectName, 20000)
|
||||
object = waitForObject(objectName)
|
||||
test.compare(object.checked, True)
|
||||
return object
|
||||
|
||||
@@ -70,7 +70,7 @@ def selectFromLocator(filter, itemName = None):
|
||||
if itemName == None:
|
||||
itemName = filter
|
||||
itemName = itemName.replace(".", "\\.").replace("_", "\\_")
|
||||
locator = waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000)
|
||||
locator = waitForObject(":*Qt Creator_Utils::FilterLineEdit")
|
||||
mouseClick(locator, 5, 5, 0, Qt.LeftButton)
|
||||
replaceEditorContent(locator, filter)
|
||||
# clicking the wanted item
|
||||
@@ -196,7 +196,7 @@ def logApplicationOutput():
|
||||
# make sure application output is shown
|
||||
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
|
||||
try:
|
||||
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
|
||||
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}")
|
||||
test.log("Application Output:\n%s" % output.plainText)
|
||||
return str(output.plainText)
|
||||
except:
|
||||
|
@@ -13,16 +13,16 @@ def verifyBuildAndRun():
|
||||
re.search('[Ss]tarting.*', str(appOutput)),
|
||||
"Verifying if built app started and closed successfully.")
|
||||
|
||||
# pick version 4.7.4 and then run project for debug and release
|
||||
def pickVersion474runVerify():
|
||||
availableConfigs = iterateBuildConfigs(1, 0)
|
||||
# run project for debug and release
|
||||
def runVerify():
|
||||
availableConfigs = iterateBuildConfigs(1)
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found needed Qt version (Qt 4.7.4), quitting")
|
||||
test.fatal("Haven't found build configurations, quitting")
|
||||
invokeMenuItem("File", "Save All")
|
||||
invokeMenuItem("File", "Exit")
|
||||
# select debug configuration
|
||||
for config in availableConfigs:
|
||||
selectBuildConfig(1, 0, config)
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(1, kit, config)
|
||||
test.log("Using build config '%s'" % config)
|
||||
runAndCloseApp()
|
||||
verifyBuildAndRun()
|
||||
|
@@ -6,8 +6,7 @@ source("../shared/aptw.py")
|
||||
def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
createProject_Qt_GUI(tempDir(), "SampleApp")
|
||||
# pick version 4.7.4 and then run project for debug and release and verify results
|
||||
pickVersion474runVerify()
|
||||
#close Qt creator
|
||||
# run project for debug and release and verify results
|
||||
runVerify()
|
||||
#close Qt Creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
#no cleanup needed
|
||||
|
@@ -7,8 +7,7 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
|
||||
# pick version 4.7.4 and then run project for debug and release and verify results
|
||||
pickVersion474runVerify()
|
||||
#close Qt creator
|
||||
# run project for debug and release and verify results
|
||||
runVerify()
|
||||
#close Qt Creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
#no cleanup needed
|
||||
|
@@ -14,12 +14,12 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
# open example project
|
||||
openQmakeProject(examplePath)
|
||||
# build and wait until finished - on all (except Qt 4.7.0 (would fail)) build configurations
|
||||
availableConfigs = iterateBuildConfigs(1, 0)
|
||||
# build and wait until finished - on all build configurations
|
||||
availableConfigs = iterateBuildConfigs(1)
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (anything except Qt 4.7.0) - leaving without building.")
|
||||
for config in availableConfigs:
|
||||
selectBuildConfig(1, 0, config)
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(1, kit, config)
|
||||
# try to build project
|
||||
test.log("Testing build configuration: " + config)
|
||||
invokeMenuItem("Build", "Build All")
|
||||
|
@@ -6,12 +6,12 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
# create qt quick application
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# build it - on all (except Qt 4.7.0 (would fail)) build configurations
|
||||
availableConfigs = iterateBuildConfigs(1, 0)
|
||||
# build it - on all build configurations
|
||||
availableConfigs = iterateBuildConfigs(1)
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (anything except Qt 4.7.0) - leaving without building.")
|
||||
for config in availableConfigs:
|
||||
selectBuildConfig(1, 0, config)
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(1, kit, config)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
|
||||
|
@@ -16,12 +16,12 @@ def main():
|
||||
return
|
||||
# save all
|
||||
invokeMenuItem("File", "Save All")
|
||||
# build it - on all (except Qt 4.7.0 (would fail)) build configurations
|
||||
availableConfigs = iterateBuildConfigs(1, 0)
|
||||
# build it - on all build configurations
|
||||
availableConfigs = iterateBuildConfigs(1)
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (anything except Qt 4.7.0) - leaving without building.")
|
||||
for config in availableConfigs:
|
||||
selectBuildConfig(1, 0, config)
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(1, kit, config)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
|
||||
|
@@ -5,11 +5,11 @@ project = "SquishProject"
|
||||
def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
createProject_Qt_Console(tempDir(), project)
|
||||
availableConfigs = iterateBuildConfigs(1, 0)
|
||||
availableConfigs = iterateBuildConfigs(1)
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for config in availableConfigs:
|
||||
selectBuildConfig(1, 0, config)
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(1, kit, config)
|
||||
test.log("Testing build configuration: " + config)
|
||||
runAndCloseApp()
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
@@ -31,25 +31,24 @@ def main():
|
||||
# Rely on code completion for closing bracket
|
||||
invokeMenuItem("File", "Save All")
|
||||
selectFromLocator(project + ".pro")
|
||||
proEditor = waitForObject("{type='Qt4ProjectManager::Internal::ProFileEditorWidget' unnamed='1' visible='1'"
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
|
||||
proEditor = waitForObject(":Qt Creator_ProFileEditorWidget")
|
||||
test.verify("CONFIG += console" in str(proEditor.plainText), "Verifying that program is configured with console")
|
||||
setRunInTerminal(1, 0, False)
|
||||
|
||||
availableConfigs = iterateBuildConfigs(1, 0)
|
||||
availableConfigs = iterateBuildConfigs(1)
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
for config in availableConfigs:
|
||||
selectBuildConfig(1, 0, config)
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(1, kit, config)
|
||||
test.log("Testing build configuration: " + config)
|
||||
|
||||
test.log("Running application")
|
||||
runControlFinished = False
|
||||
clickButton(waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}", 20000))
|
||||
clickButton(waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}"))
|
||||
waitFor("runControlFinished==True", 20000)
|
||||
if not runControlFinished:
|
||||
test.warning("Waiting for runControlFinished timed out")
|
||||
appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}", 20000).plainText)
|
||||
appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}").plainText)
|
||||
verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output")
|
||||
verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output")
|
||||
verifyOutput(appOutput, outputQDebug, "qDebug()", "Application Output")
|
||||
@@ -79,7 +78,7 @@ def main():
|
||||
else:
|
||||
test.fatal("Debugger log did not behave as expected. Please check manually.")
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}", 20000).plainText)
|
||||
appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}").plainText)
|
||||
if not "MSVC" in config:
|
||||
verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output")
|
||||
verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output")
|
||||
|
@@ -33,13 +33,13 @@ def main():
|
||||
if result:
|
||||
expectedBreakpointsOrder = [{"main.cpp":10}, {"main.qml":13}]
|
||||
# Only use 4.7.4 to work around QTBUG-25187
|
||||
availableConfigs = iterateBuildConfigs(1, 0, "Debug")
|
||||
availableConfigs = iterateBuildConfigs(1, "Debug")
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (need Qt 4.7.4) - leaving without debugging.")
|
||||
for config in availableConfigs:
|
||||
for kit, config in availableConfigs:
|
||||
test.log("Selecting '%s' as build config" % config)
|
||||
selectBuildConfig(1, 0, config)
|
||||
verifyBuildConfig(1, 0, True, enableQmlDebug=True)
|
||||
selectBuildConfig(1, kit, config)
|
||||
verifyBuildConfig(1, kit, True, enableQmlDebug=True)
|
||||
# explicitly build before start debugging for adding the executable as allowed program to WinFW
|
||||
invokeMenuItem("Build", "Rebuild All")
|
||||
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}",
|
||||
|
@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
|
||||
IMPLICITAUTSTART=0
|
||||
LANGUAGE=Python
|
||||
OBJECTMAP=../objects.map
|
||||
TEST_CASES=tst_memberoperator tst_rename_macros tst_basic_cpp_support tst_select_all tst_qml_indent tst_qml_editor
|
||||
TEST_CASES=tst_basic_cpp_support tst_delete_externally tst_memberoperator tst_modify_readonly tst_qml_editor tst_qml_indent tst_rename_macros tst_revert_changes tst_select_all
|
||||
VERSION=2
|
||||
WRAPPERS=Qt
|
||||
|
58
tests/system/suite_editors/tst_delete_externally/test.py
Normal file
58
tests/system/suite_editors/tst_delete_externally/test.py
Normal file
@@ -0,0 +1,58 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
source("../../shared/suites_qtta.py")
|
||||
|
||||
global templateDir
|
||||
|
||||
def readFile(filename):
|
||||
f = open(filename, "r")
|
||||
content = f.read()
|
||||
f.close()
|
||||
return content
|
||||
|
||||
def copyToTemplateDir(filepath):
|
||||
global templateDir
|
||||
dst = os.path.join(templateDir, os.path.basename(filepath))
|
||||
shutil.copyfile(filepath, dst)
|
||||
return dst
|
||||
|
||||
def main():
|
||||
global templateDir
|
||||
files = map(lambda record: os.path.normpath(os.path.join(srcPath, testData.field(record, "filename"))),
|
||||
testData.dataset("files.tsv"))
|
||||
for currentFile in files:
|
||||
if not neededFilePresent(currentFile):
|
||||
return
|
||||
templateDir = tempDir()
|
||||
files = map(copyToTemplateDir, files)
|
||||
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
for currentFile in files:
|
||||
test.log("Opening file %s" % currentFile)
|
||||
invokeMenuItem("File", "Open File or Project...")
|
||||
selectFromFileDialog(currentFile)
|
||||
editor = getEditorForFileSuffix(currentFile)
|
||||
if editor == None:
|
||||
test.fatal("Could not get the editor for '%s'" % currentFile,
|
||||
"Skipping this file for now.")
|
||||
continue
|
||||
|
||||
contentBefore = readFile(currentFile)
|
||||
popupText = "The file %s was removed. Do you want to save it under a different name, or close the editor?"
|
||||
os.remove(currentFile)
|
||||
test.compare(waitForObject(":File has been removed_QMessageBox").text,
|
||||
popupText % currentFile)
|
||||
clickButton(waitForObject(":File has been removed.Save_QPushButton"))
|
||||
waitFor("os.path.exists(currentFile)", 5000)
|
||||
# avoids a lock-up on some Linux machines, purely empiric, might have different cause
|
||||
waitFor("checkIfObjectExists(':File has been removed_QMessageBox', False, 0)", 5000)
|
||||
|
||||
test.compare(readFile(currentFile), contentBefore,
|
||||
"Verifying that file '%s' was restored correctly" % currentFile)
|
||||
|
||||
# Different warning because of QTCREATORBUG-8130
|
||||
popupText2 = "The file %s has been removed outside Qt Creator. Do you want to save it under a different name, or close the editor?"
|
||||
os.remove(currentFile)
|
||||
test.compare(waitForObject(":File has been removed_QMessageBox").text,
|
||||
popupText2 % currentFile)
|
||||
clickButton(waitForObject(":File has been removed.Close_QPushButton"))
|
||||
invokeMenuItem("File", "Exit")
|
136
tests/system/suite_editors/tst_modify_readonly/test.py
Normal file
136
tests/system/suite_editors/tst_modify_readonly/test.py
Normal file
@@ -0,0 +1,136 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
|
||||
def main():
|
||||
global testFolder
|
||||
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
|
||||
proEditorStr = ":Qt Creator_ProFileEditorWidget"
|
||||
testFolder = prepareTemplate(os.path.abspath(os.path.join(os.getcwd(), "..", "shared",
|
||||
"simplePlainCPP")))
|
||||
if testFolder == None:
|
||||
test.fatal("Could not prepare test files - leaving test")
|
||||
return
|
||||
if not changeFilePermissions(testFolder, True, False, "testfiles.pro"):
|
||||
test.fatal("Could not set permissions for files to read-only - test will likely fail.")
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
openQmakeProject(os.path.join(testFolder, "testfiles.pro"))
|
||||
modifiedUnsaved = []
|
||||
readOnlyFiles = []
|
||||
currentFile = testModifyFile("testfiles.Sources.main\\.cpp", cppEditorStr, "{", True)
|
||||
modifiedUnsaved.append(currentFile)
|
||||
readOnlyFiles.append(currentFile)
|
||||
currentFile = testModifyFile("testfiles.testfiles\\.pro", proEditorStr, "CONFIG -= qt", False)
|
||||
modifiedUnsaved.append(currentFile)
|
||||
currentFile = testModifyFile("testfiles.Headers.testfile\\.h", cppEditorStr, "{", True)
|
||||
modifiedUnsaved.append(currentFile)
|
||||
readOnlyFiles.append(currentFile)
|
||||
invokeMenuItem("File", "Exit")
|
||||
testSaveChangesAndMakeWritable(modifiedUnsaved, readOnlyFiles)
|
||||
|
||||
def testModifyFile(fileName, editor, line, expectWarning):
|
||||
readOnlyWarningStr = ("{text='<b>Warning:</b> You are changing a read-only file.' type='QLabel'"
|
||||
" unnamed='1' window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
simpleFName = simpleFileName(fileName)
|
||||
test.log("Opening file '%s'" % simpleFName)
|
||||
openDocument(fileName)
|
||||
fileNameCombo = waitForObject(":Qt Creator_FilenameQComboBox")
|
||||
test.compare(str(fileNameCombo.currentText), simpleFName,
|
||||
"Verifying content of file name combo box.")
|
||||
checkOpenDocumentsContains(simpleFName)
|
||||
if not placeCursorToLine(editor, line):
|
||||
return
|
||||
type(editor, "<Return>")
|
||||
try:
|
||||
waitForObject(readOnlyWarningStr, 3000)
|
||||
if expectWarning:
|
||||
test.passes("Warning about changing a read-only file appeared.")
|
||||
else:
|
||||
test.fail("Warning about changing a read-only file appeared, although changing "
|
||||
"a writable file. (%s)" % simpleFName)
|
||||
except:
|
||||
if expectWarning:
|
||||
test.fail("Warning about changing a read-only file missing. (%s)" % simpleFName)
|
||||
else:
|
||||
test.passes("Warning about changing a read-only file does not come up "
|
||||
"(changing a writable file).")
|
||||
test.compare(str(fileNameCombo.currentText), "%s*" % simpleFName,
|
||||
"Verifying content of file name combo box.")
|
||||
return checkOpenDocumentsContains("%s*" % simpleFName)
|
||||
|
||||
def testSaveChangesAndMakeWritable(modifiedFiles, readOnlyFiles):
|
||||
saveDlgStr = ("{name='Core__Internal__SaveItemsDialog' type='Core::Internal::SaveItemsDialog' "
|
||||
"visible='1' windowTitle='Save Changes'}")
|
||||
readOnlyMBoxStr = ("{type='QMessageBox' unnamed='1' visible='1' text~='The file <i>.+</i> "
|
||||
"is read only\.'}")
|
||||
cannotResetStr = ("{text='Cannot set permissions to writable.' type='QMessageBox' "
|
||||
"unnamed='1' visible='1'}")
|
||||
filePattern = re.compile('The file <i>(.+)</i> is read only\.')
|
||||
try:
|
||||
waitForObject(saveDlgStr)
|
||||
except:
|
||||
test.fail("Save Changes dialog did not come up, but was expected to appear.")
|
||||
return
|
||||
treeWidget = waitForObject("{name='treeWidget' type='QTreeWidget' visible='1' window=%s}"
|
||||
% saveDlgStr)
|
||||
checkUnsavedChangesContains(treeWidget.model(), modifiedFiles)
|
||||
clickButton(waitForObject("{text='Save All' type='QPushButton' unnamed='1' visible='1' "
|
||||
"window=%s}" % saveDlgStr))
|
||||
# iterating over the readOnlyFiles (order is unpredictable)
|
||||
for i in range(len(readOnlyFiles)):
|
||||
try:
|
||||
currentText = str(waitForObject(readOnlyMBoxStr, 3000).text)
|
||||
currentFile = filePattern.match(currentText).group(1)
|
||||
clickButton(waitForObject("{text='Make Writable' type='QPushButton' unnamed='1' "
|
||||
"visible='1' window=%s}" % readOnlyMBoxStr))
|
||||
try:
|
||||
waitForObject(cannotResetStr, 3000)
|
||||
# should not be possible
|
||||
test.fail("Could not reset file '%s' to writable state." % currentFile)
|
||||
clickButton("{text='OK' type='QPushButton' window=%s}" % cannotResetStr)
|
||||
except:
|
||||
if isWritable(currentFile):
|
||||
test.passes("File '%s' resetted to writable state and saved." % currentFile)
|
||||
if currentFile in readOnlyFiles:
|
||||
readOnlyFiles.remove(currentFile)
|
||||
else:
|
||||
test.fatal("Creator states file '%s' is read-only - but supposed to be "
|
||||
"writable." % currentFile)
|
||||
else:
|
||||
test.fail("Creator states file '%s' had been made writable - "
|
||||
"but it's still read only." % currentFile)
|
||||
except:
|
||||
test.fail("Missing QMessageBox about a read only file.")
|
||||
if not test.verify(len(readOnlyFiles) == 0,
|
||||
"Checking whether all files have been handled correctly."):
|
||||
try:
|
||||
invokeMenuItem("File", "Exit")
|
||||
waitForObject(saveDlgStr)
|
||||
clickButton(waitForObject("{text='Do not Save' type='QPushButton' unnamed='1' "
|
||||
"visible='1' window=%s}" % saveDlgStr))
|
||||
except:
|
||||
pass
|
||||
|
||||
def checkOpenDocumentsContains(itemName):
|
||||
openDocsTreeViewModel = waitForObject(":OpenDocuments_QTreeView").model()
|
||||
result = None
|
||||
found = False
|
||||
for index in dumpIndices(openDocsTreeViewModel):
|
||||
if str(index.data()) == itemName:
|
||||
found = True
|
||||
result = index.toolTip
|
||||
break
|
||||
test.verify(found, "Check whether 'Open Documents' contains '%s'" % itemName)
|
||||
return result
|
||||
|
||||
def checkUnsavedChangesContains(model, filePaths):
|
||||
foundItems = map(lambda x: os.path.join(x[0], x[1]), zip(dumpItems(model,column=1),
|
||||
dumpItems(model, column=0)))
|
||||
test.compare(set(foundItems), set(filePaths),
|
||||
"Verifying whether modified (unsaved) files do match expected.")
|
||||
|
||||
def simpleFileName(navigatorFileName):
|
||||
return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","")
|
||||
|
||||
def cleanup():
|
||||
global testFolder
|
||||
if testFolder:
|
||||
changeFilePermissions(testFolder, True, True, "testfiles.pro")
|
@@ -31,11 +31,11 @@ def testRenameId():
|
||||
global searchFinished
|
||||
test.log("Testing rename of id")
|
||||
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
model = navTree.model()
|
||||
files = ["Core.ContextMenu\\.qml", "Core.GridMenu\\.qml", "Core.ListMenu\\.qml", "focus\\.qml"]
|
||||
originalTexts = {}
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
# temporarily store editor content for synchronizing purpose
|
||||
# usage of formerTxt is done because I couldn't get waitForSignal() to work
|
||||
# it always stored a different object into the signalObjects map as it looked up afterwards
|
||||
@@ -45,7 +45,7 @@ def testRenameId():
|
||||
doubleClickFile(navTree, file)
|
||||
# wait until editor content switched to the double-clicked file
|
||||
while formerTxt==editor.plainText:
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
# store content for next round
|
||||
formerTxt = editor.plainText
|
||||
originalTexts.setdefault(file, "%s" % formerTxt)
|
||||
@@ -71,7 +71,7 @@ def testRenameId():
|
||||
doubleClickFile(navTree, file)
|
||||
# wait until editor content switched to double-clicked file
|
||||
while formerTxt==editor.plainText:
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
# store content for next round
|
||||
formerTxt = editor.plainText
|
||||
originalText = originalTexts.get(file).replace("mainView", "renamedView")
|
||||
@@ -81,7 +81,7 @@ def testRenameId():
|
||||
def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount):
|
||||
global searchFinished
|
||||
doubleClickFile(treeView, filename)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
if not placeCursorToLine(editor, line, True):
|
||||
test.fatal("File seems to have changed... Canceling current test")
|
||||
return
|
||||
@@ -95,7 +95,7 @@ def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expected
|
||||
def testFindUsages():
|
||||
test.log("Testing find usage of an ID")
|
||||
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
__invokeFindUsage__(navTree, "focus\\.qml", "FocusScope\s*\{", ["<Down>"], 6)
|
||||
test.log("Testing find usage of a property")
|
||||
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
|
||||
@@ -106,10 +106,10 @@ def testFindUsages():
|
||||
|
||||
def testHovering():
|
||||
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
test.log("Testing hovering elements")
|
||||
doubleClickFile(navTree, "focus\\.qml")
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
lines=["FocusScope\s*\{", "Rectangle\s*\{"]
|
||||
if platform.system() == "Darwin":
|
||||
home = "<Ctrl+Left>"
|
||||
@@ -127,7 +127,7 @@ def testHovering():
|
||||
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
|
||||
test.log("Testing hovering properties")
|
||||
doubleClickFile(navTree, "focus\\.qml")
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{']
|
||||
expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"]
|
||||
expectedValues = [
|
||||
@@ -147,14 +147,14 @@ def testHovering():
|
||||
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
|
||||
test.log("Testing hovering expressions")
|
||||
doubleClickFile(navTree, "focus\\.qml")
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
lines=['color:\s*"black"', 'color:\s*"#3E606F"']
|
||||
additionalKeyPresses = ["<Left>"]
|
||||
expectedValues = ["black", "#3E606F"]
|
||||
expectedTypes = ["ColorTip", "ColorTip"]
|
||||
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues)
|
||||
doubleClickFile(navTree, "Core.ListMenu\\.qml")
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}']
|
||||
additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"]
|
||||
expectedTypes = ["ColorTip", "TextTip"]
|
||||
|
@@ -19,11 +19,11 @@ def main():
|
||||
def prepareQmlFile():
|
||||
# make sure the QML file is opened
|
||||
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
model = navTree.model()
|
||||
waitForObjectItem(navTree, "untitled.QML.qml/untitled.main\\.qml")
|
||||
doubleClickItem(navTree, "untitled.QML.qml/untitled.main\\.qml", 5, 5, 0, Qt.LeftButton)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
for i in range(3):
|
||||
content = "%s" % editor.plainText
|
||||
start = content.find("Text {")
|
||||
|
114
tests/system/suite_editors/tst_revert_changes/test.py
Normal file
114
tests/system/suite_editors/tst_revert_changes/test.py
Normal file
@@ -0,0 +1,114 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
import __builtin__
|
||||
|
||||
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
|
||||
originalSources = os.path.abspath(os.path.join(os.getcwd(), "..", "shared", "simplePlainCPP"))
|
||||
|
||||
def init():
|
||||
global homeShortCut, endShortCut
|
||||
if platform.system() == "Darwin":
|
||||
homeShortCut = "<Ctrl+Left>"
|
||||
endShortCut = "<End>"
|
||||
else:
|
||||
homeShortCut = "<Home>"
|
||||
endShortCut = "<Ctrl+End>"
|
||||
|
||||
def main():
|
||||
global cppEditorStr
|
||||
folder = prepareTemplate(originalSources)
|
||||
if folder == None:
|
||||
test.fatal("Could not prepare test files - leaving test")
|
||||
return
|
||||
proFile = os.path.join(folder, "testfiles.pro")
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
openQmakeProject(proFile)
|
||||
fileModifications = {"testfiles.testfiles\\.pro":__modifyProFile__,
|
||||
"testfiles.Headers.testfile\\.h":__modifyHeader__,
|
||||
"testfiles.Sources.testfile\\.cpp":__modifySource__,
|
||||
"testfiles.Sources.main\\.cpp":None}
|
||||
for fileName, modification in fileModifications.iteritems():
|
||||
__modifyFile__(fileName, modification)
|
||||
test.log("Reverting all files...")
|
||||
fileModifications = dict(zip(fileModifications.keys(),
|
||||
(__builtin__.bool(v) for v in fileModifications.values())))
|
||||
revertChanges(fileModifications)
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
||||
def __modifyFile__(fileName, modificationFunc):
|
||||
simpleFName = simpleFileName(fileName)
|
||||
test.log("Opening file '%s'" % simpleFName)
|
||||
openDocument(fileName)
|
||||
if modificationFunc:
|
||||
test.log("Modifying file '%s'" % simpleFName)
|
||||
modificationFunc()
|
||||
else:
|
||||
test.log("Leaving file '%s' unmodified." % simpleFName)
|
||||
|
||||
# add some stuff to pro file
|
||||
def __modifyProFile__():
|
||||
proEditorStr = ":Qt Creator_ProFileEditorWidget"
|
||||
addConfig = ["", "CONFIG += thread", "",
|
||||
"lessThan(QT_VER_MAJ, 4) | lessThan(QT_VER_MIN, 7) {",
|
||||
" error(Qt 4.7 or newer is required but version $$[QT_VERSION] was detected.)",
|
||||
"}"]
|
||||
addFile = [" \\", " not_existing.cpp"]
|
||||
if placeCursorToLine(proEditorStr, "CONFIG -= qt"):
|
||||
typeLines(proEditorStr, addConfig)
|
||||
if placeCursorToLine(proEditorStr, "testfile.cpp"):
|
||||
typeLines(proEditorStr, addFile)
|
||||
|
||||
# re-order some stuff inside header
|
||||
def __modifyHeader__():
|
||||
global cppEditorStr, homeShortCut, endShortCut
|
||||
if placeCursorToLine(cppEditorStr, "class.+", True):
|
||||
type(cppEditorStr, homeShortCut)
|
||||
for i in range(5):
|
||||
type(cppEditorStr, "<Shift+Down>")
|
||||
invokeMenuItem("Edit", "Cut")
|
||||
type(cppEditorStr, endShortCut)
|
||||
type(cppEditorStr, "<Return>")
|
||||
invokeMenuItem("Edit", "Paste")
|
||||
|
||||
# remove some stuff from source
|
||||
def __modifySource__():
|
||||
global cppEditorStr, homeShortCut
|
||||
if placeCursorToLine(cppEditorStr, "void function1(int a);"):
|
||||
type(cppEditorStr, homeShortCut)
|
||||
type(cppEditorStr, "<Shift+Down>")
|
||||
type(cppEditorStr, "<Delete>")
|
||||
if placeCursorToLine(cppEditorStr, "bool function1(int a) {"):
|
||||
type(cppEditorStr, homeShortCut)
|
||||
for i in range(4):
|
||||
type(cppEditorStr, "<Shift+Down>")
|
||||
type(cppEditorStr, "<Delete>")
|
||||
|
||||
def revertChanges(files):
|
||||
for f,canRevert in files.iteritems():
|
||||
simpleName = simpleFileName(f)
|
||||
test.log("Trying to revert changes for '%s'" % simpleName)
|
||||
if openDocument(f):
|
||||
fileMenu = findObject("{name='QtCreator.Menu.File' title='File' type='QMenu' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
for menuItem in object.children(fileMenu):
|
||||
if str(menuItem.text) == 'Revert "%s" to Saved' % simpleName:
|
||||
if (test.compare(canRevert, menuItem.enabled, "Verifying whether MenuItem "
|
||||
"'Revert to Saved' has expected state (%s)"
|
||||
% str(canRevert)) and canRevert):
|
||||
invokeMenuItem('File', 'Revert "%s" to Saved' % simpleName)
|
||||
clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
|
||||
compareFileToOriginal(simpleName)
|
||||
test.log("Reverted changes inside %s" % simpleName)
|
||||
else:
|
||||
test.fail("Could not open %s for reverting changes" % simpleName)
|
||||
|
||||
def compareFileToOriginal(fileName):
|
||||
global originalSources
|
||||
currentContent = str(waitForObject(getEditorForFileSuffix(fileName)).plainText)
|
||||
origFile = open(os.path.join(originalSources, fileName), "r")
|
||||
originalContent = origFile.read()
|
||||
origFile.close()
|
||||
test.compare(originalContent, currentContent,
|
||||
"Comparing original to reverted file content for '%s'" % fileName)
|
||||
|
||||
def simpleFileName(navigatorFileName):
|
||||
return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","")
|
@@ -20,11 +20,11 @@ def main():
|
||||
|
||||
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
|
||||
|
||||
availableConfigs = iterateBuildConfigs(1, 0, "Release")
|
||||
availableConfigs = iterateBuildConfigs(1, "Release")
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.")
|
||||
for config in availableConfigs:
|
||||
selectBuildConfig(1, 0, config)
|
||||
for kit, config in availableConfigs:
|
||||
selectBuildConfig(1, kit, config)
|
||||
buildConfig = buildConfigFromFancyToolButton(fancyToolButton)
|
||||
if buildConfig != config:
|
||||
test.fatal("Build configuration %s is selected instead of %s" % (buildConfig, config))
|
||||
|
@@ -17,7 +17,7 @@ def main():
|
||||
test.log("Collecting potential project types...")
|
||||
availableProjectTypes = []
|
||||
invokeMenuItem("File", "New File or Project...")
|
||||
categoriesView = waitForObject(":New.templateCategoryView_QTreeView", 20000)
|
||||
categoriesView = waitForObject(":New.templateCategoryView_QTreeView")
|
||||
catModel = categoriesView.model()
|
||||
projects = catModel.index(0, 0)
|
||||
test.compare("Projects", str(projects.data()))
|
||||
@@ -29,7 +29,7 @@ def main():
|
||||
if "Import" in category or "Non-Qt" in category:
|
||||
continue
|
||||
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
|
||||
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}", 20000)
|
||||
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}")
|
||||
# needed because categoriesView and templatesView using same model
|
||||
for template in dumpItems(templatesView.model(), templatesView.rootIndex()):
|
||||
template = template.replace(".", "\\.")
|
||||
@@ -37,21 +37,21 @@ def main():
|
||||
if "Qt Quick UI" in template or "Plain C" in template:
|
||||
continue
|
||||
availableProjectTypes.append({category:template})
|
||||
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}", 20000))
|
||||
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}"))
|
||||
for current in availableProjectTypes:
|
||||
category = current.keys()[0]
|
||||
template = current.values()[0]
|
||||
invokeMenuItem("File", "New File or Project...")
|
||||
categoriesView = waitForObject(":New.templateCategoryView_QTreeView", 20000)
|
||||
categoriesView = waitForObject(":New.templateCategoryView_QTreeView")
|
||||
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
|
||||
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}", 20000)
|
||||
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}")
|
||||
test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", ".")))
|
||||
textChanged = False
|
||||
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
|
||||
waitFor("textChanged", 2000)
|
||||
text = waitForObject(":frame.templateDescription_QTextBrowser").plainText
|
||||
displayedPlatforms, requiredVersion = __getSupportedPlatforms__(str(text), True)
|
||||
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
|
||||
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
|
||||
# don't check because project could exist
|
||||
__createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False)
|
||||
try:
|
||||
@@ -60,7 +60,7 @@ def main():
|
||||
except LookupError:
|
||||
try:
|
||||
waitForObject("{text='Select Existing QML file' type='QLabel' visible='1'}", 1000)
|
||||
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
|
||||
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
|
||||
type(baseLineEd, os.path.join(templateDir, qmlFile))
|
||||
clickButton(waitForObject(":Next_QPushButton"))
|
||||
except LookupError:
|
||||
|
Reference in New Issue
Block a user