AutoTest: Use Utils::FilePath for files and directories

Still some missing bits as some QString members had different meanings
depending on their context.

Change-Id: Ib48eab54498974a26bbd5123cbffeefee5f7e79c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2021-05-26 15:50:03 +02:00
parent e8286088b1
commit 5525f2b112
70 changed files with 376 additions and 371 deletions

View File

@@ -47,9 +47,10 @@ bool isQTestMacro(const QByteArray &macro)
return valid.contains(macro);
}
QHash<QString, QString> testCaseNamesForFiles(ITestFramework *framework, const QStringList &files)
QHash<Utils::FilePath, QString> testCaseNamesForFiles(ITestFramework *framework,
const Utils::FilePaths &files)
{
QHash<QString, QString> result;
QHash<Utils::FilePath, QString> result;
TestTreeItem *rootNode = framework->rootNode();
QTC_ASSERT(rootNode, return result);
@@ -64,17 +65,18 @@ QHash<QString, QString> testCaseNamesForFiles(ITestFramework *framework, const Q
return result;
}
QMultiHash<QString, QString> alternativeFiles(ITestFramework *framework, const QStringList &files)
QMultiHash<Utils::FilePath, Utils::FilePath> alternativeFiles(ITestFramework *framework,
const Utils::FilePaths &files)
{
QMultiHash<QString, QString> result;
QMultiHash<Utils::FilePath, Utils::FilePath> result;
TestTreeItem *rootNode = framework->rootNode();
QTC_ASSERT(rootNode, return result);
rootNode->forFirstLevelChildren([&result, &files](ITestTreeItem *child) {
const QString &baseFilePath = child->filePath();
const Utils::FilePath &baseFilePath = child->filePath();
for (int childRow = 0, count = child->childCount(); childRow < count; ++childRow) {
auto grandChild = static_cast<const QtTestTreeItem *>(child->childAt(childRow));
const QString &filePath = grandChild->filePath();
const Utils::FilePath &filePath = grandChild->filePath();
if (grandChild->inherited() && baseFilePath != filePath && files.contains(filePath)) {
if (!result.contains(filePath, baseFilePath))
result.insert(filePath, baseFilePath);