diff --git a/doc/src/projects/creator-projects-creating.qdoc b/doc/src/projects/creator-projects-creating.qdoc index a676926838bab7ac5efae83f84a3756fc95746b2..e9bad3733986723cf49cdf8f1e9382ffb7db71dd 100644 --- a/doc/src/projects/creator-projects-creating.qdoc +++ b/doc/src/projects/creator-projects-creating.qdoc @@ -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}. diff --git a/qtcreator.pri b/qtcreator.pri index 44366628c2fc35cc9239c060038468661780c0d3..6641479319aad67cd6ed06a782222be937cfdcd1 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -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) { diff --git a/share/qtcreator/translations/qtcreator_pl.ts b/share/qtcreator/translations/qtcreator_pl.ts index 83e0fd7586b04c2d34836ceed4321a05b7d7fff5..eb00ebec4a99010ccdf732448bb76e7995fe2f6a 100644 --- a/share/qtcreator/translations/qtcreator_pl.ts +++ b/share/qtcreator/translations/qtcreator_pl.ts @@ -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> diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h index ef591a3793123ad2e1d0df404a242c37d11acc6a..d14bd33403723f36be5cb6d0f4771e45a6ab3d58 100644 --- a/src/libs/cplusplus/LookupContext.h +++ b/src/libs/cplusplus/LookupContext.h @@ -71,7 +71,7 @@ public: void clear(const T *item) { - if (_class != item) + if (_class != item || _container.size() == 1) _container.clear(); } diff --git a/src/plugins/autotoolsprojectmanager/makefileparser.cpp b/src/plugins/autotoolsprojectmanager/makefileparser.cpp index 570db855dd985a16ef739eab0f83617783e2946f..6ddeec0ed4ea3ee17a776706a851a3da0d0608ad 100644 --- a/src/plugins/autotoolsprojectmanager/makefileparser.cpp +++ b/src/plugins/autotoolsprojectmanager/makefileparser.cpp @@ -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()); diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 1ddb1f656027f3daa3faef6d8e101ec61d1c87df..7ff68eca929ef4c2080ede70055b9e5ea14ec7a0 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -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); diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 2ac44c51881da5c68a0b08972185e65ecb436877..1aff3a94b937b6c895907c85e2d2b70bc57fe3f1 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -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; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index e4faf2ff737203a2514e1ac73320c85ad4da1f27..b1377ac45441775eacfa93efd9d05c6c549d63a2 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -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 diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index cb1c86e472f57d2aff42571153157d517ef77b42..c2274c5e68369bb9ffd00639ddb9b84ff13aec07 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -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() diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 61747141ed12215001bf0322a9046985da0b506b..6facdc93a087cf0fd411962b406d9d06ee9e91c4 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -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); } diff --git a/src/plugins/qmldesigner/components/pluginmanager/iplugin.h b/src/plugins/qmldesigner/components/pluginmanager/iplugin.h index fef22b3b156d2be70ef28eb50c1b0b5009a08acf..23b41286f9e9f5a48e2a0e7dc70447e640394c90 100644 --- a/src/plugins/qmldesigner/components/pluginmanager/iplugin.h +++ b/src/plugins/qmldesigner/components/pluginmanager/iplugin.h @@ -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 { diff --git a/src/plugins/qmldesigner/designercore/include/iwidgetplugin.h b/src/plugins/qmldesigner/designercore/include/iwidgetplugin.h index 40af36daf957f937c4ac4243abcf2831044863f7..6cfbfbcfae4ae85ac8d99ff718f3455dfbc08471 100644 --- a/src/plugins/qmldesigner/designercore/include/iwidgetplugin.h +++ b/src/plugins/qmldesigner/designercore/include/iwidgetplugin.h @@ -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 { diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 3f6297d94071b6dcde235291261e2bf9526be104..6159673f21be2ecb03b1116c9d0490d2ab05600a 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -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); + 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); + } + break; } - break; } + f2.close(); } - 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++")); + } 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++")); + } } - //resolve mkspec link - mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath()); + break; } - break; } + f2.close(); } - f2.close(); } - break; - } - default: - mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath()); - break; + if (!qt5) { + //resolve mkspec link + QString rspec = mkspecFullPath.toFileInfo().readLink(); + if (!rspec.isEmpty()) + mkspecFullPath = FileName::fromUserInput( + QDir(baseMkspecDir.toString()).absoluteFilePath(rspec)); + } } - return mkspecFullPath; } diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 6e3b995f859232c9c6fce00a48596bb1bd53d26c..6f2fcca56c181bac4b30d6eb07314ac594db1383 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -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 diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 663be73f582cb637e5aba679224d9303807ea8b0..2a44bdd441b9801599bbdbd4d4bae2ba82df0612 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -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)) { diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index 2fa84ac05c3b22c20fbd1fe8b3aeb32cd9657350..6ac7db9c286e8b497657706c2debf2d167f06252 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -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; diff --git a/src/shared/proparser/qmakeglobals.cpp b/src/shared/proparser/qmakeglobals.cpp index 48acb84a3a9805d64ba31285075277c57e9d272f..1d5bd98fa6086efc7de2bb24f04d6c63529199eb 100644 --- a/src/shared/proparser/qmakeglobals.cpp +++ b/src/shared/proparser/qmakeglobals.cpp @@ -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 diff --git a/src/tools/gen-cpp-ast/generate-ast.cpp b/src/tools/gen-cpp-ast/generate-ast.cpp index 33b3c8c31afaa3ea3a485f5e78a8ba9c3f1a20db..34d83b7326c06c9d3722ce2cc09b4b4b53a150a4 100644 --- a/src/tools/gen-cpp-ast/generate-ast.cpp +++ b/src/tools/gen-cpp-ast/generate-ast.cpp @@ -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(); diff --git a/tests/auto/cplusplus/cxx11/cxx11.pro b/tests/auto/cplusplus/cxx11/cxx11.pro index d850d9bc1468811ac751c09ed2b539d6ea97566b..410965df4ecb7427197f7509ee132aee86a501ef 100644 --- a/tests/auto/cplusplus/cxx11/cxx11.pro +++ b/tests/auto/cplusplus/cxx11/cxx11.pro @@ -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 += \ diff --git a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp index b93d297953475a5472b72260916668778ebfaee2..7f87a4e170b63505913b2e59cc0a4aaf33db65b7 100644 --- a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp +++ b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp @@ -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('/'); diff --git a/tests/auto/cplusplus/preprocessor/preprocessor.pro b/tests/auto/cplusplus/preprocessor/preprocessor.pro index 05c463833aa78b7b2d3a27c2b176eb83ba166d4c..cee378663ac8814814fbbe36f7a4c75573f6ab0b 100644 --- a/tests/auto/cplusplus/preprocessor/preprocessor.pro +++ b/tests/auto/cplusplus/preprocessor/preprocessor.pro @@ -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 \ diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp index 9b49ba45ef3d46324f1776ac59de1aa89d69e22d..945d0825f5a02b547c39f652d19ecf08fb714205 100644 --- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp +++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.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; diff --git a/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro b/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro index 6a74a83c60976a45012a364e554cb268271e4756..b7184762b83b2c795796bc93e9c73515ee2fcc8e 100644 --- a/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro +++ b/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro @@ -1,6 +1,6 @@ include(../../../../../qtcreator.pri) #include(../../../../../src/plugins/qmldesigner/config.pri) -QT += $$QTESTLIB +QT += testlib CONFIG += testcase ##DEFINES += DONT_MESS_WITH_QDEBUG diff --git a/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro b/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro index f6fcad741b9f4a9a89bf7b48723f00120bfa8ac9..323ae839135b492ac8f5674ab64ad55e775d064e 100644 --- a/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro +++ b/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro @@ -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 diff --git a/tests/auto/qml/qmleditor/qmllookup/qmllookup.pro b/tests/auto/qml/qmleditor/qmllookup/qmllookup.pro index 30e580f8eee4735b452247d82b3704282c6093c9..c80b437af3f81d7aa3809ae47506111ebf9a453f 100644 --- a/tests/auto/qml/qmleditor/qmllookup/qmllookup.pro +++ b/tests/auto/qml/qmleditor/qmllookup/qmllookup.pro @@ -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 diff --git a/tests/auto/qttest.pri b/tests/auto/qttest.pri index 6e261b6ba01847c2b5919711dda61165cd742dc1..cc4ce6888cdda3aa412f97c1d31bd1bd79622c2a 100644 --- a/tests/auto/qttest.pri +++ b/tests/auto/qttest.pri @@ -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 diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 2afda8d0b4222a2fe8dbb18f7169c4b1c6da87ee..0e0d274e05a49986bd926da0cb1153692483f7ce 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -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 diff --git a/tests/system/README b/tests/system/README index 972f8e2a8424eae511e80e9690216dced9c7c0f5..ee40f37201639b8d4b3898df7297089c7e383be0 100644 --- a/tests/system/README +++ b/tests/system/README @@ -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) diff --git a/tests/system/objects.map b/tests/system/objects.map index 98896e6c4f837a49fef3a5a65c6dedf064eb5202..63b11bbb742d938c78a80466ca918107b16d4f92 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -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'} diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index 1f5f5f43f8c4d3d3d243c5f3e0f7b7162d629b3a..370381b2bee0a25e92aa4b3f6f3f07f0644d85b2 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -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 diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index f58056cf90129a609a73af80144b4225e61447d3..fbb018aa621ab9375bc2f7ec4d957ff6fb4ac1e1 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -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__() diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index 7f96fc189b0c64a8895d046b51aa26a9d38812ec..7200725346d0d166ce873d27b1b8c6acd5d04821 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -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'}") diff --git a/tests/system/shared/fs_utils.py b/tests/system/shared/fs_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..b261860a017769d0bdc2ecfa84c5e30356bf514e --- /dev/null +++ b/tests/system/shared/fs_utils.py @@ -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 diff --git a/tests/system/shared/hook_utils.py b/tests/system/shared/hook_utils.py index 9db0b84d26c7176074e14070d4de619aa3120895..96509e23ce59ee6c942b30894905dce4b9bc3e7d 100644 --- a/tests/system/shared/hook_utils.py +++ b/tests/system/shared/hook_utils.py @@ -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): diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 264921eb3f9b1d73c8521b3460547c018ad19072..99a10f0248026fdf37022f66ee048c68d50ea8ab 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -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: diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 7bbb426a4a740a4fc1d34c468c89a952d5e9bb0e..215093a7844c96fc59a1a23846d07316fb069288 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -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 diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index e48fe4ad372687a3d11e08b6948430051416f89e..66324cc7af985b2bc30043c082cbce0df3ac8aea 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -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") diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 28f7795160dc8c43336ddc4a71821a6eed48acc0..4b4955ee00a26b28a15ec505f1a23baa9b5657c6 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/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: diff --git a/tests/system/suite_APTW/shared/aptw.py b/tests/system/suite_APTW/shared/aptw.py index fbffbfe30aff76250d83d6d8ecd4e182c981055d..94497fcac423ed8f4365d8d5f88d0061b6724e9c 100755 --- a/tests/system/suite_APTW/shared/aptw.py +++ b/tests/system/suite_APTW/shared/aptw.py @@ -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() diff --git a/tests/system/suite_APTW/tst_APTW01/test.py b/tests/system/suite_APTW/tst_APTW01/test.py index f569699e314df1c8074c48d79b77b7e60261101e..9b6dc46ad91f7129b8556af2379ecdddf307489b 100644 --- a/tests/system/suite_APTW/tst_APTW01/test.py +++ b/tests/system/suite_APTW/tst_APTW01/test.py @@ -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 diff --git a/tests/system/suite_APTW/tst_APTW02/test.py b/tests/system/suite_APTW/tst_APTW02/test.py index d9711ba590bb68eb8ff8113c44f43be885e63fa1..f71de88caccb3342dd9b97b71efa59d86b695dbb 100644 --- a/tests/system/suite_APTW/tst_APTW02/test.py +++ b/tests/system/suite_APTW/tst_APTW02/test.py @@ -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 diff --git a/tests/system/suite_CCOM/tst_CCOM01/test.py b/tests/system/suite_CCOM/tst_CCOM01/test.py index 95a7cb497b9c3268c043796495accfd13238e7cd..1968b5d7219d2924ca2dc7baa3a1c7f44473b6ae 100755 --- a/tests/system/suite_CCOM/tst_CCOM01/test.py +++ b/tests/system/suite_CCOM/tst_CCOM01/test.py @@ -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") diff --git a/tests/system/suite_SCOM/tst_SCOM01/test.py b/tests/system/suite_SCOM/tst_SCOM01/test.py index df7578df061308dc5c033ba661acc77acaed8653..94871997a14403cf86b595506efbffa5b9520622 100644 --- a/tests/system/suite_SCOM/tst_SCOM01/test.py +++ b/tests/system/suite_SCOM/tst_SCOM01/test.py @@ -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")) diff --git a/tests/system/suite_SCOM/tst_SCOM04/test.py b/tests/system/suite_SCOM/tst_SCOM04/test.py index 369dbe0b76a0bff2008f02719380aac729d9e182..da81053eaa16693c453e206ffd4ed1ff16c34b7a 100644 --- a/tests/system/suite_SCOM/tst_SCOM04/test.py +++ b/tests/system/suite_SCOM/tst_SCOM04/test.py @@ -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")) diff --git a/tests/system/suite_debugger/tst_build_new_project/test.py b/tests/system/suite_debugger/tst_build_new_project/test.py index 4474bbdc32124c336141a9480addbcb98ec1cfee..db6771c9f2ca1de4304baac43aaead05993d2307 100644 --- a/tests/system/suite_debugger/tst_build_new_project/test.py +++ b/tests/system/suite_debugger/tst_build_new_project/test.py @@ -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") diff --git a/tests/system/suite_debugger/tst_cli_output_console/test.py b/tests/system/suite_debugger/tst_cli_output_console/test.py index 02b4588f06a1c1adb026cd11ef5c622b776636ef..c1576de2f0022cbd21d2c056093a6db21671eb31 100644 --- a/tests/system/suite_debugger/tst_cli_output_console/test.py +++ b/tests/system/suite_debugger/tst_cli_output_console/test.py @@ -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") diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index 3f7db4318c32a1b69c4e10f16799fa69f51fd12e..5a1aab9c0b474bcd4d78240dbb39b305d8fc270e 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -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'}", diff --git a/tests/system/suite_editors/tst_select_all/testdata/files.tsv b/tests/system/suite_editors/shared/testdata/files.tsv similarity index 100% rename from tests/system/suite_editors/tst_select_all/testdata/files.tsv rename to tests/system/suite_editors/shared/testdata/files.tsv diff --git a/tests/system/suite_editors/suite.conf b/tests/system/suite_editors/suite.conf index 46c8bb025c31df59a6420ed50018230710cb2242..e7a043be6242f0ddd574d723d2a0340e20833362 100644 --- a/tests/system/suite_editors/suite.conf +++ b/tests/system/suite_editors/suite.conf @@ -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 diff --git a/tests/system/suite_editors/tst_delete_externally/test.py b/tests/system/suite_editors/tst_delete_externally/test.py new file mode 100644 index 0000000000000000000000000000000000000000..ab06f1dd822973394f5c4582618c3929b5f7cd19 --- /dev/null +++ b/tests/system/suite_editors/tst_delete_externally/test.py @@ -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") diff --git a/tests/system/suite_editors/tst_modify_readonly/test.py b/tests/system/suite_editors/tst_modify_readonly/test.py new file mode 100644 index 0000000000000000000000000000000000000000..c5de75a85368480ae3daf63b6d7562fc9a108b9a --- /dev/null +++ b/tests/system/suite_editors/tst_modify_readonly/test.py @@ -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") diff --git a/tests/system/suite_editors/tst_qml_editor/test.py b/tests/system/suite_editors/tst_qml_editor/test.py index 73605f7a303a31af28e50a779b31005ecffde19c..0f851168c3b0a589cd257aad2cf8208a62db0f9d 100644 --- a/tests/system/suite_editors/tst_qml_editor/test.py +++ b/tests/system/suite_editors/tst_qml_editor/test.py @@ -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"] diff --git a/tests/system/suite_editors/tst_qml_indent/test.py b/tests/system/suite_editors/tst_qml_indent/test.py index 6efdb3b2fe625409f3422cfc1f29da0bd27df09b..acdb618e355dbf4599b365d78b668b207b52e0a0 100644 --- a/tests/system/suite_editors/tst_qml_indent/test.py +++ b/tests/system/suite_editors/tst_qml_indent/test.py @@ -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 {") diff --git a/tests/system/suite_editors/tst_revert_changes/test.py b/tests/system/suite_editors/tst_revert_changes/test.py new file mode 100644 index 0000000000000000000000000000000000000000..fc1983a5f1e6b8b385d0e590d5164d758e6a1453 --- /dev/null +++ b/tests/system/suite_editors/tst_revert_changes/test.py @@ -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("\\","") diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py index b1b553eea2c5f2a478a30bc1ae9421a6c1e1d9d6..ccd55dcefdd0fdb3e45508c43c7e7ac81c95f04e 100644 --- a/tests/system/suite_general/tst_build_speedcrunch/test.py +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -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)) diff --git a/tests/system/suite_general/tst_create_proj_wizard/test.py b/tests/system/suite_general/tst_create_proj_wizard/test.py index 8995d20344c4f776333550c36c21351ad2c56727..378e70de911a121f6e89c857e7bf07bc85af4bec 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -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: