summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2022-09-01 12:38:06 +0200
committerChristian Stenger <christian.stenger@qt.io>2022-09-06 06:23:41 +0000
commitb842620810ff2e604ce855167378ff19a7b66dfe (patch)
tree9724210234e34e91f31f44b9e0aa85db51a356b2
parentd2b23f6e403c238aa958959f1cdec184344e142f (diff)
downloadqt-creator-b842620810ff2e604ce855167378ff19a7b66dfe.tar.gz
Squish: Support other files of test cases as well
There may be additional script files or other files located at the same level of the test script or located in a folder structure beside the test script. Gather and display them at the navigation tree. Change-Id: Ia9598afeae764e44020a654e04086ccdfd2c4faf Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/squish/squishfilehandler.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/plugins/squish/squishfilehandler.cpp b/src/plugins/squish/squishfilehandler.cpp
index a6af32c24f..9e784f94b0 100644
--- a/src/plugins/squish/squishfilehandler.cpp
+++ b/src/plugins/squish/squishfilehandler.cpp
@@ -93,7 +93,8 @@ SquishTestTreeItem *createSuiteTreeItem(const QString &name,
SquishTestTreeItem *item = new SquishTestTreeItem(name, SquishTestTreeItem::SquishSuite);
item->setFilePath(filePath);
for (const QString &testCase : cases) {
- const Utils::FilePath testCaseDir = Utils::FilePath::fromString(testCase).parentDir();
+ const Utils::FilePath testCaseFP = Utils::FilePath::fromString(testCase);
+ const Utils::FilePath testCaseDir = testCaseFP.parentDir();
SquishTestTreeItem *child = new SquishTestTreeItem(testCaseDir.fileName(),
SquishTestTreeItem::SquishTestCase);
child->setFilePath(testCase);
@@ -101,6 +102,23 @@ SquishTestTreeItem *createSuiteTreeItem(const QString &name,
if (const Utils::FilePath data = testCaseDir.pathAppended("testdata"); data.isDir())
processSharedSubFolders(child, data, SharedType::SharedData);
+
+ for (auto &file : testCaseDir.dirEntries(QDir::AllEntries | QDir::NoDotAndDotDot)) {
+ // ignore current test script and testdata folder
+ const bool isDir = file.isDir();
+ if (file == testCaseFP || (isDir && file.fileName() == "testdata"))
+ continue;
+
+ SquishTestTreeItem *other
+ = new SquishTestTreeItem(file.fileName(),
+ isDir ? SquishTestTreeItem::SquishSharedFolder
+ : SquishTestTreeItem::SquishSharedFile);
+ other->setFilePath(file.toString());
+ if (isDir)
+ addAllEntriesRecursively(other, SharedType::SharedFoldersAndFiles);
+
+ child->appendChild(other);
+ }
}
const Utils::FilePath baseDir = Utils::FilePath::fromString(filePath).absolutePath();