diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2013-12-10 12:53:20 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2013-12-10 12:53:20 +0100 |
commit | 9f831dde07cb2411808534e76669b28a1b76e21d (patch) | |
tree | ed6252d64c9a3ab27aa93786272cda1b6008f3c7 /tests | |
parent | cdac81f896ef4b052d76f96485a08e6ec13696b8 (diff) | |
parent | ea1a92484ac99057b06130a012164bf9788650e9 (diff) | |
download | qt-creator-wip/clang.tar.gz |
Merge remote-tracking branch 'origin/master' into wip/clangwip/clang
Change-Id: I8a2c8068a3f2b15034fb1bf6304c9a0f3f0e3c8f
Diffstat (limited to 'tests')
33 files changed, 626 insertions, 164 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index cd17e2ea4d..f3b94700ca 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -7,6 +7,7 @@ SUBDIRS += \ debugger \ diff \ extensionsystem \ + externaltool \ environment \ generichighlighter \ profilewriter \ diff --git a/tests/auto/cplusplus/ast/tst_ast.cpp b/tests/auto/cplusplus/ast/tst_ast.cpp index 449c8db6e5..b7474ae874 100644 --- a/tests/auto/cplusplus/ast/tst_ast.cpp +++ b/tests/auto/cplusplus/ast/tst_ast.cpp @@ -107,6 +107,7 @@ private slots: void gcc_attributes_2(); void gcc_attributes_3(); void crash_test_1(); + void thread_local_1(); // expressions void simple_name_1(); @@ -246,6 +247,16 @@ void tst_AST::crash_test_1() QVERIFY(ast); } +void tst_AST::thread_local_1() +{ + QSharedPointer<TranslationUnit> unit(parseStatement("__thread int i;\n")); + AST *ast = unit->ast(); + QVERIFY(ast); + QCOMPARE(diag.errorCount, 0); + QCOMPARE(Token::name(T_THREAD_LOCAL), "thread_local"); + QCOMPARE(Token::name(T___THREAD), "__thread"); +} + void tst_AST::simple_declaration_1() { QSharedPointer<TranslationUnit> unit(parseStatement("\n" diff --git a/tests/auto/cplusplus/cxx11/data/threadLocal.1.cpp b/tests/auto/cplusplus/cxx11/data/threadLocal.1.cpp new file mode 100644 index 0000000000..b286b0bcee --- /dev/null +++ b/tests/auto/cplusplus/cxx11/data/threadLocal.1.cpp @@ -0,0 +1 @@ +thread_local int i; diff --git a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp index 8ac002e376..9320ab24e3 100644 --- a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp +++ b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp @@ -151,6 +151,7 @@ void tst_cxx11::parse_data() QTest::newRow("templateGreaterGreater.1") << "templateGreaterGreater.1.cpp" << ""; QTest::newRow("packExpansion.1") << "packExpansion.1.cpp" << ""; QTest::newRow("declType.1") << "declType.1.cpp" << ""; + QTest::newRow("threadLocal.1") << "threadLocal.1.cpp" << ""; } void tst_cxx11::parse() diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp index 1dc7383d72..5b49045488 100644 --- a/tests/auto/cplusplus/lexer/tst_lexer.cpp +++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp @@ -165,6 +165,13 @@ void tst_SimpleLexer::doxygen_comments_data() << T_INT << T_IDENTIFIER << T_SEMICOLON << T_CPP_DOXY_COMMENT << T_INT << T_IDENTIFIER << T_SEMICOLON << T_CPP_DOXY_COMMENT << T_CPP_DOXY_COMMENT; QTest::newRow(source) << source << expectedTokenKindList; + + source = "?" "?(?" "?)?" "?<?" "?>a?b:c"; + expectedTokenKindList = QList<unsigned>() + << T_LBRACKET << T_RBRACKET << T_LBRACE << T_RBRACE + << T_IDENTIFIER << T_QUESTION << T_IDENTIFIER << T_COLON << T_IDENTIFIER; + QTest::newRow(source) << source << expectedTokenKindList; + } QTEST_APPLESS_MAIN(tst_SimpleLexer) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 4a5568a19a..cdf1dc90a0 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -302,9 +302,9 @@ struct UnsubstitutedValue : Value struct Type { - Type() : qtVersion(0) {} - Type(const char *str) : type(str), qtVersion(0) {} - Type(const QByteArray &ba) : type(ba), qtVersion(0) {} + Type() : qtVersion(0), isPattern(false) {} + Type(const char *str) : type(str), qtVersion(0), isPattern(false) {} + Type(const QByteArray &ba) : type(ba), qtVersion(0), isPattern(false) {} bool matches(const QByteArray &actualType0, const Context &context) const { @@ -329,10 +329,16 @@ struct Type expectedType.replace(' ', ""); expectedType.replace("const", ""); expectedType.replace('@', context.nameSpace); + if (isPattern) { + QString actual = QString::fromLatin1(actualType); + QString expected = QString::fromLatin1(expectedType); + return QRegExp(expected).exactMatch(actual); + } return actualType == expectedType; } QByteArray type; int qtVersion; + bool isPattern; }; struct Type4 : Type @@ -345,6 +351,11 @@ struct Type5 : Type Type5(const QByteArray &ba) : Type(ba) { qtVersion = 5; } }; +struct Pattern : Type +{ + Pattern(const QByteArray &ba) : Type(ba) { isPattern = true; } +}; + enum DebuggerEngine { DumpTestGdbEngine = 0x01, @@ -846,7 +857,7 @@ void tst_Dumpers::dumper() "\n#endif" "\n" + (data.useQHash ? "\n#if QT_VERSION >= 0x050000" - "\nqt_qhash_seed.testAndSetRelaxed(-1, 0);" + "\nqt_qhash_seed.store(0);" "\n#endif\n" : "") + "\n unused(&argc, &argv, &qtversion, &gccversion);\n" "\n" + data.code + @@ -1135,10 +1146,9 @@ void tst_Dumpers::dumper() m_keepTemp = false; } else { qDebug() << "CONTENTS : " << contents; - qDebug() << "Qt VERSION : " - << qPrintable(QString::number(context.qtVersion, 16)); - qDebug() << "GCC VERSION : " - << qPrintable(QString::number(context.gccVersion, 16)); + qDebug() << "Qt VERSION : " << qPrintable(QString::number(context.qtVersion, 16)); + if (m_debuggerEngine != DumpTestCdbEngine) + qDebug() << "GCC VERSION : " << qPrintable(QString::number(context.gccVersion, 16)); qDebug() << "BUILD DIR : " << qPrintable(t->buildPath); } QVERIFY(ok); @@ -1232,7 +1242,9 @@ void tst_Dumpers::dumper_data() "ba += 2;\n") % CoreProfile() % Check("ba", QByteArray("\"Hello\"World") - + char(0) + char(1) + char(2) + '"', "@QByteArray") + + char(0) + char(1) + char(2) + '"', "@QByteArray").setEngines( + DumpTestGdbEngine | DumpTestLldbEngine) + % Check("ba", QByteArray("\"Hello\"World...\""), "@QByteArray").setForCdbOnly() % Check("ba.0", "[0]", "72", "char") % Check("ba.11", "[11]", "0", "char") % Check("ba.12", "[12]", "1", "char") @@ -1371,7 +1383,8 @@ void tst_Dumpers::dumper_data() "unused(&dir, &s, &fi);\n") % CoreProfile() % Check("dir", tempDir, "@QDir") - % Check("dir.absolutePath", tempDir, "@QString"); + % Check("dir.absolutePath", tempDir, "@QString").setEngines( + DumpTestGdbEngine | DumpTestLldbEngine); // % Check("dir.canonicalPath", tempDir, "@QString"); QTest::newRow("QFileInfo") @@ -1869,8 +1882,14 @@ void tst_Dumpers::dumper_data() % CheckType("loc", "@QLocale") % CheckType("m", "@QLocale::MeasurementSystem") % Check("loc1", "\"en_US\"", "@QLocale") - % Check("m1", Value5("@QLocale::ImperialUSSystem (1)"), "@QLocale::MeasurementSystem") - % Check("m1", Value4("@QLocale::ImperialSystem (1)"), "@QLocale::MeasurementSystem"); + % Check("m1", Value5("@QLocale::ImperialUSSystem (1)"), + "@QLocale::MeasurementSystem").setForGdbOnly() + % Check("m1", Value4("@QLocale::ImperialSystem (1)"), + "@QLocale::MeasurementSystem").setForGdbOnly() + % Check("m1", Value5("ImperialUSSystem"), + "@QLocale::MeasurementSystem").setForLldbOnly() + % Check("m1", Value4("ImperialSystem"), + "@QLocale::MeasurementSystem").setForLldbOnly(); QTest::newRow("QMapUIntStringList") << Data("#include <QMap>\n" @@ -1962,14 +1981,12 @@ void tst_Dumpers::dumper_data() % CoreProfile() % Check("map", "<3 items>", "@QMap<@QString, @QPointer<@QObject>>") % Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>") - % Check("map.0.key", Value4("\".\""), "@QString") - % Check("map.0.key", Value5("\"Hallo\""), "@QString") + % Check("map.0.key", "\".\"", "@QString") % Check("map.0.value", "", "@QPointer<@QObject>") //% Check("map.0.value.o", Pointer(), "@QObject") // FIXME: it's '.wp' in Qt 5 % Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>") - % Check("map.1.key", Value4("\"Hallo\""), "@QString") - % Check("map.1.key", Value5("\".\""), "@QString") + % Check("map.1.key", "\"Hallo\"", "@QString") % Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.2.key", "\"Welt\"", "@QString"); @@ -1989,8 +2006,7 @@ void tst_Dumpers::dumper_data() % CoreProfile() % Check("map", "<4 items>", "@QMap<@QString, @QList<nsA::nsB::SomeType*>>") % Check("map.0", "[0]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>") - % Check("map.0.key", Value4("\"1\""), "@QString") - % Check("map.0.key", Value5("\"bar\""), "@QString") + % Check("map.0.key", "\"1\"", "@QString") % Check("map.0.value", "<3 items>", "@QList<nsA::nsB::SomeType*>") % Check("map.0.value.0", "[0]", "", "nsA::nsB::SomeType") % Check("map.0.value.0.a", "1", "int") @@ -1999,8 +2015,7 @@ void tst_Dumpers::dumper_data() % Check("map.0.value.2", "[2]", "", "nsA::nsB::SomeType") % Check("map.0.value.2.a", "3", "int") % Check("map.3", "[3]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>") - % Check("map.3.key", Value4("\"foo\""), "@QString") - % Check("map.3.key", Value5("\"2\""), "@QString") + % Check("map.3.key", "\"foo\"", "@QString") % Check("map.3.value", "<3 items>", "@QList<nsA::nsB::SomeType*>") % Check("map.3.value.2", "[2]", "", "nsA::nsB::SomeType") % Check("map.3.value.2.a", "3", "int") @@ -2071,17 +2086,14 @@ void tst_Dumpers::dumper_data() % CoreProfile() % Check("map", "<4 items>", "@QMultiMap<@QString, @QPointer<@QObject>>") % Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>") - % Check("map.0.key", Value4("\".\""), "@QString") - % Check("map.0.key", Value5("\"Hallo\""), "@QString") + % Check("map.0.key", "\".\"", "@QString") % Check("map.0.value", "", "@QPointer<@QObject>") % Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.1.key", "\".\"", "@QString") % Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>") - % Check("map.2.key", Value4("\"Hallo\""), "@QString") - % Check("map.2.key", Value5("\"Welt\""), "@QString") + % Check("map.2.key", "\"Hallo\"", "@QString") % Check("map.3", "[3]", "", "@QMapNode<@QString, @QPointer<@QObject>>") - % Check("map.3.key", Value4("\"Welt\""), "@QString") - % Check("map.3.key", Value5("\".\""), "@QString"); + % Check("map.3.key", "\"Welt\"", "@QString"); QTest::newRow("QObject1") @@ -2571,8 +2583,7 @@ void tst_Dumpers::dumper_data() % Check("atts.attList.2.localname", "\"localPart3\"", "@QString") % Check("atts.attList.2.qname", "\"name3\"", "@QString") % Check("atts.attList.2.uri", "\"uri3\"", "@QString") - % Check("atts.attList.2.value", "\"value3\"", "@QString") - % Check("atts.d", "", "@QXmlAttributesPrivate"); + % Check("atts.attList.2.value", "\"value3\"", "@QString"); QTest::newRow("StdArray") << Data("#include <array>\n" @@ -2583,8 +2594,8 @@ void tst_Dumpers::dumper_data() % CoreProfile() % Cxx11Profile() % MacLibCppProfile() - % Check("a", "<4 items>", "std::array<int, 4u>") - % Check("b", "<4 items>", "std::array<@QString, 4u>"); + % Check("a", "<4 items>", Pattern("std::array<int, 4.*>")) + % Check("b", "<4 items>", Pattern("std::array<@QString, 4.*>")); QTest::newRow("StdComplex") << Data("#include <complex>\n", @@ -2657,6 +2668,7 @@ void tst_Dumpers::dumper_data() "h.insert(194);\n" "h.insert(2);\n" "h.insert(3);\n") + % GdbOnly() % Profile("QMAKE_CXXFLAGS += -Wno-deprecated") % Check("h", "<4 items>", "__gnu__cxx::hash_set<int>") % Check("h.0", "[0]", "194", "int") @@ -3122,7 +3134,9 @@ void tst_Dumpers::dumper_data() "v.push_back(true);\n" "v.push_back(false);\n" "unused(&v);\n") - % Check("v", "<5 items>", "std::vector<bool>") + % Check("v", "<5 items>", "std::vector<bool>").setForGdbOnly() + // Known issue: Clang produces "std::vector<std::allocator<bool>> + % Check("v", "<5 items>", "std::vector<std::allocator<bool>>").setForLldbOnly() % Check("v.0", "[0]", "1", "bool") % Check("v.1", "[1]", "0", "bool") % Check("v.2", "[2]", "0", "bool") @@ -3134,10 +3148,12 @@ void tst_Dumpers::dumper_data() "std::vector<bool> v1(65, true);\n" "std::vector<bool> v2(65);\n" "unused(&v1, &v2);\n") - % Check("v1", "<65 items>", "std::vector<bool>") + % Check("v1", "<65 items>", "std::vector<bool>").setForGdbOnly() + % Check("v1", "<65 items>", "std::vector<std::allocator<bool>>").setForLldbOnly() % Check("v1.0", "[0]", "1", "bool") % Check("v1.64", "[64]", "1", "bool") - % Check("v2", "<65 items>", "std::vector<bool>") + % Check("v2", "<65 items>", "std::vector<bool>").setForGdbOnly() + % Check("v2", "<65 items>", "std::vector<std::allocator<bool>>").setForLldbOnly() % Check("v2.0", "[0]", "0", "bool") % Check("v2.64", "[64]", "0", "bool"); @@ -3703,15 +3719,11 @@ void tst_Dumpers::dumper_data() % CoreProfile() % Check("vm", "<6 items>", "@QVariantMap") % Check("vm.0", "[0]", "", "@QMapNode<@QString, @QVariant>") - % Check("vm.0.key", Value4("\"a\""), "@QString") - % Check("vm.0.value", Value4("1"), "@QVariant (int)") - % Check("vm.0.key", Value5("\"b\""), "@QString") - % Check("vm.0.value", Value5("2"), "@QVariant (int)") + % Check("vm.0.key", "\"a\"", "@QString") + % Check("vm.0.value", "1", "@QVariant (int)") % Check("vm.5", "[5]", "", "@QMapNode<@QString, @QVariant>") - % Check("vm.5.key", Value4("\"f\""), "@QString") - % Check("vm.5.value", Value4("\"2Some String\""), "@QVariant (QString)") - % Check("vm.5.key", Value5("\"f\""), "@QString") - % Check("vm.5.value", Value5("\"2Some String\""), "@QVariant (QString)"); + % Check("vm.5.key", "\"f\"", "@QString") + % Check("vm.5.value", "\"2Some String\"", "@QVariant (QString)"); QTest::newRow("QVariantHash1") << Data("#include <QVariant>\n", diff --git a/tests/auto/externaltool/externaltool.pro b/tests/auto/externaltool/externaltool.pro index 5af23b7e4e..bc16a794f3 100644 --- a/tests/auto/externaltool/externaltool.pro +++ b/tests/auto/externaltool/externaltool.pro @@ -1,9 +1,9 @@ -IDE_BUILD_TREE = $$OUT_PWD/../../../ +QTC_PLUGIN_DEPENDS += coreplugin include(../qttest.pri) -include(../../../src/plugins/coreplugin/coreplugin.pri) +include($$IDE_SOURCE_TREE/src/plugins/coreplugin/coreplugin_dependencies.pri) +include($$IDE_SOURCE_TREE/src/libs/utils/utils_dependencies.pri) + LIBS *= -L$$IDE_PLUGIN_PATH/QtProject -INCLUDEPATH *= $$IDE_SOURCE_TREE/src/plugins/coreplugin -INCLUDEPATH *= $$IDE_BUILD_TREE/src/plugins/coreplugin SOURCES += tst_externaltooltest.cpp \ $$IDE_SOURCE_TREE/src/plugins/coreplugin/externaltool.cpp diff --git a/tests/auto/externaltool/tst_externaltooltest.cpp b/tests/auto/externaltool/tst_externaltooltest.cpp index 3958a40f51..bfda597354 100644 --- a/tests/auto/externaltool/tst_externaltooltest.cpp +++ b/tests/auto/externaltool/tst_externaltooltest.cpp @@ -50,8 +50,7 @@ static const char TEST_XML1[] = " <arguments>%{CurrentProjectFilePath}</arguments>" " <workingdirectory>%{CurrentProjectPath}</workingdirectory>" " </executable>" -"</externaltool>" -; +"</externaltool>"; static const char TEST_XML2[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" @@ -213,7 +212,8 @@ void ExternaltoolTest::testReadLocale() QCOMPARE(tool->description(), QString::fromLatin1("Grüezi")); QCOMPARE(tool->displayName(), QString::fromLatin1("Grüezi")); QCOMPARE(tool->displayCategory(), QString::fromLatin1("Grüezi")); - delete tool;} + delete tool; +} QTEST_APPLESS_MAIN(ExternaltoolTest); diff --git a/tests/auto/generichighlighter/highlighterengine/basetextdocumentlayout.cpp b/tests/auto/generichighlighter/highlighterengine/basetextdocumentlayout.cpp new file mode 100644 index 0000000000..ca5cf2e561 --- /dev/null +++ b/tests/auto/generichighlighter/highlighterengine/basetextdocumentlayout.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "basetextdocumentlayout.h" + +TextBlockUserData *BaseTextDocumentLayout::userData(const QTextBlock &block) +{ + TextBlockUserData *data = static_cast<TextBlockUserData*>(block.userData()); + if (!data && block.isValid()) + const_cast<QTextBlock &>(block).setUserData((data = new TextBlockUserData)); + return data; +} diff --git a/tests/auto/generichighlighter/highlighterengine/basetextdocumentlayout.h b/tests/auto/generichighlighter/highlighterengine/basetextdocumentlayout.h index 2692cfc791..55baf40d6b 100644 --- a/tests/auto/generichighlighter/highlighterengine/basetextdocumentlayout.h +++ b/tests/auto/generichighlighter/highlighterengine/basetextdocumentlayout.h @@ -34,13 +34,21 @@ // Replaces the "real" basetextdocumentlayout.h file. +struct CodeFormatterData {}; + struct TextBlockUserData : QTextBlockUserData { - virtual ~TextBlockUserData(){} + TextBlockUserData() : m_data(0) {} + virtual ~TextBlockUserData() {} void setFoldingStartIncluded(const bool) {} void setFoldingEndIncluded(const bool) {} void setFoldingIndent(const int) {} + void setCodeFormatterData(CodeFormatterData *data) { m_data = data; } + CodeFormatterData *codeFormatterData() { return m_data; } + CodeFormatterData *m_data; }; +namespace BaseTextDocumentLayout { TextBlockUserData *userData(const QTextBlock &block); } + #endif // BASETEXTDOCUMENTLAYOUT_H diff --git a/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro b/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro index 55d8711bbb..8a7b79a51b 100644 --- a/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro +++ b/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro @@ -7,6 +7,7 @@ SOURCES += \ tst_highlighterengine.cpp \ highlightermock.cpp \ formats.cpp \ + basetextdocumentlayout.cpp \ syntaxhighlighter.cpp \ $$GENERICHIGHLIGHTERDIR/highlighter.cpp \ $$GENERICHIGHLIGHTERDIR/context.cpp \ diff --git a/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs b/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs index b8e214df86..e09b3161b4 100644 --- a/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs +++ b/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs @@ -31,7 +31,7 @@ Autotest { Group { name: "Drop-in sources for the plugin" files: [ - "basetextdocumentlayout.h", + "basetextdocumentlayout.h", "basetextdocumentlayout.cpp", "syntaxhighlighter.h", "syntaxhighlighter.cpp", "tabsettings.h" ] diff --git a/tests/auto/qml/persistenttrie/persistenttrie.pro b/tests/auto/qml/persistenttrie/persistenttrie.pro index d4273773c5..c9da2c9dac 100644 --- a/tests/auto/qml/persistenttrie/persistenttrie.pro +++ b/tests/auto/qml/persistenttrie/persistenttrie.pro @@ -3,9 +3,9 @@ include(../../qttest.pri) DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\" DEFINES+=TESTSRCDIR=\\\"$$PWD\\\" -include($$IDE_SOURCE_TREE/src/libs/utils/utils.pri) -include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils.pri) -include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs.pri) +include($$IDE_SOURCE_TREE/src/libs/utils/utils-lib.pri) +include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils-lib.pri) +include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs-lib.pri) TARGET = tst_trie_check diff --git a/tests/auto/qml/persistenttrie/tst_testtrie.cpp b/tests/auto/qml/persistenttrie/tst_testtrie.cpp index 52370b221d..958e6b65da 100644 --- a/tests/auto/qml/persistenttrie/tst_testtrie.cpp +++ b/tests/auto/qml/persistenttrie/tst_testtrie.cpp @@ -350,7 +350,7 @@ void interactiveCompletionTester(){ res = matchStrengthSort(line,res); qDebug() << "possible completions:["; foreach (const QString &s, res) { - qDebug() << s; + qDebug() << matchStrength(line,s) << " " << s; } qDebug() << "]"; } diff --git a/tests/designer/gotoslot_insertIntoCorrectClass_non-pointer/form.cpp b/tests/designer/gotoslot_insertIntoCorrectClass_non-pointer/form.cpp new file mode 100644 index 0000000000..5e246d377b --- /dev/null +++ b/tests/designer/gotoslot_insertIntoCorrectClass_non-pointer/form.cpp @@ -0,0 +1,9 @@ +// Copyright header + +#include "form.h" + +Form::Form(QWidget *parent) : + QWidget(parent) +{ + ui.setupUi(this); +} diff --git a/tests/designer/gotoslot_insertIntoCorrectClass_non-pointer/form.h b/tests/designer/gotoslot_insertIntoCorrectClass_non-pointer/form.h new file mode 100644 index 0000000000..4f35262bea --- /dev/null +++ b/tests/designer/gotoslot_insertIntoCorrectClass_non-pointer/form.h @@ -0,0 +1,27 @@ +// Copyright header + +#ifndef FORM_H +#define FORM_H + +#include "ui_form.h" + +#include <QWidget> + +class Form; +struct MyClass +{ + Form *form; +}; + +class Form : public QWidget +{ + Q_OBJECT + +public: + explicit Form(QWidget *parent = 0); + +private: + Ui::Form ui; +}; + +#endif // FORM_H diff --git a/tests/designer/gotoslot_withoutProject/reference_form.cpp b/tests/designer/gotoslot_insertIntoCorrectClass_pointer/form.cpp index fc313de178..449bda3749 100644 --- a/tests/designer/gotoslot_withoutProject/reference_form.cpp +++ b/tests/designer/gotoslot_insertIntoCorrectClass_pointer/form.cpp @@ -14,9 +14,3 @@ Form::~Form() { delete ui; } - - -void Form::on_pushButton_clicked() -{ - -} diff --git a/tests/designer/gotoslot_withoutProject/reference_form.h b/tests/designer/gotoslot_insertIntoCorrectClass_pointer/form.h index 68e66ff679..3f5ddba574 100644 --- a/tests/designer/gotoslot_withoutProject/reference_form.h +++ b/tests/designer/gotoslot_insertIntoCorrectClass_pointer/form.h @@ -9,6 +9,12 @@ namespace Ui { class Form; } +class Form; +struct MyClass +{ + Form *form; +}; + class Form : public QWidget { Q_OBJECT @@ -17,9 +23,6 @@ public: explicit Form(QWidget *parent = 0); ~Form(); -private slots: - void on_pushButton_clicked(); - private: Ui::Form *ui; }; diff --git a/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.cpp b/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.cpp new file mode 100644 index 0000000000..449bda3749 --- /dev/null +++ b/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.cpp @@ -0,0 +1,16 @@ +// Copyright header + +#include "form.h" +#include "ui_form.h" + +Form::Form(QWidget *parent) : + QWidget(parent), + ui(new Ui::Form) +{ + ui->setupUi(this); +} + +Form::~Form() +{ + delete ui; +} diff --git a/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.h b/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.h new file mode 100644 index 0000000000..13fdfa5b23 --- /dev/null +++ b/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.h @@ -0,0 +1,28 @@ +// Copyright header + +#ifndef N_FORM_H +#define N_FORM_H + +#include <QWidget> + +namespace N { +namespace Ui { +class Form; +} +} + +using namespace N; + +class Form : public QWidget +{ + Q_OBJECT + +public: + explicit Form(QWidget *parent = 0); + ~Form(); + +private: + Ui::Form *ui; +}; + +#endif // N_FORM_H diff --git a/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.ui b/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.ui new file mode 100644 index 0000000000..ebe1479342 --- /dev/null +++ b/tests/designer/gotoslot_insertIntoCorrectClass_pointer_ns_using/form.ui @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>N::Form</class> + <widget class="QWidget" name="N::Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>60</x> + <y>60</y> + <width>80</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index ba55395eb3..ddadcea05c 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -176,6 +176,7 @@ void dummyStatement(...) {} #if USE_CXX11 #include <array> +#include <unordered_map> #endif #include <complex> #include <deque> @@ -2802,6 +2803,220 @@ namespace stdlist { } // namespace stdlist +namespace stdunorderedmap { + +#if USE_CXX11 + void testStdUnorderedMapStringFoo() + { + // This is not supposed to work with the compiled dumpers. + std::unordered_map<std::string, Foo> map; + map["22.0"] = Foo(22); + map["33.0"] = Foo(33); + map["44.0"] = Foo(44); + BREAK_HERE; + // Expand map map.0 map.0.second map.2 map.2.second. + // Check map <3 items> std::unordered_map<QString, Foo>. + // Check map.0 std::pair<QString const, Foo>. + // Check map.0.first "22.0" QString. + // CheckType map.0.second Foo. + // Check map.0.second.a 22 int. + // Check map.1 std::pair<QString const, Foo>. + // Check map.2.first "44.0" QString. + // CheckType map.2.second Foo. + // Check map.2.second.a 44 int. + // Continue. + dummyStatement(&map); + } + + void testStdUnorderedMapCharStarFoo() + { + std::unordered_map<const char *, Foo> map; + map["22.0"] = Foo(22); + map["33.0"] = Foo(33); + BREAK_HERE; + // Expand map map.0 map.0.first map.0.second map.1 map.1.second. + // Check map <2 items> std::unordered_map<char const*, Foo>. + // Check map.0 std::pair<char const* const, Foo>. + // CheckType map.0.first char *. + // Check map.0.first.*first 50 '2' char. + // CheckType map.0.second Foo. + // Check map.0.second.a 22 int. + // Check map.1 std::pair<char const* const, Foo>. + // CheckType map.1.first char *. + // Check map.1.first.*first 51 '3' char. + // CheckType map.1.second Foo. + // Check map.1.second.a 33 int. + // Continue. + dummyStatement(&map); + } + + void testStdUnorderedMapUIntUInt() + { + std::unordered_map<uint, uint> map; + map[11] = 1; + map[22] = 2; + BREAK_HERE; + // Expand map. + // Check map <2 items> std::unordered_map<unsigned int, unsigned int>. + // Check map.11 1 unsigned int. + // Check map.22 2 unsigned int. + // Continue. + dummyStatement(&map); + } + + void testStdUnorderedMapUIntStringList() + { +#if 0 + std::unordered_map<uint, QStringList> map; + map[11] = QStringList() << "11"; + map[22] = QStringList() << "22"; + BREAK_HERE; + // Expand map map.0 map.0.first map.0.second map.1 map.1.second. + // Check map <2 items> std::unordered_map<unsigned int, QStringList>. + // Check map.0 std::pair<unsigned int const, QStringList>. + // Check map.0.first 11 unsigned int. + // Check map.0.second <1 items> QStringList. + // Check map.0.second.0 "11" QString. + // Check map.1 std::pair<unsigned int const, QStringList>. + // Check map.1.first 22 unsigned int. + // Check map.1.second <1 items> QStringList. + // Check map.1.second.0 "22" QString. + // Continue. + dummyStatement(&map); +#endif + } + + void testStdUnorderedMapUIntStringListTypedef() + { +#if 0 + typedef std::unordered_map<uint, QStringList> T; + T map; + map[11] = QStringList() << "11"; + map[22] = QStringList() << "22"; + BREAK_HERE; + // Check map <2 items> stdmap::T. + // Continue. + dummyStatement(&map); +#endif + } + + void testStdUnorderedMapUIntFloat() + { + std::unordered_map<uint, float> map; + map[11] = 11.0; + map[22] = 22.0; + BREAK_HERE; + // Expand map. + // Check map <2 items> std::unordered_map<unsigned int, float>. + // Check map.11 11 float. + // Check map.22 22 float. + // Continue. + dummyStatement(&map); + } + + void testStdUnorderedMapUIntFloatIterator() + { + typedef std::unordered_map<int, float> Map; + Map map; + map[11] = 11.0; + map[22] = 22.0; + map[33] = 33.0; + map[44] = 44.0; + map[55] = 55.0; + map[66] = 66.0; + + Map::iterator it1 = map.begin(); + Map::iterator it2 = it1; ++it2; + Map::iterator it3 = it2; ++it3; + Map::iterator it4 = it3; ++it4; + Map::iterator it5 = it4; ++it5; + Map::iterator it6 = it5; ++it6; + + BREAK_HERE; + // Expand map. + // Check map <6 items> stdmap::Map. + // Check map.11 11 float. + // Check it1.first 11 int. + // Check it1.second 11 float. + // Check it6.first 66 int. + // Check it6.second 66 float. + // Continue. + dummyStatement(&map, &it1, &it2, &it3, &it4, &it5, &it6); + } + + void testStdUnorderedMapStringFloat() + { + std::unordered_map<std::string, float> map; + map["11.0"] = 11.0; + map["22.0"] = 22.0; + BREAK_HERE; + // Expand map map.0 map.1. + // Check map <2 items> std::unordered_map<QString, float>. + // Check map.0 std::pair<QString const, float>. + // Check map.0.first "11.0" QString. + // Check map.0.second 11 float. + // Check map.1 std::pair<QString const, float>. + // Check map.1.first "22.0" QString. + // Check map.1.second 22 float. + // Continue. + dummyStatement(&map); + } + + void testStdUnorderedMapIntString() + { + std::unordered_map<int, QString> map; + map[11] = "11.0"; + map[22] = "22.0"; + BREAK_HERE; + // Expand map map.0 map.1. + // Check map <2 items> std::unordered_map<int, QString>. + // Check map.0 std::pair<int const, QString>. + // Check map.0.first 11 int. + // Check map.0.second "11.0" QString. + // Check map.1 std::pair<int const, QString>. + // Check map.1.first 22 int. + // Check map.1.second "22.0" QString. + // Continue. + dummyStatement(&map); + } + + void testStdUnorderedMapStringPointer() + { + QObject ob; + std::unordered_map<std::string, QPointer<QObject> > map; + map["Hallo"] = QPointer<QObject>(&ob); + map["Welt"] = QPointer<QObject>(&ob); + map["."] = QPointer<QObject>(&ob); + BREAK_HERE; + // Expand map map.0 map.2. + // Check map <3 items> std::unordered_map<QString, QPointer<QObject>>. + // Check map.0 std::pair<QString const, QPointer<QObject>>. + // Check map.0.first "." QString. + // CheckType map.0.second QPointer<QObject>. + // Check map.2 std::pair<QString const, QPointer<QObject>>. + // Check map.2.first "Welt" QString. + // Continue. + dummyStatement(&map); + } +#endif + + void testStdUnorderedMap() + { +#if USE_CXX11 + testStdUnorderedMapStringFoo(); + testStdUnorderedMapCharStarFoo(); + testStdUnorderedMapUIntUInt(); + testStdUnorderedMapUIntStringList(); + testStdUnorderedMapUIntStringListTypedef(); + testStdUnorderedMapUIntFloat(); + testStdUnorderedMapUIntFloatIterator(); + testStdUnorderedMapStringFloat(); + testStdUnorderedMapIntString(); + testStdUnorderedMapStringPointer(); +#endif + } + +} // namespace stdunorderedmap namespace stdmap { @@ -3068,6 +3283,24 @@ namespace stdptr { } // namespace stdptr +namespace lambda { + + void testLambda() + { +#ifdef USE_CXX11 + std::string x; + auto f = [&] () -> const std::string & { + int z = x.size(); + return x; + }; + auto c = f(); + BREAK_HERE; + dummyStatement(&x, &f, &c); +#endif + } + +} // namespace lambda + namespace stdset { void testStdSetInt() @@ -5242,8 +5475,11 @@ namespace basic { void testLongEvaluation1() { + QTimeZone tz("UTC+05:00"); QDateTime time = QDateTime::currentDateTime(); const int N = 10000; + QDateTime x = time; + x.setTimeZone(tz); QDateTime bigv[N]; for (int i = 0; i < 10000; ++i) { bigv[i] = time; @@ -6853,12 +7089,14 @@ int main(int argc, char *argv[]) stdlist::testStdList(); stdhashset::testStdHashSet(); stdmap::testStdMap(); + stdunorderedmap::testStdUnorderedMap(); stdset::testStdSet(); stdstack::testStdStack(); stdstream::testStdStream(); stdstring::testStdString(); stdvector::testStdVector(); stdptr::testStdPtr(); + lambda::testLambda(); qbytearray::testQByteArray(); qdatetime::testDateTime(); diff --git a/tests/system/objects.map b/tests/system/objects.map index 5eff1a358e..85b9dbb58d 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -34,8 +34,8 @@ :Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'} :Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'} :Breakpoints_Debugger::Internal::BreakTreeView {container=':DebugModeWidget.Breakpoints_QDockWidget' type='Debugger::Internal::BreakTreeView' unnamed='1' visible='1'} -:CMake Wizard.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} -:CMake Wizard.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} +:CMake Wizard.Cancel_QPushButton {text='Cancel' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} +:CMake Wizard.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} :CMake Wizard.Generator:_QLabel {text='Generator:' type='QLabel' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} :CMake Wizard.Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} :CMake Wizard.Run CMake_QPushButton {text='Run CMake' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} @@ -82,8 +82,8 @@ :FormEditorStack_qdesigner_internal::FormWindow {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' type='qdesigner_internal::FormWindow' unnamed='1' visible='1'} :FormEditorStack_qdesigner_internal::PropertyLineEdit {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' type='qdesigner_internal::PropertyLineEdit' unnamed='1' visible='1'} :Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'} -:Git Repository Clone.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} -:Git Repository Clone.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' unnamed='1' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} +:Git Repository Clone.Cancel_QPushButton {text='Cancel' type='QPushButton' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} +:Git Repository Clone.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} :Git Repository Clone.Repository_QGroupBox {name='repositoryGroupBox' title='Repository' type='QGroupBox' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} :Git Repository Clone.Result._QLabel {name='statusLabel' type='QLabel' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} :Git Repository Clone.Working Copy_QGroupBox {name='localGroupBox' title='Working Copy' type='QGroupBox' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} @@ -94,9 +94,6 @@ :Go to slot_QDialog {name='SelectSignalDialog' type='QDialog' visible='1' windowTitle='Go to slot'} :Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Installed Plugins.Close_QPushButton {text='Close' type='QPushButton' unnamed='1' visible='1' window=':Installed Plugins_Core::Internal::PluginDialog'} -:Installed Plugins.categoryWidget_QTreeWidget {name='categoryWidget' type='QTreeWidget' visible='1' window=':Installed Plugins_Core::Internal::PluginDialog'} -:Installed Plugins_Core::Internal::PluginDialog {type='Core::Internal::PluginDialog' unnamed='1' visible='1' windowTitle='Installed Plugins'} :JavaScript.QmlProfilerEventsTable_QmlProfiler::Internal::QV8ProfilerEventsMainView {container=':*Qt Creator.JavaScript_QDockWidget' name='QmlProfilerEventsTable' type='QmlProfiler::Internal::QV8ProfilerEventsMainView' visible='1'} :Kits_Or_Compilers_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'} :Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' occurrence='5' type='QComboBox' unnamed='1' visible='1'} @@ -128,7 +125,6 @@ :Qt Creator.Help_Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'} :Qt Creator.Project.Menu.File_QMenu {name='Project.Menu.File' type='QMenu' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Project.Menu.Project_QMenu {name='Project.Menu.Project' type='QMenu' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.ReRun_QToolButton {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' 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 6048482eaf..5a34aac4a3 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -65,10 +65,6 @@ def __addSignalHandlerDict__(lazySignalHandlerFunction): installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), handlers) return wrappedFunction -# returns the currently assigned handler functions for a given object and signal -def getInstalledSignalHandlers(name, signalSignature): - return installedSignalHandlers.get("%s____%s" % (name,signalSignature)) - # this method checks the last build (if there's one) and logs the number of errors, warnings and # lines within the Issues output # optional parameter can be used to tell this function if the build was expected to fail or not diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 3646ea647d..add51cdff4 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -154,7 +154,12 @@ def __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls): selectFromCombo(comboBox, "Qt Quick 2.0") else: 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")) + return requires # Selects the Qt versions for a project # 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) 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 # param path specifies where to create the project # param projectName is the name for the new project @@ -256,7 +285,8 @@ def createNewQtQuickApplication(workingDir, projectName = None, fromWelcome=False, withControls=False): available = __createProjectOrFileSelectType__(" Applications", "Qt Quick Application", fromWelcome) projectName = __createProjectSetNameAndPath__(workingDir, projectName) - __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls) + requiredQt = __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls) + __modifyAvailableTargets__(available, requiredQt) checkedTargets = __chooseTargets__(targets, available) snooze(1) clickButton(waitForObject(":Next_QPushButton")) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 3279980aab..b46499d8b2 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -112,19 +112,16 @@ def selectFromLocator(filter, itemName = None): doubleClick(wantedItem, 5, 5, 0, Qt.LeftButton) def wordUnderCursor(window): - cursor = window.textCursor() - oldposition = cursor.position() - cursor.movePosition(QTextCursor.StartOfWord) - cursor.movePosition(QTextCursor.EndOfWord, QTextCursor.KeepAnchor) - returnValue = cursor.selectedText() - cursor.setPosition(oldposition) - return returnValue + return textUnderCursor(window, QTextCursor.StartOfWord, QTextCursor.EndOfWord) def lineUnderCursor(window): + return textUnderCursor(window, QTextCursor.StartOfLine, QTextCursor.EndOfLine) + +def textUnderCursor(window, fromPos, toPos): cursor = window.textCursor() oldposition = cursor.position() - cursor.movePosition(QTextCursor.StartOfLine) - cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor) + cursor.movePosition(fromPos) + cursor.movePosition(toPos, QTextCursor.KeepAnchor) returnValue = cursor.selectedText() cursor.setPosition(oldposition) return returnValue diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index d1d4180bef..6507db3289 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -65,7 +65,7 @@ def main(): return # wait until search finished and verify search results waitFor("searchFinished", 20000) - validateSearchResult(18) + validateSearchResult(14) result = re.search("QmlApplicationViewer", str(editorWidget.plainText)) test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. " "File with used text is opened.") diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 42837a730a..e45c41e5c3 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -34,24 +34,34 @@ import re # test search in help mode and advanced search searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False } + def __getSelectedText__(): + hv = findObject(":Qt Creator_Help::Internal::HelpViewer") try: - selText = findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText + selText = hv.selectedText if className(selText) != 'instancemethod': return str(selText) except: pass try: - hv = findObject(":Qt Creator_Help::Internal::HelpViewer") selText = getHighlightsInHtml(str(hv.toHtml())) except: test.warning("Could not get highlighted text.") selText = '' return str(selText) -def __handleTextChanged__(obj): - global textHasChanged - textHasChanged = True +def __getUrl__(): + helpViewer = findObject(":Qt Creator_Help::Internal::HelpViewer") + try: + url = helpViewer.url + except: + try: + url = helpViewer.source + except: + return "" + if isQt4Build: + return str(url.toString()) + return str(url.scheme) + "://" + str(url.host) + str(url.path) def getHighlightsInHtml(htmlCode): pattern = re.compile('color:#ff0000;">(.*?)</span>') @@ -60,16 +70,14 @@ def getHighlightsInHtml(htmlCode): if curr.group(1) in res: continue res += "%s " % curr.group(1) - test.log(res) return res def main(): - global sdkPath, textHasChanged + global sdkPath noMatch = "Your search did not match any documents." startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - installLazySignalHandler(":Qt Creator_Help::Internal::HelpViewer", "textChanged()", "__handleTextChanged__") addHelpDocumentation([os.path.join(sdkPath, "Documentation", "qt.qch")]) # switch to help mode switchViewTo(ViewConstants.HELP) @@ -98,13 +106,13 @@ def main(): test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits'," "str(findObject(':Hits_QLabel').text))", 2000), "Verifying if search results found with 1+ hits for: " + searchKeyword) - textHasChanged = False selText = __getSelectedText__() + url = __getUrl__() # click in the widget, tab to first item and press enter mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton) type(waitForObject(":Hits_QCLuceneResultWidget"), "<Tab>") type(waitForObject(":Hits_QCLuceneResultWidget"), "<Return>") - waitFor("textHasChanged or selText != __getSelectedText__()") + waitFor("__getUrl__() != url or selText != __getSelectedText__()") # verify if search keyword is found in results test.verify(searchKeyword.lower() in __getSelectedText__().lower(), searchKeyword + " search result can be found") @@ -138,12 +146,12 @@ def main(): mouseClick(resultsView, 1, 1, 0, Qt.LeftButton) type(resultsView, "<Tab>") type(resultsView, "<Return>") - test.verify("printing" in str(findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText).lower(), + test.verify("printing" in str(__getSelectedText__()).lower(), "printing advanced search result can be found") for i in range(2): type(resultsView, "<Tab>") type(resultsView, "<Return>") - test.verify("sql" in str(findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText).lower(), + test.verify("sql" in str(__getSelectedText__()).lower(), "sql advanced search result can be found") # verify if simple search is properly disabled test.verify(findObject(":Qt Creator.Help_Search for:_QLineEdit").enabled == False, diff --git a/tests/system/suite_HELP/tst_HELP06/test.py b/tests/system/suite_HELP/tst_HELP06/test.py index 9e7c45e3c8..18ab04a353 100755 --- a/tests/system/suite_HELP/tst_HELP06/test.py +++ b/tests/system/suite_HELP/tst_HELP06/test.py @@ -59,10 +59,8 @@ def main(): manualQModelIndex = getQModelIndexStr("text?='Qt Creator Manual *'", ":Qt Creator_QHelpContentWidget") doubleClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton) - gettingStartedQModelIndex = getQModelIndexStr("text='Getting Started'", manualQModelIndex) - doubleClick(gettingStartedQModelIndex, 5, 5, 0, Qt.LeftButton) mouseClick(waitForObject(getQModelIndexStr("text='Building and Running an Example'", - gettingStartedQModelIndex)), 5, 5, 0, Qt.LeftButton) + manualQModelIndex)), 5, 5, 0, Qt.LeftButton) # open bookmarks window clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py index 06f6808532..e2865380cf 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/test.py +++ b/tests/system/suite_debugger/tst_simple_analyze/test.py @@ -88,8 +88,8 @@ def main(): waitFor('"Elapsed: 5" in str(elapsedLabel.text)', 20000) clickButton(stopButton) if safeClickTab("JavaScript"): - model = waitForObject(":JavaScript.QmlProfilerEventsTable_QmlProfiler::" - "Internal::QV8ProfilerEventsMainView").model() + model = findObject(":JavaScript.QmlProfilerEventsTable_QmlProfiler::" + "Internal::QV8ProfilerEventsMainView").model() test.compare(model.rowCount(), 0) if safeClickTab("Events"): colPercent, colTotal, colCalls, colMean, colMedian, colLongest, colShortest = range(2, 9) diff --git a/tests/system/suite_editors/tst_basic_cpp_support/test.py b/tests/system/suite_editors/tst_basic_cpp_support/test.py index 91e6618243..106c45c5b6 100644 --- a/tests/system/suite_editors/tst_basic_cpp_support/test.py +++ b/tests/system/suite_editors/tst_basic_cpp_support/test.py @@ -92,9 +92,10 @@ def main(): if not waitFor("'dummy.cpp ' in str(mainWin.windowTitle) and ' - cplusplus-tools - ' in str(mainWin.windowTitle)", 5000): test.warning("Opening dummy.cpp seems to have failed") # Reset cursor to the start of the document - cursor = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget").textCursor() - cursor.movePosition(QTextCursor.Start) - cppwindow.setTextCursor(cursor) + if platform.system() == 'Darwin': + type(cppwindow, "<Home>") + else: + type(cppwindow, "<Ctrl+Home>") type(cppwindow, "<Ctrl+F>") clickButton(waitForObject(":*Qt Creator_Utils::IconButton")) 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 77fee043a2..deab7eb5be 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -33,7 +33,7 @@ import re def main(): global tmpSettingsDir - global textChanged + quickCombinations = [[1,False], [2,False], [2,True]] sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection") qmlFile = os.path.join("qml", "textselection.qml") if not neededFilePresent(os.path.join(sourceExample, qmlFile)): @@ -42,9 +42,6 @@ def main(): startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - overrideInstallLazySignalHandler() - installLazySignalHandler(":frame.templateDescription_QTextBrowser", - "textChanged()","__handleTextChanged__") kits = getConfiguredKits() test.log("Collecting potential project types...") availableProjectTypes = [] @@ -71,59 +68,67 @@ def main(): for template in dumpItems(templatesView.model(), templatesView.rootIndex()): template = template.replace(".", "\\.") # skip non-configurable - if not (template in ("Qt Quick 1 UI", "Qt Quick 2 UI", "Qt Quick 2 UI with Controls") - or "(CMake Build)" in template or "(Qbs Build)" in template): + if (template != "Qt Quick UI" and "(CMake Build)" not in template + and "(Qbs Build)" not in template): availableProjectTypes.append({category:template}) 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...") - 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("\\.", "."))) - textChanged = False - clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) - waitFor("textChanged", 2000) - text = waitForObject(":frame.templateDescription_QTextBrowser").plainText - displayedPlatforms = __getSupportedPlatforms__(str(text), 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) + displayedPlatforms = __createProject__(category, template) + if template == "Qt Quick Application": + for counter, qComb in enumerate(quickCombinations): + requiredQtVersion = __createProjectHandleQtQuickSelection__(qComb[0], qComb[1]) + __modifyAvailableTargets__(displayedPlatforms, requiredQtVersion, True) + verifyKitCheckboxes(kits, displayedPlatforms) + # FIXME: if QTBUG-35203 is fixed replace by triggering the shortcut for Back + clickButton(waitForObject("{type='QPushButton' text='Cancel'}")) + # are there more Quick combinations - then recreate this project + if counter < len(quickCombinations) - 1: + displayedPlatforms = __createProject__(category, template) + continue try: waitForObject("{name='mainQmlFileGroupBox' title='Main HTML File' type='QGroupBox' visible='1'}", 1000) clickButton(waitForObject(":Next_QPushButton")) except LookupError: - try: - waitForObject("{text='Select Existing QML file' type='QLabel' visible='1'}", 1000) - baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}") - 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'}")) + pass + verifyKitCheckboxes(kits, displayedPlatforms) + clickButton(waitForObject("{type='QPushButton' text='Cancel'}")) invokeMenuItem("File", "Exit") -def __handleTextChanged__(*args): - global textChanged - textChanged = True +def verifyKitCheckboxes(kits, displayedPlatforms): + 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)) + +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 diff --git a/tests/system/suite_tools/tst_git_clone/test.py b/tests/system/suite_tools/tst_git_clone/test.py index 6ccbfb760b..576cc6d094 100644 --- a/tests/system/suite_tools/tst_git_clone/test.py +++ b/tests/system/suite_tools/tst_git_clone/test.py @@ -33,24 +33,28 @@ cloneUrl = "https://codereview.qt-project.org/p/qt-labs/jom" cloneDir = "myCloneOfJom" def verifyCloneLog(targetDir, canceled): + # Expect fails because of QTCREATORBUG-10531 cloneLog = waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit") - waitFor('"The process terminated " in str(cloneLog.plainText)', 30000) - test.verify(("Executing in " + targetDir + ":" in str(cloneLog.plainText)), - "Searching for target directory in clone log") - test.verify((" ".join(["clone", cloneUrl, cloneDir]) in str(cloneLog.plainText)), - "Searching for git parameters in clone log") - test.verify(("Stopping..." in str(cloneLog.plainText)) ^ (not canceled), - "Searching for 'Stopping...' in clone log") + finish = findObject(":Git Repository Clone.Finish_QPushButton") + waitFor("finish.enabled", 30000) + test.xverify(("Executing in " + targetDir + ":" in str(cloneLog.plainText)), + "Searching for target directory in clone log") + test.xverify((" ".join(["clone", cloneUrl, cloneDir]) in str(cloneLog.plainText)), + "Searching for git parameters in clone log") if canceled: + test.xverify("Stopping..." in str(cloneLog.plainText), + "Searching for 'Stopping...' in clone log") result = "The process terminated in an abnormal way." summary = "Failed." else: + test.verify(not "Stopping..." in str(cloneLog.plainText), + "Searching for 'Stopping...' in clone log") test.verify(("'" + cloneDir + "'..." in str(cloneLog.plainText)), "Searching for clone directory in clone log") result = "The process terminated with exit code 0." summary = "Succeeded." - test.verify((result in str(cloneLog.plainText)), - "Searching for result (%s) in clone log:\n%s" + test.xverify((result in str(cloneLog.plainText)), + "Searching for result (%s) in clone log:\n%s" % (result, str(cloneLog.plainText))) test.compare(waitForObject(":Git Repository Clone.Result._QLabel").text, summary) |