forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.0'
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -298,7 +298,6 @@ int main(int argc, char **argv)
|
|||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||||
// QML is unusable with the xlib backend
|
// QML is unusable with the xlib backend
|
||||||
QApplication::setGraphicsSystem(QLatin1String("raster"));
|
QApplication::setGraphicsSystem(QLatin1String("raster"));
|
||||||
qputenv("QSG_RENDER_LOOP", "basic"); // workaround for QTBUG-35143
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
|
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
|
||||||
|
|||||||
@@ -137,6 +137,12 @@ public:
|
|||||||
void setVariadic(bool isVariadic)
|
void setVariadic(bool isVariadic)
|
||||||
{ f._variadic = isVariadic; }
|
{ f._variadic = isVariadic; }
|
||||||
|
|
||||||
|
bool isPredefined() const
|
||||||
|
{ return f._predefined; }
|
||||||
|
|
||||||
|
void setPredefined(bool isPredefined)
|
||||||
|
{ f._predefined = isPredefined; }
|
||||||
|
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
QString toStringWithLineBreaks() const;
|
QString toStringWithLineBreaks() const;
|
||||||
|
|
||||||
@@ -151,6 +157,7 @@ private:
|
|||||||
unsigned _hidden: 1;
|
unsigned _hidden: 1;
|
||||||
unsigned _functionLike: 1;
|
unsigned _functionLike: 1;
|
||||||
unsigned _variadic: 1;
|
unsigned _variadic: 1;
|
||||||
|
unsigned _predefined: 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
QByteArray _name;
|
QByteArray _name;
|
||||||
|
|||||||
@@ -906,7 +906,51 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
|
|||||||
{
|
{
|
||||||
ScopedBoolSwap s(m_state.m_inPreprocessorDirective, true);
|
ScopedBoolSwap s(m_state.m_inPreprocessorDirective, true);
|
||||||
|
|
||||||
Macro *macro = m_env->resolve(tk->asByteArrayRef());
|
static const QByteArray ppLine("__LINE__");
|
||||||
|
static const QByteArray ppFile("__FILE__");
|
||||||
|
static const QByteArray ppDate("__DATE__");
|
||||||
|
static const QByteArray ppTime("__TIME__");
|
||||||
|
|
||||||
|
ByteArrayRef macroNameRef = tk->asByteArrayRef();
|
||||||
|
|
||||||
|
if (macroNameRef.size() == 8
|
||||||
|
&& macroNameRef[0] == '_'
|
||||||
|
&& macroNameRef[1] == '_') {
|
||||||
|
PPToken newTk;
|
||||||
|
QByteArray txt;
|
||||||
|
if (macroNameRef == ppLine) {
|
||||||
|
txt = QByteArray::number(tk->lineno);
|
||||||
|
newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false);
|
||||||
|
} else if (macroNameRef == ppFile) {
|
||||||
|
txt.append('"');
|
||||||
|
txt.append(m_env->currentFileUtf8);
|
||||||
|
txt.append('"');
|
||||||
|
newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false);
|
||||||
|
} else if (macroNameRef == ppDate) {
|
||||||
|
txt.append('"');
|
||||||
|
txt.append(QDate::currentDate().toString().toUtf8());
|
||||||
|
txt.append('"');
|
||||||
|
newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false);
|
||||||
|
} else if (macroNameRef == ppTime) {
|
||||||
|
txt.append('"');
|
||||||
|
txt.append(QTime::currentTime().toString().toUtf8());
|
||||||
|
txt.append('"');
|
||||||
|
newTk = generateToken(T_STRING_LITERAL, txt.constData(), txt.size(), tk->lineno, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newTk.hasSource()) {
|
||||||
|
Macro macro;
|
||||||
|
macro.setName(macroNameRef.toByteArray());
|
||||||
|
macro.setFileName(m_env->currentFile);
|
||||||
|
macro.setPredefined(true);
|
||||||
|
macro.setDefinition(txt, QVector<PPToken>() << newTk);
|
||||||
|
m_env->bind(macro);
|
||||||
|
if (m_client)
|
||||||
|
m_client->macroAdded(macro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Macro *macro = m_env->resolve(macroNameRef);
|
||||||
if (!macro
|
if (!macro
|
||||||
|| (tk->expanded()
|
|| (tk->expanded()
|
||||||
&& m_state.m_tokenBuffer
|
&& m_state.m_tokenBuffer
|
||||||
|
|||||||
@@ -797,10 +797,12 @@ const Macro *CPPEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Docu
|
|||||||
if (const Macro *macro = doc->findMacroDefinitionAt(line)) {
|
if (const Macro *macro = doc->findMacroDefinitionAt(line)) {
|
||||||
QTextCursor macroCursor = cursor;
|
QTextCursor macroCursor = cursor;
|
||||||
const QByteArray name = identifierUnderCursor(¯oCursor).toLatin1();
|
const QByteArray name = identifierUnderCursor(¯oCursor).toLatin1();
|
||||||
if (macro->name() == name)
|
if (macro->name() == name && !macro->isPredefined())
|
||||||
return macro;
|
return macro;
|
||||||
} else if (const Document::MacroUse *use = doc->findMacroUseAt(cursor.position())) {
|
} else if (const Document::MacroUse *use = doc->findMacroUseAt(cursor.position())) {
|
||||||
return &use->macro();
|
const Macro ¯o = use->macro();
|
||||||
|
if (!macro.isPredefined())
|
||||||
|
return ¯o;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -592,10 +592,12 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
|||||||
m_widget->showPreProcessorWidget();
|
m_widget->showPreProcessorWidget();
|
||||||
} else if (fileName != CppModelManagerInterface::configurationFileName()) {
|
} else if (fileName != CppModelManagerInterface::configurationFileName()) {
|
||||||
const Macro ¯o = use->macro();
|
const Macro ¯o = use->macro();
|
||||||
link.targetFileName = macro.fileName();
|
if (!macro.isPredefined()) {
|
||||||
link.targetLine = macro.line();
|
link.targetFileName = macro.fileName();
|
||||||
link.linkTextStart = use->begin();
|
link.targetLine = macro.line();
|
||||||
link.linkTextEnd = use->end();
|
link.linkTextStart = use->begin();
|
||||||
|
link.linkTextEnd = use->end();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -558,6 +558,8 @@ restart_search:
|
|||||||
usages.clear();
|
usages.clear();
|
||||||
foreach (const Document::MacroUse &use, doc->macroUses()) {
|
foreach (const Document::MacroUse &use, doc->macroUses()) {
|
||||||
const Macro &useMacro = use.macro();
|
const Macro &useMacro = use.macro();
|
||||||
|
if (useMacro.isPredefined())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (useMacro.fileName() == macro.fileName()) { // Check if this is a match, but possibly against an outdated document.
|
if (useMacro.fileName() == macro.fileName()) { // Check if this is a match, but possibly against an outdated document.
|
||||||
if (source.isEmpty())
|
if (source.isEmpty())
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ QFuture<TextEditor::HighlightingResult> CppHighlightingSupportInternal::highligh
|
|||||||
|
|
||||||
// Get macro definitions
|
// Get macro definitions
|
||||||
foreach (const CPlusPlus::Macro& macro, doc->definedMacros()) {
|
foreach (const CPlusPlus::Macro& macro, doc->definedMacros()) {
|
||||||
|
if (macro.isPredefined())
|
||||||
|
continue; // No "real" definition location
|
||||||
|
|
||||||
int line, column;
|
int line, column;
|
||||||
editor()->convertPosition(macro.offset(), &line, &column);
|
editor()->convertPosition(macro.offset(), &line, &column);
|
||||||
++column; //Highlighting starts at (column-1) --> compensate here
|
++column; //Highlighting starts at (column-1) --> compensate here
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
const int AbiRole = Qt::UserRole + 2;
|
||||||
|
|
||||||
static QList<QStandardItem *> describeItem(const DebuggerItem &item)
|
static QList<QStandardItem *> describeItem(const DebuggerItem &item)
|
||||||
{
|
{
|
||||||
QList<QStandardItem *> row;
|
QList<QStandardItem *> row;
|
||||||
@@ -44,7 +46,7 @@ static QList<QStandardItem *> describeItem(const DebuggerItem &item)
|
|||||||
row.append(new QStandardItem(item.command().toUserOutput()));
|
row.append(new QStandardItem(item.command().toUserOutput()));
|
||||||
row.append(new QStandardItem(item.engineTypeName()));
|
row.append(new QStandardItem(item.engineTypeName()));
|
||||||
row.at(0)->setData(item.id());
|
row.at(0)->setData(item.id());
|
||||||
row.at(0)->setData(item.abiNames(), Qt::UserRole + 2);
|
row.at(0)->setData(item.abiNames(), AbiRole);
|
||||||
row.at(0)->setEditable(false);
|
row.at(0)->setEditable(false);
|
||||||
row.at(1)->setEditable(false);
|
row.at(1)->setEditable(false);
|
||||||
row.at(1)->setData(item.toMap());
|
row.at(1)->setData(item.toMap());
|
||||||
@@ -158,7 +160,7 @@ bool DebuggerItemModel::updateDebuggerStandardItem(const DebuggerItem &item, boo
|
|||||||
QFont font = sitem->font();
|
QFont font = sitem->font();
|
||||||
font.setBold(changed);
|
font.setBold(changed);
|
||||||
parent->child(row, 0)->setData(item.displayName(), Qt::DisplayRole);
|
parent->child(row, 0)->setData(item.displayName(), Qt::DisplayRole);
|
||||||
parent->child(row, 0)->setData(item.abiNames(), Qt::UserRole + 2);
|
parent->child(row, 0)->setData(item.abiNames(), AbiRole);
|
||||||
parent->child(row, 0)->setFont(font);
|
parent->child(row, 0)->setFont(font);
|
||||||
parent->child(row, 1)->setData(item.command().toUserOutput(), Qt::DisplayRole);
|
parent->child(row, 1)->setData(item.command().toUserOutput(), Qt::DisplayRole);
|
||||||
parent->child(row, 1)->setFont(font);
|
parent->child(row, 1)->setFont(font);
|
||||||
@@ -178,7 +180,7 @@ DebuggerItem DebuggerItemModel::debuggerItem(QStandardItem *sitem) const
|
|||||||
item.m_id = i->data();
|
item.m_id = i->data();
|
||||||
item.setDisplayName(i->data(Qt::DisplayRole).toString());
|
item.setDisplayName(i->data(Qt::DisplayRole).toString());
|
||||||
|
|
||||||
QStringList abis = i->data(Qt::UserRole + 2).toStringList();
|
QStringList abis = i->data(AbiRole).toStringList();
|
||||||
QList<ProjectExplorer::Abi> abiList;
|
QList<ProjectExplorer::Abi> abiList;
|
||||||
foreach (const QString &abi, abis)
|
foreach (const QString &abi, abis)
|
||||||
abiList << ProjectExplorer::Abi(abi);
|
abiList << ProjectExplorer::Abi(abi);
|
||||||
|
|||||||
@@ -250,16 +250,8 @@ Target *BuildConfiguration::target() const
|
|||||||
Utils::Environment BuildConfiguration::baseEnvironment() const
|
Utils::Environment BuildConfiguration::baseEnvironment() const
|
||||||
{
|
{
|
||||||
Utils::Environment result;
|
Utils::Environment result;
|
||||||
if (useSystemEnvironment()) {
|
if (useSystemEnvironment())
|
||||||
#if 1
|
|
||||||
// workaround for QTBUG-35143
|
|
||||||
result = Utils::Environment::systemEnvironment();
|
result = Utils::Environment::systemEnvironment();
|
||||||
result.unset(QLatin1String("QSG_RENDER_LOOP"));
|
|
||||||
#else
|
|
||||||
result = Utils::Environment::systemEnvironment();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
target()->kit()->addToEnvironment(result);
|
target()->kit()->addToEnvironment(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -357,11 +357,10 @@ QList<Task> DeviceKitInformation::validate(const Kit *k) const
|
|||||||
void DeviceKitInformation::fix(Kit *k)
|
void DeviceKitInformation::fix(Kit *k)
|
||||||
{
|
{
|
||||||
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
|
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
|
||||||
if (!dev.isNull() && dev->type() == DeviceTypeKitInformation::deviceTypeId(k))
|
if (!dev.isNull() && dev->type() != DeviceTypeKitInformation::deviceTypeId(k)) {
|
||||||
return;
|
qWarning("Device is no longer known, removing from kit \"%s\".", qPrintable(k->displayName()));
|
||||||
|
setDeviceId(k, Core::Id());
|
||||||
qWarning("Device is no longer known, removing from kit \"%s\".", qPrintable(k->displayName()));
|
}
|
||||||
setDeviceId(k, Core::Id());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceKitInformation::setup(Kit *k)
|
void DeviceKitInformation::setup(Kit *k)
|
||||||
|
|||||||
@@ -69,23 +69,11 @@ Utils::Environment LocalEnvironmentAspect::baseEnvironment() const
|
|||||||
if (BuildConfiguration *bc = runConfiguration()->target()->activeBuildConfiguration()) {
|
if (BuildConfiguration *bc = runConfiguration()->target()->activeBuildConfiguration()) {
|
||||||
env = bc->environment();
|
env = bc->environment();
|
||||||
} else { // Fallback for targets without buildconfigurations:
|
} else { // Fallback for targets without buildconfigurations:
|
||||||
#if 1
|
|
||||||
// workaround for QTBUG-35143
|
|
||||||
env = Utils::Environment::systemEnvironment();
|
env = Utils::Environment::systemEnvironment();
|
||||||
env.unset(QLatin1String("QSG_RENDER_LOOP"));
|
|
||||||
#else
|
|
||||||
env = Utils::Environment::systemEnvironment();
|
|
||||||
#endif
|
|
||||||
runConfiguration()->target()->kit()->addToEnvironment(env);
|
runConfiguration()->target()->kit()->addToEnvironment(env);
|
||||||
}
|
}
|
||||||
} else if (base == static_cast<int>(SystemEnvironmentBase)) {
|
} else if (base == static_cast<int>(SystemEnvironmentBase)) {
|
||||||
#if 1
|
env = Utils::Environment::systemEnvironment();
|
||||||
// workaround for QTBUG-35143
|
|
||||||
env = Utils::Environment::systemEnvironment();
|
|
||||||
env.unset(QLatin1String("QSG_RENDER_LOOP"));
|
|
||||||
#else
|
|
||||||
env = Utils::Environment::systemEnvironment();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const LocalApplicationRunConfiguration *rc = qobject_cast<const LocalApplicationRunConfiguration *>(runConfiguration()))
|
if (const LocalApplicationRunConfiguration *rc = qobject_cast<const LocalApplicationRunConfiguration *>(runConfiguration()))
|
||||||
|
|||||||
@@ -51,14 +51,7 @@ QString QmlProjectEnvironmentAspect::baseEnvironmentDisplayName(int base) const
|
|||||||
|
|
||||||
Utils::Environment QmlProjectManager::QmlProjectEnvironmentAspect::baseEnvironment() const
|
Utils::Environment QmlProjectManager::QmlProjectEnvironmentAspect::baseEnvironment() const
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
// workaround for QTBUG-35143
|
|
||||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
|
||||||
env.unset(QLatin1String("QSG_RENDER_LOOP"));
|
|
||||||
return env;
|
|
||||||
#else
|
|
||||||
return Utils::Environment::systemEnvironment();
|
return Utils::Environment::systemEnvironment();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProjectEnvironmentAspect::QmlProjectEnvironmentAspect(ProjectExplorer::RunConfiguration *rc) :
|
QmlProjectEnvironmentAspect::QmlProjectEnvironmentAspect(ProjectExplorer::RunConfiguration *rc) :
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ private slots:
|
|||||||
void test_checksymbols_VirtualMethodUse();
|
void test_checksymbols_VirtualMethodUse();
|
||||||
void test_checksymbols_LabelUse();
|
void test_checksymbols_LabelUse();
|
||||||
void test_checksymbols_MacroUse();
|
void test_checksymbols_MacroUse();
|
||||||
|
void test_checksymbols_Macros__FILE__LINE__DATE__TIME__1();
|
||||||
|
void test_checksymbols_Macros__FILE__LINE__DATE__TIME__2();
|
||||||
void test_checksymbols_FunctionUse();
|
void test_checksymbols_FunctionUse();
|
||||||
void test_checksymbols_PseudoKeywordUse();
|
void test_checksymbols_PseudoKeywordUse();
|
||||||
void test_checksymbols_StaticUse();
|
void test_checksymbols_StaticUse();
|
||||||
@@ -326,6 +328,55 @@ void tst_CheckSymbols::test_checksymbols_MacroUse()
|
|||||||
TestData::check(source, expectedUses, macroUses);
|
TestData::check(source, expectedUses, macroUses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_CheckSymbols::test_checksymbols_Macros__FILE__LINE__DATE__TIME__1()
|
||||||
|
{
|
||||||
|
const QByteArray source =
|
||||||
|
"#define FILE_DATE_TIME __FILE__ \" / \" __DATE__ \" / \" __TIME__\n"
|
||||||
|
"#define LINE_NUMBER 0 + __LINE__\n"
|
||||||
|
"\n"
|
||||||
|
"void f()\n"
|
||||||
|
"{\n"
|
||||||
|
" class Printer;\n"
|
||||||
|
" Printer::printText(FILE_DATE_TIME); Printer::printInteger(LINE_NUMBER); Printer::nl();\n"
|
||||||
|
" return;\n"
|
||||||
|
"}\n";
|
||||||
|
const QList<Use> expectedUses = QList<Use>()
|
||||||
|
<< Use(4, 6, 1, CppHighlightingSupport::FunctionUse)
|
||||||
|
<< Use(6, 11, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(6, 11, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(7, 5, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(7, 41, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(7, 77, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
;
|
||||||
|
|
||||||
|
TestData::check(source, expectedUses);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_CheckSymbols::test_checksymbols_Macros__FILE__LINE__DATE__TIME__2()
|
||||||
|
{
|
||||||
|
const QByteArray source =
|
||||||
|
"void f()\n"
|
||||||
|
"{\n"
|
||||||
|
" class Printer;\n"
|
||||||
|
" Printer::printInteger(__LINE__); Printer::printText(__FILE__); Printer::nl();\n"
|
||||||
|
" Printer::printText(__DATE__); Printer::printText(__TIME__); Printer::nl();\n"
|
||||||
|
" return;\n"
|
||||||
|
"}\n";
|
||||||
|
const QList<Use> expectedUses = QList<Use>()
|
||||||
|
<< Use(1, 6, 1, CppHighlightingSupport::FunctionUse)
|
||||||
|
<< Use(3, 11, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(3, 11, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(4, 5, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(4, 38, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(4, 68, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(5, 5, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(5, 35, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
<< Use(5, 65, 7, CppHighlightingSupport::TypeUse)
|
||||||
|
;
|
||||||
|
|
||||||
|
TestData::check(source, expectedUses);
|
||||||
|
}
|
||||||
|
|
||||||
void tst_CheckSymbols::test_checksymbols_FunctionUse()
|
void tst_CheckSymbols::test_checksymbols_FunctionUse()
|
||||||
{
|
{
|
||||||
const QByteArray source =
|
const QByteArray source =
|
||||||
|
|||||||
@@ -334,6 +334,7 @@ private slots:
|
|||||||
void unfinished_function_like_macro_call();
|
void unfinished_function_like_macro_call();
|
||||||
void nasty_macro_expansion();
|
void nasty_macro_expansion();
|
||||||
void glib_attribute();
|
void glib_attribute();
|
||||||
|
void builtin__FILE__();
|
||||||
void blockSkipping();
|
void blockSkipping();
|
||||||
void includes_1();
|
void includes_1();
|
||||||
void dont_eagerly_expand();
|
void dont_eagerly_expand();
|
||||||
@@ -783,6 +784,27 @@ void tst_Preprocessor::glib_attribute()
|
|||||||
QCOMPARE(preprocessed, result____);
|
QCOMPARE(preprocessed, result____);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_Preprocessor::builtin__FILE__()
|
||||||
|
{
|
||||||
|
Client *client = 0; // no client.
|
||||||
|
Environment env;
|
||||||
|
|
||||||
|
Preprocessor preprocess(client, &env);
|
||||||
|
QByteArray preprocessed = preprocess.run(
|
||||||
|
QLatin1String("some-file.c"),
|
||||||
|
QByteArray("const char *f = __FILE__\n"
|
||||||
|
));
|
||||||
|
const QByteArray result____ =
|
||||||
|
"# 1 \"some-file.c\"\n"
|
||||||
|
"const char *f =\n"
|
||||||
|
"# expansion begin 16,8 ~1\n"
|
||||||
|
"\"some-file.c\"\n"
|
||||||
|
"# expansion end\n"
|
||||||
|
"# 2 \"some-file.c\"\n";
|
||||||
|
|
||||||
|
QCOMPARE(preprocessed, result____);
|
||||||
|
}
|
||||||
|
|
||||||
void tst_Preprocessor::comparisons_data()
|
void tst_Preprocessor::comparisons_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("infile");
|
QTest::addColumn<QString>("infile");
|
||||||
|
|||||||
@@ -154,7 +154,12 @@ def __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls):
|
|||||||
selectFromCombo(comboBox, "Qt Quick 2.0")
|
selectFromCombo(comboBox, "Qt Quick 2.0")
|
||||||
else:
|
else:
|
||||||
test.fatal("Got unknown Qt Quick version: %s - trying to continue." % str(qtQuickVersion))
|
test.fatal("Got unknown Qt Quick version: %s - trying to continue." % str(qtQuickVersion))
|
||||||
|
label = waitForObject("{type='QLabel' unnamed='1' visible='1' text?='Creates a *' }")
|
||||||
|
requires = re.match(".*Requires Qt (\d\.\d).*", str(label.text))
|
||||||
|
if requires:
|
||||||
|
requires = requires.group(1)
|
||||||
clickButton(waitForObject(":Next_QPushButton"))
|
clickButton(waitForObject(":Next_QPushButton"))
|
||||||
|
return requires
|
||||||
|
|
||||||
# Selects the Qt versions for a project
|
# Selects the Qt versions for a project
|
||||||
# param checks turns tests in the function on if set to True
|
# param checks turns tests in the function on if set to True
|
||||||
@@ -187,6 +192,30 @@ def __verifyFileCreation__(path, expectedFiles):
|
|||||||
filename = os.path.join(path, filename)
|
filename = os.path.join(path, filename)
|
||||||
test.verify(os.path.exists(filename), "Checking if '" + filename + "' was created")
|
test.verify(os.path.exists(filename), "Checking if '" + filename + "' was created")
|
||||||
|
|
||||||
|
def __modifyAvailableTargets__(available, requiredQt, asStrings=False):
|
||||||
|
threeDigits = re.compile("\d{3}")
|
||||||
|
requiredQtVersion = requiredQt.replace(".", "") + "0"
|
||||||
|
tmp = list(available) # we need a deep copy
|
||||||
|
for currentItem in tmp:
|
||||||
|
if asStrings:
|
||||||
|
item = currentItem
|
||||||
|
else:
|
||||||
|
item = Targets.getStringForTarget(currentItem)
|
||||||
|
found = threeDigits.search(item)
|
||||||
|
if found:
|
||||||
|
if found.group(0) < requiredQtVersion:
|
||||||
|
# Quick 1.1 supports 4.7.4 only for running, debugging is unsupported
|
||||||
|
# so the least required version is 4.8, but 4.7.4 will be still listed
|
||||||
|
if not (requiredQtVersion == "480" and found.group(0) == "474"):
|
||||||
|
available.remove(currentItem)
|
||||||
|
if requiredQtVersion > "480":
|
||||||
|
toBeRemoved = [Targets.EMBEDDED_LINUX, Targets.SIMULATOR]
|
||||||
|
if asStrings:
|
||||||
|
toBeRemoved = Targets.getTargetsAsStrings(toBeRemoved)
|
||||||
|
for t in toBeRemoved:
|
||||||
|
if t in available:
|
||||||
|
available.remove(t)
|
||||||
|
|
||||||
# Creates a Qt GUI project
|
# Creates a Qt GUI project
|
||||||
# param path specifies where to create the project
|
# param path specifies where to create the project
|
||||||
# param projectName is the name for the new project
|
# param projectName is the name for the new project
|
||||||
@@ -256,7 +285,8 @@ def createNewQtQuickApplication(workingDir, projectName = None,
|
|||||||
fromWelcome=False, withControls=False):
|
fromWelcome=False, withControls=False):
|
||||||
available = __createProjectOrFileSelectType__(" Applications", "Qt Quick Application", fromWelcome)
|
available = __createProjectOrFileSelectType__(" Applications", "Qt Quick Application", fromWelcome)
|
||||||
projectName = __createProjectSetNameAndPath__(workingDir, projectName)
|
projectName = __createProjectSetNameAndPath__(workingDir, projectName)
|
||||||
__createProjectHandleQtQuickSelection__(qtQuickVersion, withControls)
|
requiredQt = __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls)
|
||||||
|
__modifyAvailableTargets__(available, requiredQt)
|
||||||
checkedTargets = __chooseTargets__(targets, available)
|
checkedTargets = __chooseTargets__(targets, available)
|
||||||
snooze(1)
|
snooze(1)
|
||||||
clickButton(waitForObject(":Next_QPushButton"))
|
clickButton(waitForObject(":Next_QPushButton"))
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import re
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
global tmpSettingsDir
|
global tmpSettingsDir
|
||||||
global textChanged
|
quickCombinations = [[1,False], [2,False], [2,True]]
|
||||||
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection")
|
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection")
|
||||||
qmlFile = os.path.join("qml", "textselection.qml")
|
qmlFile = os.path.join("qml", "textselection.qml")
|
||||||
if not neededFilePresent(os.path.join(sourceExample, qmlFile)):
|
if not neededFilePresent(os.path.join(sourceExample, qmlFile)):
|
||||||
@@ -42,9 +42,6 @@ def main():
|
|||||||
startApplication("qtcreator" + SettingsPath)
|
startApplication("qtcreator" + SettingsPath)
|
||||||
if not startedWithoutPluginError():
|
if not startedWithoutPluginError():
|
||||||
return
|
return
|
||||||
overrideInstallLazySignalHandler()
|
|
||||||
installLazySignalHandler(":frame.templateDescription_QTextBrowser",
|
|
||||||
"textChanged()","__handleTextChanged__")
|
|
||||||
kits = getConfiguredKits()
|
kits = getConfiguredKits()
|
||||||
test.log("Collecting potential project types...")
|
test.log("Collecting potential project types...")
|
||||||
availableProjectTypes = []
|
availableProjectTypes = []
|
||||||
@@ -71,59 +68,67 @@ def main():
|
|||||||
for template in dumpItems(templatesView.model(), templatesView.rootIndex()):
|
for template in dumpItems(templatesView.model(), templatesView.rootIndex()):
|
||||||
template = template.replace(".", "\\.")
|
template = template.replace(".", "\\.")
|
||||||
# skip non-configurable
|
# skip non-configurable
|
||||||
if not (template in ("Qt Quick 1 UI", "Qt Quick 2 UI", "Qt Quick 2 UI with Controls")
|
if (template != "Qt Quick UI" and "(CMake Build)" not in template
|
||||||
or "(CMake Build)" in template or "(Qbs Build)" in template):
|
and "(Qbs Build)" not in template):
|
||||||
availableProjectTypes.append({category:template})
|
availableProjectTypes.append({category:template})
|
||||||
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}"))
|
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}"))
|
||||||
for current in availableProjectTypes:
|
for current in availableProjectTypes:
|
||||||
category = current.keys()[0]
|
category = current.keys()[0]
|
||||||
template = current.values()[0]
|
template = current.values()[0]
|
||||||
invokeMenuItem("File", "New File or Project...")
|
displayedPlatforms = __createProject__(category, template)
|
||||||
selectFromCombo(waitForObject(":New.comboBox_QComboBox"), "All Templates")
|
if template == "Qt Quick Application":
|
||||||
categoriesView = waitForObject(":New.templateCategoryView_QTreeView")
|
for counter, qComb in enumerate(quickCombinations):
|
||||||
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
|
requiredQtVersion = __createProjectHandleQtQuickSelection__(qComb[0], qComb[1])
|
||||||
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}")
|
__modifyAvailableTargets__(displayedPlatforms, requiredQtVersion, True)
|
||||||
test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", ".")))
|
verifyKitCheckboxes(kits, displayedPlatforms)
|
||||||
textChanged = False
|
# FIXME: if QTBUG-35203 is fixed replace by triggering the shortcut for Back
|
||||||
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
|
clickButton(waitForObject("{type='QPushButton' text='Cancel'}"))
|
||||||
waitFor("textChanged", 2000)
|
# are there more Quick combinations - then recreate this project
|
||||||
text = waitForObject(":frame.templateDescription_QTextBrowser").plainText
|
if counter < len(quickCombinations) - 1:
|
||||||
displayedPlatforms = __getSupportedPlatforms__(str(text), template, True)[0]
|
displayedPlatforms = __createProject__(category, template)
|
||||||
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
|
continue
|
||||||
# don't check because project could exist
|
|
||||||
__createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False)
|
|
||||||
try:
|
try:
|
||||||
waitForObject("{name='mainQmlFileGroupBox' title='Main HTML File' type='QGroupBox' visible='1'}", 1000)
|
waitForObject("{name='mainQmlFileGroupBox' title='Main HTML File' type='QGroupBox' visible='1'}", 1000)
|
||||||
clickButton(waitForObject(":Next_QPushButton"))
|
clickButton(waitForObject(":Next_QPushButton"))
|
||||||
except LookupError:
|
except LookupError:
|
||||||
try:
|
pass
|
||||||
waitForObject("{text='Select Existing QML file' type='QLabel' visible='1'}", 1000)
|
verifyKitCheckboxes(kits, displayedPlatforms)
|
||||||
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
|
clickButton(waitForObject("{type='QPushButton' text='Cancel'}"))
|
||||||
type(baseLineEd, os.path.join(templateDir, qmlFile))
|
|
||||||
clickButton(waitForObject(":Next_QPushButton"))
|
|
||||||
except LookupError:
|
|
||||||
pass
|
|
||||||
waitForObject("{type='QLabel' unnamed='1' visible='1' text='Kit Selection'}")
|
|
||||||
availableCheckboxes = filter(visibleCheckBoxExists, kits.keys())
|
|
||||||
# verification whether expected, found and configured match
|
|
||||||
for t in kits:
|
|
||||||
if t in displayedPlatforms:
|
|
||||||
if t in availableCheckboxes:
|
|
||||||
test.passes("Found expected kit '%s' on 'Kit Selection' page." % t)
|
|
||||||
availableCheckboxes.remove(t)
|
|
||||||
else:
|
|
||||||
test.fail("Expected kit '%s' missing on 'Kit Selection' page." % t)
|
|
||||||
else:
|
|
||||||
if t in availableCheckboxes:
|
|
||||||
test.fail("Kit '%s' found on 'Kit Selection' page - but was not expected!" % t)
|
|
||||||
else:
|
|
||||||
test.passes("Irrelevant kit '%s' not found on 'Kit Selection' page." % t)
|
|
||||||
if len(availableCheckboxes) != 0:
|
|
||||||
test.fail("Found unexpected additional kit(s) %s on 'Kit Selection' page."
|
|
||||||
% str(availableCheckboxes))
|
|
||||||
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}"))
|
|
||||||
invokeMenuItem("File", "Exit")
|
invokeMenuItem("File", "Exit")
|
||||||
|
|
||||||
def __handleTextChanged__(*args):
|
def verifyKitCheckboxes(kits, displayedPlatforms):
|
||||||
global textChanged
|
waitForObject("{type='QLabel' unnamed='1' visible='1' text='Kit Selection'}")
|
||||||
textChanged = True
|
availableCheckboxes = filter(visibleCheckBoxExists, kits.keys())
|
||||||
|
# verification whether expected, found and configured match
|
||||||
|
for t in kits:
|
||||||
|
if t in displayedPlatforms:
|
||||||
|
if t in availableCheckboxes:
|
||||||
|
test.passes("Found expected kit '%s' on 'Kit Selection' page." % t)
|
||||||
|
availableCheckboxes.remove(t)
|
||||||
|
else:
|
||||||
|
test.fail("Expected kit '%s' missing on 'Kit Selection' page." % t)
|
||||||
|
else:
|
||||||
|
if t in availableCheckboxes:
|
||||||
|
test.fail("Kit '%s' found on 'Kit Selection' page - but was not expected!" % t)
|
||||||
|
else:
|
||||||
|
test.passes("Irrelevant kit '%s' not found on 'Kit Selection' page." % t)
|
||||||
|
if len(availableCheckboxes) != 0:
|
||||||
|
test.fail("Found unexpected additional kit(s) %s on 'Kit Selection' page."
|
||||||
|
% str(availableCheckboxes))
|
||||||
|
|
||||||
|
def __createProject__(category, template):
|
||||||
|
invokeMenuItem("File", "New File or Project...")
|
||||||
|
selectFromCombo(waitForObject(":New.comboBox_QComboBox"), "All Templates")
|
||||||
|
categoriesView = waitForObject(":New.templateCategoryView_QTreeView")
|
||||||
|
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
|
||||||
|
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}")
|
||||||
|
test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", ".")))
|
||||||
|
textBrowser = findObject(":frame.templateDescription_QTextBrowser")
|
||||||
|
origTxt = str(textBrowser.plainText)
|
||||||
|
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
|
||||||
|
waitFor("origTxt != str(textBrowser.plainText)", 2000)
|
||||||
|
displayedPlatforms = __getSupportedPlatforms__(str(textBrowser.plainText), template, True)[0]
|
||||||
|
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
|
||||||
|
# don't check because project could exist
|
||||||
|
__createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False)
|
||||||
|
return displayedPlatforms
|
||||||
|
|||||||
Reference in New Issue
Block a user