AutoTest: Store referencing file inside test tree item

This duplicates (temporarily) the information for referencing files,
but the cache inside the parser will be removed within a later patch.

Change-Id: I7377864547f0d9ce074fa409b9c12067c4329d40
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
Christian Stenger
2016-01-25 09:30:41 +01:00
parent 3d5bb6d0bb
commit 1caeb9bb63
5 changed files with 56 additions and 1 deletions

View File

@@ -971,13 +971,17 @@ void TestCodeParser::updateModelAndCppDocMap(CPlusPlus::Document::Ptr document,
foreach (const QString &file, files) {
const bool setReferencingFile = (files.size() == 2 && file == declaringFile);
ReferencingInfo testInfo;
if (setReferencingFile)
if (setReferencingFile) {
testInfo.referencingFile = fileName;
testItem->setReferencingFile(fileName);
}
testInfo.type = TestTreeModel::AutoTest;
m_referencingFiles.insert(file, testInfo);
}
emit testItemModified(testItem, TestTreeModel::AutoTest, files);
} else {
if (declaringFile != fileName)
testItem->setReferencingFile(fileName);
emit testItemCreated(testItem, TestTreeModel::AutoTest);
ReferencingInfo testInfo;
testInfo.type = TestTreeModel::AutoTest;
@@ -1005,6 +1009,7 @@ void TestCodeParser::updateModelAndQuickDocMap(QmlJS::Document::Ptr document,
ReferencingInfo testInfo;
testInfo.referencingFile = referencingFile;
testInfo.type = TestTreeModel::QuickTest;
testItem->setReferencingFile(referencingFile);
emit testItemModified(testItem, TestTreeModel::QuickTest, { fileName });
m_referencingFiles.insert(fileName, testInfo);
} else {
@@ -1015,6 +1020,7 @@ void TestCodeParser::updateModelAndQuickDocMap(QmlJS::Document::Ptr document,
ReferencingInfo testInfo;
testInfo.referencingFile = referencingFile;
testInfo.type = TestTreeModel::QuickTest;
testItem->setReferencingFile(referencingFile);
emit testItemCreated(testItem, TestTreeModel::QuickTest);
m_referencingFiles.insert(filePath, testInfo);
}