Commit 0d114c60 authored by Christian Stenger's avatar Christian Stenger
Browse files

Add 'Run This Test' capability to data tags



Change-Id: I3eb99f0a0652053cb05a3457a37ff335bab5580b
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent e092c5b5
......@@ -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} );
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment