AutoTestTreeItem *AutoTestTreeItem::createDataTagItem(const QString &fileName, const TestCodeLocationAndType &location) { AutoTestTreeItem *tagItem = new AutoTestTreeItem(location.m_name, fileName, location.m_type); tagItem->setLine(location.m_line); tagItem->setColumn(location.m_column); return tagItem; }
AutoTestTreeItem *AutoTestTreeItem::createFunctionItem(const QString &functionName, const TestCodeLocationAndType &location, const TestCodeLocationList &dataTags) { AutoTestTreeItem *item = new AutoTestTreeItem(functionName, location.m_name, location.m_type); item->setLine(location.m_line); item->setColumn(location.m_column); // if there are any data tags for this function add them foreach (const TestCodeLocationAndType &tagLocation, dataTags) item->appendChild(createDataTagItem(location.m_name, tagLocation)); return item; }
AutoTestTreeItem *AutoTestTreeItem::createTestItem(const TestParseResult &result) { AutoTestTreeItem *item = new AutoTestTreeItem(result.testCaseName, result.fileName, TestCase); item->setProFile(result.proFile); item->setLine(result.line); item->setColumn(result.column); foreach (const QString &functionName, result.functions.keys()) { const TestCodeLocationAndType &locationAndType = result.functions.value(functionName); const QString qualifiedName = result.testCaseName + QLatin1String("::") + functionName; item->appendChild(createFunctionItem(functionName, locationAndType, result.dataTagsOrTestSets.value(qualifiedName))); } return item; }