forked from qt-creator/qt-creator
AutoTest: Fix handling of data tags with spaces
Change-Id: Ie725d8bf67b6a143f52c84b902b69a077a55a2bc Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -15,6 +15,13 @@
|
|||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
static QString functionWithDataTagAsArg(const QString &func, const QString &dataTag)
|
||||||
|
{
|
||||||
|
if (dataTag.contains(' '))
|
||||||
|
return '"' + func + ':' + dataTag + '"';
|
||||||
|
return func + ':' + dataTag;
|
||||||
|
}
|
||||||
|
|
||||||
QtTestTreeItem::QtTestTreeItem(ITestFramework *testFramework, const QString &name,
|
QtTestTreeItem::QtTestTreeItem(ITestFramework *testFramework, const QString &name,
|
||||||
const Utils::FilePath &filePath, TestTreeItem::Type type)
|
const Utils::FilePath &filePath, TestTreeItem::Type type)
|
||||||
: TestTreeItem(testFramework, name, filePath, type)
|
: TestTreeItem(testFramework, name, filePath, type)
|
||||||
@@ -140,9 +147,8 @@ ITestConfiguration *QtTestTreeItem::testConfiguration() const
|
|||||||
const TestTreeItem *parent = function ? function->parentItem() : nullptr;
|
const TestTreeItem *parent = function ? function->parentItem() : nullptr;
|
||||||
if (!parent)
|
if (!parent)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
const QString functionWithTag = function->name() + ':' + name();
|
|
||||||
config = new QtTestConfiguration(framework());
|
config = new QtTestConfiguration(framework());
|
||||||
config->setTestCases(QStringList(functionWithTag));
|
config->setTestCases(QStringList(functionWithDataTagAsArg(function->name(), name())));
|
||||||
config->setProjectFile(parent->proFile());
|
config->setProjectFile(parent->proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
break;
|
break;
|
||||||
@@ -185,7 +191,7 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
|||||||
const QString funcName = grandChild->name();
|
const QString funcName = grandChild->name();
|
||||||
grandChild->forFirstLevelChildren([&testCases, &funcName](ITestTreeItem *dataTag) {
|
grandChild->forFirstLevelChildren([&testCases, &funcName](ITestTreeItem *dataTag) {
|
||||||
if (dataTag->checked() == Qt::Checked)
|
if (dataTag->checked() == Qt::Checked)
|
||||||
testCases << funcName + ':' + dataTag->name();
|
testCases << functionWithDataTagAsArg(funcName, dataTag->name());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -217,7 +223,7 @@ static void collectFailedTestInfo(TestTreeItem *item, QList<ITestConfiguration *
|
|||||||
} else {
|
} else {
|
||||||
func->forFirstLevelChildren([&testCases, func](ITestTreeItem *dataTag) {
|
func->forFirstLevelChildren([&testCases, func](ITestTreeItem *dataTag) {
|
||||||
if (dataTag->data(0, FailedRole).toBool())
|
if (dataTag->data(0, FailedRole).toBool())
|
||||||
testCases << func->name() + ':' + dataTag->name();
|
testCases << functionWithDataTagAsArg(func->name(), dataTag->name());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user