Commit b13373e4 authored by Christian Stenger's avatar Christian Stenger
Browse files

Enable 'Run This Test' for gtest items



Change-Id: Ia0fb93a4bbc225c45352f0f818262f5b6ff9d6d6
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent a88d3df3
......@@ -106,7 +106,9 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
const QString &unnamed = tr(Constants::UNNAMED_QUICKTESTS);
if ((type == TestTreeItem::TestFunction && index.parent().data().toString() != unnamed)
|| (type == TestTreeItem::TestClass && index.data().toString() != unnamed)
|| (type == TestTreeItem::TestDataTag)) {
|| (type == TestTreeItem::TestDataTag)
|| (type == TestTreeItem::GTestCase)
|| (type == TestTreeItem::GTestName)) {
runThisTest = new QAction(tr("Run This Test"), &menu);
runThisTest->setEnabled(enabled);
connect(runThisTest, &QAction::triggered,
......@@ -251,7 +253,9 @@ void TestNavigationWidget::onRunThisTestTriggered()
TestTreeItem *item = static_cast<TestTreeItem *>(sourceIndex.internalPointer());
if (item->type() == TestTreeItem::TestClass || item->type() == TestTreeItem::TestFunction
|| item->type() == TestTreeItem::TestDataTag) {
|| item->type() == TestTreeItem::TestDataTag
|| item->type() == TestTreeItem::GTestCase
|| item->type() == TestTreeItem::GTestName) {
if (TestConfiguration *configuration = m_model->getTestConfiguration(item)) {
TestRunner *runner = TestRunner::instance();
runner->setSelectedTests( {configuration} );
......
......@@ -461,6 +461,26 @@ TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item)
config->setProject(project);
break;
}
case TestTreeItem::GTestCase: {
if (int childCount = item->childCount()) {
config = new TestConfiguration(QString(),
QStringList(item->name() + QLatin1String(".*")));
config->setTestCaseCount(childCount);
config->setProFile(item->childItem(0)->mainFile());
config->setProject(project);
config->setTestType(TestConfiguration::GTest);
}
break;
}
case TestTreeItem::GTestName: {
const TestTreeItem *parent = item->parentItem();
config = new TestConfiguration(QString(),
QStringList(parent->name() + QLatin1Char('.') + item->name()));
config->setProFile(item->mainFile());
config->setProject(project);
config->setTestType(TestConfiguration::GTest);
break;
}
// not supported items
default:
return 0;
......
Supports Markdown
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