diff options
author | Robert Loehning <robert.loehning@theqtcompany.com> | 2015-05-19 11:22:36 +0200 |
---|---|---|
committer | Robert Loehning <robert.loehning@theqtcompany.com> | 2015-05-19 11:22:36 +0200 |
commit | 8df59beb6a99fdc30d76cc0aa72b2d91441b3d77 (patch) | |
tree | 5905c76083522ed909aad666587f2347a34eab77 | |
parent | bbc656f3d37da9bb4bfe74a57c8e17b035fbd0ec (diff) | |
parent | c5fad3756006429026165a345b9eadcd4b5425df (diff) | |
download | qt-creator-8df59beb6a99fdc30d76cc0aa72b2d91441b3d77.tar.gz |
Merge branch '3.4' into wip/squish
Change-Id: Iee6bcc93f49d504d9ea531038c669f4f59d3feba
-rw-r--r-- | plugins/autotest/testresultspane.cpp | 2 | ||||
-rw-r--r-- | plugins/autotest/testtreemodel.cpp | 3 | ||||
-rw-r--r-- | plugins/autotest/testvisitor.cpp | 23 | ||||
-rw-r--r-- | shared/autotest/src.pro | 6 |
4 files changed, 24 insertions, 10 deletions
diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp index 149d988a19..e5d9bd6084 100644 --- a/plugins/autotest/testresultspane.cpp +++ b/plugins/autotest/testresultspane.cpp @@ -100,11 +100,13 @@ void TestResultsPane::createToolButtons() m_runAll = new QToolButton(m_treeView); m_runAll->setIcon(QIcon(QLatin1String(":/images/run.png"))); m_runAll->setToolTip(tr("Run All Tests")); + m_runAll->setEnabled(false); connect(m_runAll, &QToolButton::clicked, this, &TestResultsPane::onRunAllTriggered); m_runSelected = new QToolButton(m_treeView); m_runSelected->setIcon(QIcon(QLatin1String(":/images/runselected.png"))); m_runSelected->setToolTip(tr("Run Selected Tests")); + m_runSelected->setEnabled(false); connect(m_runSelected, &QToolButton::clicked, this, &TestResultsPane::onRunSelectedTriggered); m_stopTestRun = new QToolButton(m_treeView); diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 823508c036..1e40493c02 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -663,7 +663,8 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const QString TestTreeModel::getMainFileForUnnamedQuickTest(const QString &qmlFile) const { const TestTreeItem *unnamed = unnamedQuickTests(); - for (int row = 0, count = unnamed->childCount(); row < count; ++row) { + const int count = unnamed ? unnamed->childCount() : 0; + for (int row = 0; row < count; ++row) { const TestTreeItem *child = unnamed->child(row); if (qmlFile == child->filePath()) return child->mainFile(); diff --git a/plugins/autotest/testvisitor.cpp b/plugins/autotest/testvisitor.cpp index b43a0c0271..2d38cb56b4 100644 --- a/plugins/autotest/testvisitor.cpp +++ b/plugins/autotest/testvisitor.cpp @@ -34,6 +34,12 @@ namespace Autotest { namespace Internal { +// names of special functions (applies for QTest as well as Quick Tests) +static QList<QString> specialFunctions = QList<QString>() << QLatin1String("initTestCase") + << QLatin1String("cleanupTestCase") + << QLatin1String("init") + << QLatin1String("cleanup"); + /************************** Cpp Test Symbol Visitor ***************************/ TestVisitor::TestVisitor(const QString &fullQualifiedClassName) @@ -45,11 +51,6 @@ TestVisitor::~TestVisitor() { } -static QList<QString> specialFunctions = QList<QString>() << QLatin1String("initTestCase") - << QLatin1String("cleanupTestCase") - << QLatin1String("init") - << QLatin1String("cleanup"); - bool TestVisitor::visit(CPlusPlus::Class *symbol) { const CPlusPlus::Overview o; @@ -177,13 +178,21 @@ bool TestQmlVisitor::visit(QmlJS::AST::UiScriptBinding *ast) bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast) { const QStringRef name = ast->name; - if (name.startsWith(QLatin1String("test_"))) { + if (name.startsWith(QLatin1String("test_")) + || name.startsWith(QLatin1String("benchmark_")) + || name.endsWith(QLatin1String("_data")) + || specialFunctions.contains(name.toString())) { const auto sourceLocation = ast->firstSourceLocation(); TestCodeLocationAndType locationAndType; locationAndType.m_fileName = m_currentDoc->fileName(); locationAndType.m_line = sourceLocation.startLine; locationAndType.m_column = sourceLocation.startColumn - 1; - locationAndType.m_type = TestTreeItem::TEST_FUNCTION; + if (specialFunctions.contains(name.toString())) + locationAndType.m_type = TestTreeItem::TEST_SPECIALFUNCTION; + else if (name.endsWith(QLatin1String("_data"))) + locationAndType.m_type = TestTreeItem::TEST_DATAFUNCTION; + else + locationAndType.m_type = TestTreeItem::TEST_FUNCTION; m_testFunctions.insert(name.toString(), locationAndType); } diff --git a/shared/autotest/src.pro b/shared/autotest/src.pro index 26f9b3a152..61fbe2a5bc 100644 --- a/shared/autotest/src.pro +++ b/shared/autotest/src.pro @@ -1,7 +1,9 @@ @if "%RequireGUI%" == "true" -QT += gui widgets +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @else -QT += console +QT -= gui +CONFIG += console CONFIG -= app_bundle @endif |