Add capability to run gtest related tests

For now this only applies for 'Run All'. To be able to run only
selected tests we first have to introduce the check state for
gtest related items as well.

Change-Id: I196b56b7fe426f846f2be0df7e21458c2733cbd1
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
Christian Stenger
2015-12-09 09:46:33 +01:00
parent db0ff4f940
commit 650be0e496
11 changed files with 228 additions and 43 deletions

View File

@@ -236,6 +236,27 @@ QList<TestConfiguration *> TestTreeModel::getAllTestCases() const
result << tc;
}
foundMains.clear();
// get all Google Tests
for (int row = 0, count = m_googleTestRootItem->childCount(); row < count; ++row) {
const TestTreeItem *child = m_googleTestRootItem->childItem(row);
for (int childRow = 0, childCount = child->childCount(); childRow < childCount; ++childRow) {
const QString &proFilePath = child->childItem(childRow)->mainFile();
foundMains.insert(proFilePath, foundMains.contains(proFilePath)
? foundMains.value(proFilePath) + 1 : 1);
}
}
foreach (const QString &proFile, foundMains.keys()) {
TestConfiguration *tc = new TestConfiguration(QString(), QStringList(),
foundMains.value(proFile));
tc->setProFile(proFile);
tc->setProject(project);
tc->setTestType(TestConfiguration::GTest);
result << tc;
}
return result;
}