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

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: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent dd4e185e
...@@ -234,7 +234,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface, ...@@ -234,7 +234,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
void QtTestParser::init(const QStringList &filesToParse) void QtTestParser::init(const QStringList &filesToParse)
{ {
m_testCaseNames = TestTreeModel::instance()->testCaseNamesForFiles(filesToParse); m_testCaseNames = TestTreeModel::instance()->testCaseNamesForFiles(id(), filesToParse);
CppParser::init(filesToParse); CppParser::init(filesToParse);
} }
......
...@@ -261,14 +261,16 @@ void TestTreeModel::sweep() ...@@ -261,14 +261,16 @@ void TestTreeModel::sweep()
#endif #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; QHash<QString, QString> result;
if (!m_qtTestRootItem) TestTreeItem *rootNode = rootItemForFramework(id);
return result; QTC_ASSERT(rootNode, return result);
for (int row = 0, count = m_qtTestRootItem->childCount(); row < count; ++row) { for (int row = 0, count = rootNode->childCount(); row < count; ++row) {
const TestTreeItem *child = m_qtTestRootItem->childItem(row); const TestTreeItem *child = rootNode->childItem(row);
if (files.contains(child->filePath())) { if (files.contains(child->filePath())) {
result.insert(child->filePath(), child->name()); result.insert(child->filePath(), child->name());
} }
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
void markAllForRemoval(); void markAllForRemoval();
void markForRemoval(const QString &filePath); void markForRemoval(const QString &filePath);
void sweep(); void sweep();
QHash<QString, QString> testCaseNamesForFiles(QStringList files); QHash<QString, QString> testCaseNamesForFiles(const Core::Id &id, const QStringList &files);
signals: signals:
void testTreeModelChanged(); void testTreeModelChanged();
......
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