diff options
author | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-08-18 10:19:28 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-09-09 13:26:46 +0300 |
commit | 0d114c602d391f4d34146efcbdfa9f714bc5bac6 (patch) | |
tree | c9a12ba948d8bee5950c8585c34624031f9f7bc0 | |
parent | e092c5b51ddd8cd3dd6f0d32358ec4ae6198b75e (diff) | |
download | qt-creator-0d114c602d391f4d34146efcbdfa9f714bc5bac6.tar.gz |
Add 'Run This Test' capability to data tags
Change-Id: I3eb99f0a0652053cb05a3457a37ff335bab5580b
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
-rw-r--r-- | plugins/autotest/testnavigationwidget.cpp | 6 | ||||
-rw-r--r-- | plugins/autotest/testtreemodel.cpp | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/plugins/autotest/testnavigationwidget.cpp b/plugins/autotest/testnavigationwidget.cpp index ad1a496b5f..354e2869a5 100644 --- a/plugins/autotest/testnavigationwidget.cpp +++ b/plugins/autotest/testnavigationwidget.cpp @@ -103,7 +103,8 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event) int type = index.data(TypeRole).toInt(); const QString &unnamed = tr(Constants::UNNAMED_QUICKTESTS); if ((type == TestTreeItem::TEST_FUNCTION && index.parent().data().toString() != unnamed) - || (type == TestTreeItem::TEST_CLASS && index.data().toString() != unnamed)) { + || (type == TestTreeItem::TEST_CLASS && index.data().toString() != unnamed) + || (type == TestTreeItem::TEST_DATATAG)) { runThisTest = new QAction(tr("Run This Test"), &menu); runThisTest->setEnabled(enabled); connect(runThisTest, &QAction::triggered, @@ -247,7 +248,8 @@ void TestNavigationWidget::onRunThisTestTriggered() return; TestTreeItem *item = static_cast<TestTreeItem *>(sourceIndex.internalPointer()); - if (item->type() == TestTreeItem::TEST_CLASS || item->type() == TestTreeItem::TEST_FUNCTION) { + if (item->type() == TestTreeItem::TEST_CLASS || item->type() == TestTreeItem::TEST_FUNCTION + || item->type() == TestTreeItem::TEST_DATATAG) { if (TestConfiguration *configuration = m_model->getTestConfiguration(item)) { TestRunner *runner = TestRunner::instance(); runner->setSelectedTests( {configuration} ); diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 0e3b09b439..0b43688982 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -558,6 +558,17 @@ TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item) } break; } + case TestTreeItem::TEST_DATATAG: { + const TestTreeItem *function = item->parent(); + const TestTreeItem *parent = function ? function->parent() : 0; + if (!parent) + return 0; + const QString functionWithTag = function->name() + QLatin1Char(':') + item->name(); + config = new TestConfiguration(parent->name(), QStringList() << functionWithTag); + config->setMainFilePath(parent->filePath()); + config->setProject(project); + break; + } // not supported items default: return 0; |