Commit 36f6a558 authored by Christian Stenger's avatar Christian Stenger
Browse files

AutoTest: Unify handling of test tree items...



...and let specialized items handle its specialization by itself.

Change-Id: I988ce3c610bef68933b9102bb39ae4723add3a99
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 009eef4e
......@@ -428,6 +428,31 @@ static QMap<QString, TestCodeLocationList> checkForDataTags(const QString &fileN
/****** end of helpers ******/
static void checkQmlDocumentForTestCode(QFutureInterface<TestParseResult> futureInterface,
const QmlJS::Document::Ptr &qmlJSDoc,
const QString &proFile = QString())
{
QmlJS::AST::Node *ast = qmlJSDoc->ast();
QTC_ASSERT(ast, return);
TestQmlVisitor qmlVisitor(qmlJSDoc);
QmlJS::AST::Node::accept(ast, &qmlVisitor);
const QString testCaseName = qmlVisitor.testCaseName();
const TestCodeLocationAndType tcLocationAndType = qmlVisitor.testCaseLocation();
const QMap<QString, TestCodeLocationAndType> testFunctions = qmlVisitor.testFunctions();
TestParseResult parseResult(TestTreeModel::QuickTest);
parseResult.proFile = proFile;
parseResult.functions = testFunctions;
if (!testCaseName.isEmpty()) {
parseResult.fileName = tcLocationAndType.m_name;
parseResult.testCaseName = testCaseName;
parseResult.line = tcLocationAndType.m_line;
parseResult.column = tcLocationAndType.m_column;
}
futureInterface.reportResult(parseResult);
}
static void handleQtQuickTest(QFutureInterface<TestParseResult> futureInterface,
CPlusPlus::Document::Ptr document)
{
......@@ -437,32 +462,17 @@ static void handleQtQuickTest(QFutureInterface<TestParseResult> futureInterface,
return;
const QString cppFileName = document->fileName();
QList<CppTools::ProjectPart::Ptr> ppList = modelManager->projectPart(cppFileName);
QTC_ASSERT(!ppList.isEmpty(), return);
const QString &proFile = ppList.at(0)->projectFile;
const QString srcDir = quickTestSrcDir(modelManager, cppFileName);
if (srcDir.isEmpty())
return;
const QList<QmlJS::Document::Ptr> qmlDocs = scanDirectoryForQuickTestQmlFiles(srcDir);
foreach (const QmlJS::Document::Ptr &qmlJSDoc, qmlDocs) {
QmlJS::AST::Node *ast = qmlJSDoc->ast();
QTC_ASSERT(ast, continue);
TestQmlVisitor qmlVisitor(qmlJSDoc);
QmlJS::AST::Node::accept(ast, &qmlVisitor);
const QString testCaseName = qmlVisitor.testCaseName();
const TestCodeLocationAndType tcLocationAndType = qmlVisitor.testCaseLocation();
const QMap<QString, TestCodeLocationAndType> testFunctions = qmlVisitor.testFunctions();
TestParseResult parseResult(TestTreeModel::QuickTest);
parseResult.referencingFile = cppFileName;
parseResult.functions = testFunctions;
if (!testCaseName.isEmpty()) {
parseResult.fileName = tcLocationAndType.m_name;
parseResult.testCaseName = testCaseName;
parseResult.line = tcLocationAndType.m_line;
parseResult.column = tcLocationAndType.m_column;
}
futureInterface.reportResult(parseResult);
}
foreach (const QmlJS::Document::Ptr &qmlJSDoc, qmlDocs)
checkQmlDocumentForTestCode(futureInterface, qmlJSDoc, proFile);
}
static void handleGTest(QFutureInterface<TestParseResult> futureInterface, const QString &filePath)
......@@ -480,14 +490,14 @@ static void handleGTest(QFutureInterface<TestParseResult> futureInterface, const
const CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance();
QList<CppTools::ProjectPart::Ptr> ppList = cppMM->projectPart(filePath);
if (ppList.size())
proFile = ppList.at(0)->projectFile;
proFile = ppList.first()->projectFile;
foreach (const GTestCaseSpec &testSpec, result.keys()) {
TestParseResult parseResult(TestTreeModel::GoogleTest);
parseResult.fileName = filePath;
parseResult.testCaseName = testSpec.testCaseName;
parseResult.parameterized = testSpec.parameterized;
parseResult.referencingFile = proFile;
parseResult.proFile = proFile;
parseResult.dataTagsOrTestSets.insert(QString(), result.value(testSpec));
futureInterface.reportResult(parseResult);
}
......@@ -495,7 +505,7 @@ static void handleGTest(QFutureInterface<TestParseResult> futureInterface, const
static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInterface,
CPlusPlus::Document::Ptr document,
const QString &referencingFile = QString())
QMap<QString, QString> testCaseNames)
{
const QString fileName = document->fileName();
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
......@@ -508,11 +518,13 @@ static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInt
if (includesQtQuickTest(document, modelManager)) {
handleQtQuickTest(futureInterface, document);
return;
}
if (includesQtTest(document, modelManager) && qtTestLibDefined(modelManager, fileName)) {
} else if (testCaseNames.contains(fileName) // if we do a reparse
|| (includesQtTest(document, modelManager)
&& qtTestLibDefined(modelManager, fileName))) {
QString testCaseName(testClass(modelManager, document));
// we might be in a reparse without the original entry point with the QTest::qExec()
if (testCaseName.isEmpty())
testCaseName = testCaseNames.value(fileName);
if (!testCaseName.isEmpty()) {
unsigned line = 0;
unsigned column = 0;
......@@ -521,8 +533,6 @@ static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInt
if (declaringDoc.isNull())
return;
const bool hasReferencingFile = declaringDoc->fileName() != document->fileName();
TestVisitor visitor(testCaseName);
visitor.accept(declaringDoc->globalNamespace());
const QMap<QString, TestCodeLocationAndType> testFunctions = visitor.privateSlots();
......@@ -530,7 +540,7 @@ static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInt
QMap<QString, TestCodeLocationList> dataTags =
checkForDataTags(declaringDoc->fileName(), testFunctions);
if (hasReferencingFile)
if (declaringDoc->fileName() != document->fileName())
dataTags.unite(checkForDataTags(document->fileName(), testFunctions));
TestParseResult parseResult(TestTreeModel::AutoTest);
......@@ -540,27 +550,13 @@ static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInt
parseResult.column = column;
parseResult.functions = testFunctions;
parseResult.dataTagsOrTestSets = dataTags;
if (hasReferencingFile)
parseResult.referencingFile = fileName;
parseResult.proFile = projParts.first()->projectFile;
futureInterface.reportResult(parseResult);
return;
}
}
if (includesGTest(document, modelManager)) {
if (hasGTestNames(document)) {
} else if (includesGTest(document, modelManager)) {
if (hasGTestNames(document))
handleGTest(futureInterface, document->fileName());
return;
}
}
// could not find the class to test, or QTest is not included and QT_TESTLIB_LIB defined
// maybe file is only a referenced file
if (!referencingFile.isEmpty()) {
CPlusPlus::Snapshot snapshot = modelManager->snapshot();
if (snapshot.contains(referencingFile))
checkDocumentForTestCode(futureInterface, snapshot.find(referencingFile).value());
}
}
......@@ -569,21 +565,22 @@ static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInt
static bool parsingHasFailed;
static void performParse(QFutureInterface<TestParseResult> &futureInterface,
const QStringList &list, const QMap<QString, QString> &referencingFiles)
const QStringList &list, const QMap<QString, QString> testCaseNames)
{
int progressValue = 0;
futureInterface.setProgressRange(0, list.size());
futureInterface.setProgressValue(progressValue);
CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance();
CPlusPlus::Snapshot snapshot = cppMM->snapshot();
QmlJS::Snapshot qmlSnapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot();
foreach (const QString &file, list) {
if (snapshot.contains(file)) {
if (file.endsWith(QLatin1String(".qml"))) {
checkQmlDocumentForTestCode(futureInterface, qmlSnapshot.document(file));
} else if (snapshot.contains(file)) {
CPlusPlus::Document::Ptr doc = snapshot.find(file).value();
futureInterface.setProgressValue(++progressValue);
const QString &referencingFile = referencingFiles.value(file);
checkDocumentForTestCode(futureInterface, doc,
list.contains(referencingFile) ? QString() : referencingFile);
checkDocumentForTestCode(futureInterface, doc, testCaseNames);
} else {
parsingHasFailed |= (CppTools::ProjectFile::classify(file)
!= CppTools::ProjectFile::Unclassified);
......@@ -617,10 +614,11 @@ void TestCodeParser::onCppDocumentUpdated(const CPlusPlus::Document::Ptr &docume
void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document)
{
const QString &fileName = document->fileName();
if (m_codeModelParsing) {
if (!m_fullUpdatePostponed) {
m_partialUpdatePostponed = true;
m_postponedFiles.insert(document->fileName());
m_postponedFiles.insert(fileName);
}
return;
}
......@@ -628,18 +626,12 @@ void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document)
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
if (!project)
return;
const QString fileName = document->fileName();
if (!project->files(ProjectExplorer::Project::AllFiles).contains(fileName)) {
// what if the file is not listed inside the pro file, but will be used anyway?
return;
}
const CPlusPlus::Snapshot snapshot = CppTools::CppModelManager::instance()->snapshot();
const QString &referencingFile = m_model->referencingFiles().value(fileName);
if (!referencingFile.isEmpty() && snapshot.contains(referencingFile)) {
qCDebug(LOG) << "calling scanForTests with cached referencing files"
<< "(onQmlDocumentUpdated)";
scanForTests(QStringList(referencingFile));
}
scanForTests(QStringList(fileName));
}
void TestCodeParser::onStartupProjectChanged(ProjectExplorer::Project *project)
......@@ -724,16 +716,20 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
parsingHasFailed = false;
QMap<QString, QString> referencingFiles = m_model->referencingFiles();
QMap<QString, QString> testCaseNames;
if (isFullParse) {
// remove qml files as they will be found automatically by the referencing cpp file
list = Utils::filtered(list, [] (const QString &fn) {
return !fn.endsWith(QLatin1String(".qml"));
});
m_model->markAllForRemoval();
} else {
testCaseNames = m_model->testCaseNamesForFiles(list);
foreach (const QString &filePath, list)
m_model->markForRemoval(filePath);
}
QFuture<TestParseResult> future
= Utils::runAsync(&performParse, list, referencingFiles);
QFuture<TestParseResult> future = Utils::runAsync(&performParse, list, testCaseNames);
m_futureWatcher.setFuture(future);
if (list.size() > 5) {
Core::ProgressManager::addTask(future, tr("Scanning for Tests"),
......
......@@ -63,25 +63,7 @@ TestConfiguration::~TestConfiguration()
m_testCases.clear();
}
void basicProjectInformation(Project *project, const QString &mainFilePath, QString *proFile,
QString *displayName, Project **targetProject)
{
CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance();
QList<CppTools::ProjectPart::Ptr> projParts = cppMM->projectInfo(project).projectParts();
foreach (const CppTools::ProjectPart::Ptr &part, projParts) {
foreach (const CppTools::ProjectFile currentFile, part->files) {
if (currentFile.path == mainFilePath) {
*proFile = part->projectFile;
*displayName = part->displayName;
*targetProject = part->project;
return;
}
}
}
}
void basicProjectInformation(Project *project, const QString &proFile, QString *displayName,
void completeBasicProjectInformation(Project *project, const QString &proFile, QString *displayName,
Project **targetProject)
{
CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance();
......@@ -105,7 +87,7 @@ static bool isLocal(RunConfiguration *runConfiguration)
void TestConfiguration::completeTestInformation()
{
QTC_ASSERT(!m_mainFilePath.isEmpty() || !m_proFile.isEmpty(), return);
QTC_ASSERT(!m_proFile.isEmpty(), return);
Project *project = SessionManager::startupProject();
if (!project)
......@@ -114,7 +96,6 @@ void TestConfiguration::completeTestInformation()
QString targetFile;
QString targetName;
QString workDir;
QString proFile = m_proFile;
QString displayName;
QString buildDir;
Project *targetProject = 0;
......@@ -123,10 +104,7 @@ void TestConfiguration::completeTestInformation()
bool guessedRunConfiguration = false;
setProject(0);
if (m_proFile.isEmpty())
basicProjectInformation(project, m_mainFilePath, &proFile, &displayName, &targetProject);
else
basicProjectInformation(project, proFile, &displayName, &targetProject);
completeBasicProjectInformation(project, m_proFile, &displayName, &targetProject);
Target *target = project->activeTarget();
if (!target)
......@@ -135,7 +113,7 @@ void TestConfiguration::completeTestInformation()
BuildTargetInfoList appTargets = target->applicationTargets();
foreach (const BuildTargetInfo &bti, appTargets.list) {
// some project manager store line/column information as well inside ProjectPart
if (bti.isValid() && proFile.startsWith(bti.projectFilePath.toString())) {
if (bti.isValid() && m_proFile.startsWith(bti.projectFilePath.toString())) {
targetFile = Utils::HostOsInfo::withExecutableSuffix(bti.targetFilePath.toString());
targetName = bti.targetName;
break;
......@@ -146,8 +124,8 @@ void TestConfiguration::completeTestInformation()
if (auto buildConfig = target->activeBuildConfiguration()) {
const QString buildBase = buildConfig->buildDirectory().toString();
const QString projBase = targetProject->projectDirectory().toString();
if (proFile.startsWith(projBase))
buildDir = QFileInfo(buildBase + proFile.mid(projBase.length())).absolutePath();
if (m_proFile.startsWith(projBase))
buildDir = QFileInfo(buildBase + m_proFile.mid(projBase.length())).absolutePath();
}
}
......@@ -180,7 +158,6 @@ void TestConfiguration::completeTestInformation()
}
}
setProFile(proFile);
setDisplayName(displayName);
if (hasDesktopTarget) {
......@@ -215,11 +192,6 @@ void TestConfiguration::setTestCaseCount(int count)
m_testCaseCount = count;
}
void TestConfiguration::setMainFilePath(const QString &mainFile)
{
m_mainFilePath = mainFile;
}
void TestConfiguration::setTargetFile(const QString &targetFile)
{
m_targetFile = targetFile;
......
......@@ -51,7 +51,6 @@ public:
void setTestCases(const QStringList &testCases);
void setTestCaseCount(int count);
void setMainFilePath(const QString &mainFile);
void setTargetFile(const QString &targetFile);
void setTargetName(const QString &targetName);
void setProFile(const QString &proFile);
......
......@@ -110,12 +110,9 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
// do not provide this menu entry for unnamed Quick Tests as it makes no sense
int type = index.data(TypeRole).toInt();
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::GTestCase)
|| (type == TestTreeItem::GTestCaseParameterized)
|| (type == TestTreeItem::GTestName)) {
if ((type == TestTreeItem::TestFunctionOrSet && index.parent().data().toString() != unnamed)
|| (type == TestTreeItem::TestCase && index.data().toString() != unnamed)
|| (type == TestTreeItem::TestDataTag)) {
runThisTest = new QAction(tr("Run This Test"), &menu);
runThisTest->setEnabled(enabled);
connect(runThisTest, &QAction::triggered,
......@@ -259,11 +256,8 @@ void TestNavigationWidget::onRunThisTestTriggered()
return;
TestTreeItem *item = static_cast<TestTreeItem *>(sourceIndex.internalPointer());
if (item->type() == TestTreeItem::TestClass || item->type() == TestTreeItem::TestFunction
|| item->type() == TestTreeItem::TestDataTag
|| item->type() == TestTreeItem::GTestCase
|| item->type() == TestTreeItem::GTestCaseParameterized
|| item->type() == TestTreeItem::GTestName) {
if (item->type() == TestTreeItem::TestCase || item->type() == TestTreeItem::TestFunctionOrSet
|| item->type() == TestTreeItem::TestDataTag) {
if (TestConfiguration *configuration = m_model->getTestConfiguration(item)) {
TestRunner *runner = TestRunner::instance();
runner->setSelectedTests( {configuration} );
......
......@@ -42,20 +42,9 @@ TestTreeItem::TestTreeItem(const QString &name, const QString &filePath, Type ty
m_filePath(filePath),
m_type(type),
m_line(0),
m_state(Enabled),
m_markedForRemoval(false)
{
switch (m_type) {
case TestClass:
case TestFunction:
case GTestCase:
case GTestCaseParameterized:
case GTestName:
m_checked = Qt::Checked;
break;
default:
m_checked = Qt::Unchecked;
}
m_checked = (m_type == TestCase || m_type == TestFunctionOrSet) ? Qt::Checked : Qt::Unchecked;
}
static QIcon testTreeIcon(TestTreeItem::Type type)
......@@ -66,8 +55,6 @@ static QIcon testTreeIcon(TestTreeItem::Type type)
QIcon(QLatin1String(":/images/func.png")),
QIcon(QLatin1String(":/images/data.png"))
};
if (type == TestTreeItem::GTestCase || type == TestTreeItem::GTestCaseParameterized)
return icons[1];
if (int(type) >= int(sizeof icons / sizeof *icons))
return icons[2];
......@@ -82,12 +69,10 @@ QVariant TestTreeItem::data(int /*column*/, int role) const
return QString(m_name + QObject::tr(" (none)"));
else if (m_name.isEmpty())
return QObject::tr(Constants::UNNAMED_QUICKTESTS);
else if (m_type == GTestCaseParameterized)
return QString(m_name + QObject::tr(" [parameterized]"));
else
return m_name;
case Qt::ToolTipRole:
if (m_type == TestClass && m_name.isEmpty()) {
if (m_type == TestCase && m_name.isEmpty()) {
return QObject::tr("<p>Give all test cases a name to ensure correct behavior "
"when running test cases and to be able to select them.</p>");
}
......@@ -101,12 +86,9 @@ QVariant TestTreeItem::data(int /*column*/, int role) const
case TestSpecialFunction:
case TestDataTag:
return QVariant();
case TestClass:
case GTestCase:
case GTestCaseParameterized:
case TestCase:
return m_name.isEmpty() ? QVariant() : checked();
case TestFunction:
case GTestName:
case TestFunctionOrSet:
if (parentItem() && parentItem()->name().isEmpty())
return QVariant();
return checked();
......@@ -123,17 +105,15 @@ QVariant TestTreeItem::data(int /*column*/, int role) const
case TestDataFunction:
case TestSpecialFunction:
return true;
case TestClass:
case TestCase:
return m_name.isEmpty();
case TestFunction:
case TestFunctionOrSet:
return parentItem() ? parentItem()->name().isEmpty() : false;
default:
return false;
}
case TypeRole:
return m_type;
case StateRole:
return (int)m_state;
}
return QVariant();
}
......@@ -171,22 +151,6 @@ bool TestTreeItem::modifyDataTagContent(const QString &fileName,
return hasBeenModified;
}
bool TestTreeItem::modifyGTestSetContent(const QString &fileName, const QString &referencingFile,
const TestCodeLocationAndType &location)
{
bool hasBeenModified = modifyFilePath(fileName);
if (m_referencingFile != referencingFile) {
m_referencingFile = referencingFile;
hasBeenModified = true;
}
hasBeenModified |= modifyLineAndColumn(location.m_line, location.m_column);
if (m_state != location.m_state) {
m_state = location.m_state;
hasBeenModified = true;
}
return hasBeenModified;
}
bool TestTreeItem::modifyLineAndColumn(unsigned line, unsigned column)
{
bool hasBeenModified = false;
......@@ -204,15 +168,12 @@ bool TestTreeItem::modifyLineAndColumn(unsigned line, unsigned column)
void TestTreeItem::setChecked(const Qt::CheckState checkState)
{
switch (m_type) {
case TestFunction:
case GTestName: {
case TestFunctionOrSet: {
m_checked = (checkState == Qt::Unchecked ? Qt::Unchecked : Qt::Checked);
parentItem()->revalidateCheckState();
break;
}
case TestClass:
case GTestCase:
case GTestCaseParameterized: {
case TestCase: {
Qt::CheckState usedState = (checkState == Qt::Unchecked ? Qt::Unchecked : Qt::Checked);
for (int row = 0, count = childCount(); row < count; ++row)
childItem(row)->setChecked(usedState);
......@@ -226,11 +187,8 @@ void TestTreeItem::setChecked(const Qt::CheckState checkState)
Qt::CheckState TestTreeItem::checked() const
{
switch (m_type) {
case TestClass:
case TestFunction:
case GTestCase:
case GTestCaseParameterized:
case GTestName:
case TestCase:
case TestFunctionOrSet:
return m_checked;
case TestDataFunction:
case TestSpecialFunction:
......@@ -271,11 +229,10 @@ TestTreeItem *TestTreeItem::findChildByName(const QString &name)
});
}
TestTreeItem *TestTreeItem::findChildByFiles(const QString &filePath,
const QString &referencingFile)
TestTreeItem *TestTreeItem::findChildByFile(const QString &filePath)
{
return findChildBy([filePath, referencingFile](const TestTreeItem *other) -> bool {
return other->filePath() == filePath && other->referencingFile() == referencingFile;
return findChildBy([filePath](const TestTreeItem *other) -> bool {
return other->filePath() == filePath;
});
}
......@@ -286,16 +243,6 @@ TestTreeItem *TestTreeItem::findChildByNameAndFile(const QString &name, const QS
});
}
TestTreeItem *TestTreeItem::findChildByNameTypeAndFile(const QString &name, TestTreeItem::Type type,
const QString &referencingFile)
{
return findChildBy([name, type, referencingFile](const TestTreeItem *other) -> bool {
return other->referencingFile() == referencingFile
&& other->name() == name
&& other->type() == type;
});
}
void TestTreeItem::revalidateCheckState()
{
if (childCount() == 0)
......@@ -352,9 +299,8 @@ TestTreeItem *TestTreeItem::findChildBy(CompareFunction compare)
AutoTestTreeItem *AutoTestTreeItem::createTestItem(const TestParseResult &result)
{
AutoTestTreeItem *item = new AutoTestTreeItem(result.testCaseName, result.fileName,
TestTreeItem::TestClass);
item->setReferencingFile(result.referencingFile);
AutoTestTreeItem *item = new AutoTestTreeItem(result.testCaseName, result.fileName, TestCase);
item->setProFile(result.proFile);
item->setLine(result.line);
item->setColumn(result.column);
......@@ -392,9 +338,8 @@ AutoTestTreeItem *AutoTestTreeItem::createDataTagItem(const QString &fileName,
QuickTestTreeItem *QuickTestTreeItem::createTestItem(const TestParseResult &result)
{
QuickTestTreeItem *item = new QuickTestTreeItem(result.testCaseName, result.fileName,
TestTreeItem::TestClass);
item->setReferencingFile(result.referencingFile);
QuickTestTreeItem *item = new QuickTestTreeItem(result.testCaseName, result.fileName, TestCase);
item->setProFile(result.proFile);
item->setLine(result.line);
item->setColumn(result.column);
foreach (const QString &functionName, result.functions.keys())
......@@ -413,7 +358,7 @@ QuickTestTreeItem *QuickTestTreeItem::createFunctionItem(const QString &function
QuickTestTreeItem *QuickTestTreeItem::createUnnamedQuickTestItem(const TestParseResult &result)
{
QuickTestTreeItem *item = new QuickTestTreeItem(QString(), QString(), TestTreeItem::TestClass);
QuickTestTreeItem *item = new QuickTestTreeItem(QString(), QString(), TestCase);
foreach (const QString &functionName, result.functions.keys())
item->appendChild(createUnnamedQuickFunctionItem(functionName, result));
return item;
......@@ -426,15 +371,16 @@ QuickTestTreeItem *QuickTestTreeItem::createUnnamedQuickFunctionItem(const QStri
QuickTestTreeItem *item = new QuickTestTreeItem(functionName, location.m_name, location.m_type);
item->setLine(location.m_line);
item->setColumn(location.m_column);
item->setReferencingFile(result.referencingFile);
item->setProFile(result.proFile);
return item;
}
GoogleTestTreeItem *GoogleTestTreeItem::createTestItem(const TestParseResult &result)
{
GoogleTestTreeItem *item = new GoogleTestTreeItem(result.testCaseName, QString(),
result.parameterized ? TestTreeItem::GTestCaseParameterized : TestTreeItem::GTestCase);
item->setReferencingFile(result.referencingFile);
GoogleTestTreeItem *item = new GoogleTestTreeItem(result.testCaseName, QString(), TestCase);
item->setProFile(result.proFile);
if (result.parameterized)
item->setState(Parameterized);
foreach (const TestCodeLocationAndType &location, result.dataTagsOrTestSets.first())
item->appendChild(createTestSetItem(result, location));