forked from qt-creator/qt-creator
AutoTest: Pass parameter by reference and use framework id...
...for determining from which root node test cases names are needed. Another preparation for introducing test frameworks. Change-Id: I02910f3e4736d9be6e6822eea7863fc62252d4db Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -234,7 +234,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
|
||||
void QtTestParser::init(const QStringList &filesToParse)
|
||||
{
|
||||
m_testCaseNames = TestTreeModel::instance()->testCaseNamesForFiles(filesToParse);
|
||||
m_testCaseNames = TestTreeModel::instance()->testCaseNamesForFiles(id(), filesToParse);
|
||||
CppParser::init(filesToParse);
|
||||
}
|
||||
|
||||
|
@@ -261,14 +261,16 @@ void TestTreeModel::sweep()
|
||||
#endif
|
||||
}
|
||||
|
||||
QHash<QString, QString> TestTreeModel::testCaseNamesForFiles(QStringList files)
|
||||
// TODO move this function to qtest framework folder as it's only necessary there
|
||||
QHash<QString, QString> TestTreeModel::testCaseNamesForFiles(const Core::Id &id,
|
||||
const QStringList &files)
|
||||
{
|
||||
QHash<QString, QString> result;
|
||||
if (!m_qtTestRootItem)
|
||||
return result;
|
||||
TestTreeItem *rootNode = rootItemForFramework(id);
|
||||
QTC_ASSERT(rootNode, return result);
|
||||
|
||||
for (int row = 0, count = m_qtTestRootItem->childCount(); row < count; ++row) {
|
||||
const TestTreeItem *child = m_qtTestRootItem->childItem(row);
|
||||
for (int row = 0, count = rootNode->childCount(); row < count; ++row) {
|
||||
const TestTreeItem *child = rootNode->childItem(row);
|
||||
if (files.contains(child->filePath())) {
|
||||
result.insert(child->filePath(), child->name());
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ public:
|
||||
void markAllForRemoval();
|
||||
void markForRemoval(const QString &filePath);
|
||||
void sweep();
|
||||
QHash<QString, QString> testCaseNamesForFiles(QStringList files);
|
||||
QHash<QString, QString> testCaseNamesForFiles(const Core::Id &id, const QStringList &files);
|
||||
|
||||
signals:
|
||||
void testTreeModelChanged();
|
||||
|
Reference in New Issue
Block a user