forked from qt-creator/qt-creator
Autotest: some FilePath::toFileInfo cleanup
Change-Id: I45395c5e83bc01d98d0bec20c992424d4150c844 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -268,21 +268,22 @@ void AutoTestUnitTests::testCodeParserBoostTest()
|
|||||||
|
|
||||||
QCOMPARE(m_model->boostTestNamesCount(), 5);
|
QCOMPARE(m_model->boostTestNamesCount(), 5);
|
||||||
|
|
||||||
QString basePath;
|
|
||||||
if (auto project = projectInfo.project())
|
auto project = projectInfo.project();
|
||||||
basePath = project->projectFilePath().toFileInfo().absolutePath();
|
QVERIFY(project);
|
||||||
|
const Utils::FilePath basePath = project->projectFilePath().absolutePath();
|
||||||
QVERIFY(!basePath.isEmpty());
|
QVERIFY(!basePath.isEmpty());
|
||||||
|
|
||||||
QMap<QString, int> expectedSuitesAndTests;
|
QMap<QString, int> expectedSuitesAndTests;
|
||||||
|
|
||||||
auto pathConstructor = [basePath, extension](const QString &name, const QString &subPath) {
|
auto pathConstructor = [basePath, extension](const QString &name, const QString &subPath) {
|
||||||
return QString(name + '|' + basePath + subPath + extension);
|
return QString(name + '|' + basePath.pathAppended(subPath + extension).toString());
|
||||||
};
|
};
|
||||||
expectedSuitesAndTests.insert(pathConstructor("Master Test Suite", "/tests/deco/deco"), 2); // decorators w/o suite
|
expectedSuitesAndTests.insert(pathConstructor("Master Test Suite", "tests/deco/deco"), 2); // decorators w/o suite
|
||||||
expectedSuitesAndTests.insert(pathConstructor("Master Test Suite", "/tests/fix/fix"), 2); // fixtures
|
expectedSuitesAndTests.insert(pathConstructor("Master Test Suite", "tests/fix/fix"), 2); // fixtures
|
||||||
expectedSuitesAndTests.insert(pathConstructor("Master Test Suite", "/tests/params/params"), 3); // functions
|
expectedSuitesAndTests.insert(pathConstructor("Master Test Suite", "tests/params/params"), 3); // functions
|
||||||
expectedSuitesAndTests.insert(pathConstructor("Suite1", "/tests/deco/deco"), 4);
|
expectedSuitesAndTests.insert(pathConstructor("Suite1", "tests/deco/deco"), 4);
|
||||||
expectedSuitesAndTests.insert(pathConstructor("SuiteOuter", "/tests/deco/deco"), 5); // 2 sub suites + 3 tests
|
expectedSuitesAndTests.insert(pathConstructor("SuiteOuter", "tests/deco/deco"), 5); // 2 sub suites + 3 tests
|
||||||
|
|
||||||
QMap<QString, int> foundNamesAndSets = m_model->boostTestSuitesAndTests();
|
QMap<QString, int> foundNamesAndSets = m_model->boostTestSuitesAndTests();
|
||||||
QCOMPARE(expectedSuitesAndTests.size(), foundNamesAndSets.size());
|
QCOMPARE(expectedSuitesAndTests.size(), foundNamesAndSets.size());
|
||||||
|
@@ -144,8 +144,8 @@ bool BoostTestTreeItem::modify(const TestParseResult *result)
|
|||||||
|
|
||||||
TestTreeItem *BoostTestTreeItem::createParentGroupNode() const
|
TestTreeItem *BoostTestTreeItem::createParentGroupNode() const
|
||||||
{
|
{
|
||||||
const QFileInfo base = filePath().absolutePath().toFileInfo();
|
const Utils::FilePath &absPath = filePath().absolutePath();
|
||||||
return new BoostTestTreeItem(framework(), base.baseName(), filePath().absolutePath(), TestTreeItem::GroupNode);
|
return new BoostTestTreeItem(framework(), absPath.baseName(), absPath, TestTreeItem::GroupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BoostTestTreeItem::prependWithParentsSuitePaths(const QString &testName) const
|
QString BoostTestTreeItem::prependWithParentsSuitePaths(const QString &testName) const
|
||||||
|
@@ -139,8 +139,8 @@ bool CatchTreeItem::modify(const TestParseResult *result)
|
|||||||
|
|
||||||
TestTreeItem *CatchTreeItem::createParentGroupNode() const
|
TestTreeItem *CatchTreeItem::createParentGroupNode() const
|
||||||
{
|
{
|
||||||
const QFileInfo base(filePath().toFileInfo().absolutePath());
|
const Utils::FilePath absPath = filePath().absolutePath();
|
||||||
return new CatchTreeItem(framework(), base.baseName(), filePath(), TestTreeItem::GroupNode);
|
return new CatchTreeItem(framework(), absPath.baseName(), absPath, TestTreeItem::GroupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CatchTreeItem::canProvideTestConfiguration() const
|
bool CatchTreeItem::canProvideTestConfiguration() const
|
||||||
|
@@ -464,9 +464,8 @@ bool GTestTreeItem::modify(const TestParseResult *result)
|
|||||||
TestTreeItem *GTestTreeItem::createParentGroupNode() const
|
TestTreeItem *GTestTreeItem::createParentGroupNode() const
|
||||||
{
|
{
|
||||||
if (GTestFramework::groupMode() == GTest::Constants::Directory) {
|
if (GTestFramework::groupMode() == GTest::Constants::Directory) {
|
||||||
const QFileInfo base = filePath().absolutePath().toFileInfo();
|
const Utils::FilePath &absPath = filePath().absolutePath();
|
||||||
return new GTestTreeItem(framework(), base.baseName(), filePath().absolutePath(),
|
return new GTestTreeItem(framework(), absPath.baseName(), absPath, TestTreeItem::GroupNode);
|
||||||
TestTreeItem::GroupNode);
|
|
||||||
} else { // GTestFilter
|
} else { // GTestFilter
|
||||||
QTC_ASSERT(childCount(), return nullptr); // paranoia
|
QTC_ASSERT(childCount(), return nullptr); // paranoia
|
||||||
const TestTreeItem *firstChild = childItem(0);
|
const TestTreeItem *firstChild = childItem(0);
|
||||||
|
@@ -408,8 +408,8 @@ bool QtTestTreeItem::modify(const TestParseResult *result)
|
|||||||
|
|
||||||
TestTreeItem *QtTestTreeItem::createParentGroupNode() const
|
TestTreeItem *QtTestTreeItem::createParentGroupNode() const
|
||||||
{
|
{
|
||||||
const QFileInfo base = filePath().absolutePath().toFileInfo();
|
const Utils::FilePath &absPath = filePath().absolutePath();
|
||||||
return new QtTestTreeItem(framework(), base.baseName(), filePath().absolutePath(), TestTreeItem::GroupNode);
|
return new QtTestTreeItem(framework(), absPath.baseName(), absPath, TestTreeItem::GroupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtTestTreeItem::isGroupable() const
|
bool QtTestTreeItem::isGroupable() const
|
||||||
|
@@ -375,8 +375,8 @@ bool QuickTestTreeItem::removeOnSweepIfEmpty() const
|
|||||||
|
|
||||||
TestTreeItem *QuickTestTreeItem::createParentGroupNode() const
|
TestTreeItem *QuickTestTreeItem::createParentGroupNode() const
|
||||||
{
|
{
|
||||||
const QFileInfo base = filePath().absolutePath().toFileInfo();
|
const Utils::FilePath &absPath = filePath().absolutePath();
|
||||||
return new QuickTestTreeItem(framework(), base.baseName(), filePath().absolutePath(), TestTreeItem::GroupNode);
|
return new QuickTestTreeItem(framework(), absPath.baseName(), absPath, TestTreeItem::GroupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuickTestTreeItem::isGroupable() const
|
bool QuickTestTreeItem::isGroupable() const
|
||||||
|
@@ -84,7 +84,6 @@ Utils::FilePath ITestConfiguration::executableFilePath() const
|
|||||||
if (!hasExecutable())
|
if (!hasExecutable())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
QFileInfo commandFileInfo = m_runnable.executable.toFileInfo();
|
|
||||||
if (m_runnable.executable.isExecutableFile() && m_runnable.executable.path() != ".") {
|
if (m_runnable.executable.isExecutableFile() && m_runnable.executable.path() != ".") {
|
||||||
return m_runnable.executable.absoluteFilePath();
|
return m_runnable.executable.absoluteFilePath();
|
||||||
} else if (m_runnable.executable.path() == "."){
|
} else if (m_runnable.executable.path() == "."){
|
||||||
|
Reference in New Issue
Block a user