AutoTest: Use using namespace Utils more often

Change-Id: I9d20cd3496c4719d58a977f8fd53253c86d55463
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-01-16 15:00:15 +01:00
parent d05c5b7d07
commit bc3ebef7ce
41 changed files with 343 additions and 310 deletions

View File

@@ -14,16 +14,18 @@
#include <QIcon>
using namespace Utils;
namespace Autotest {
static QIcon testTreeIcon(TestTreeItem::Type type)
{
static QIcon icons[] = {
QIcon(),
Utils::Icons::OPENFILE.icon(),
Icons::OPENFILE.icon(),
QIcon(":/autotest/images/suite.png"),
Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Class),
Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::SlotPrivate),
CodeModelIcon::iconForType(CodeModelIcon::Class),
CodeModelIcon::iconForType(CodeModelIcon::SlotPrivate),
QIcon(":/autotest/images/data.png")
};
@@ -33,7 +35,7 @@ static QIcon testTreeIcon(TestTreeItem::Type type)
}
ITestTreeItem::ITestTreeItem(ITestBase *testBase, const QString &name,
const Utils::FilePath &filePath, Type type)
const FilePath &filePath, Type type)
: m_testBase(testBase)
, m_name(name)
, m_filePath(filePath)
@@ -115,8 +117,8 @@ bool ITestTreeItem::lessThan(const ITestTreeItem *other, ITestTreeItem::SortMode
Qt::CaseInsensitive) > 0;
}
const Utils::Link &leftLink = data(0, LinkRole).value<Utils::Link>();
const Utils::Link &rightLink = other->data(0, LinkRole).value<Utils::Link>();
const Link &leftLink = data(0, LinkRole).value<Link>();
const Link &rightLink = other->data(0, LinkRole).value<Link>();
const int comparison = leftLink.targetFilePath.toString().compare(
rightLink.targetFilePath.toString(), Qt::CaseInsensitive);
if (comparison == 0) {
@@ -144,7 +146,7 @@ ITestConfiguration *ITestTreeItem::asConfiguration(TestRunMode mode) const
/****************************** TestTreeItem ********************************************/
TestTreeItem::TestTreeItem(ITestFramework *testFramework, const QString &name,
const Utils::FilePath &filePath, Type type)
const FilePath &filePath, Type type)
: ITestTreeItem(testFramework, name, filePath, type)
{
switch (type) {
@@ -168,7 +170,7 @@ QVariant TestTreeItem::data(int column, int role) const
return QVariant();
QVariant itemLink;
itemLink.setValue(
Utils::Link(filePath(), line(), int(m_column)));
Link(filePath(), line(), int(m_column)));
return itemLink;
}
return ITestTreeItem::data(column, role);
@@ -222,7 +224,7 @@ void TestTreeItem::markForRemovalRecursively(bool mark)
childItem(row)->markForRemovalRecursively(mark);
}
void TestTreeItem::markForRemovalRecursively(const Utils::FilePath &filepath)
void TestTreeItem::markForRemovalRecursively(const FilePath &filepath)
{
bool mark = filePath() == filepath;
forFirstLevelChildItems([&mark, &filepath](TestTreeItem *child) {
@@ -249,20 +251,20 @@ TestTreeItem *TestTreeItem::findChildByName(const QString &name)
});
}
TestTreeItem *TestTreeItem::findChildByFile(const Utils::FilePath &filePath)
TestTreeItem *TestTreeItem::findChildByFile(const FilePath &filePath)
{
return findFirstLevelChildItem([filePath](const TestTreeItem *other) {
return other->filePath() == filePath;
});
}
TestTreeItem *TestTreeItem::findChildByFileAndType(const Utils::FilePath &filePath, Type tType)
TestTreeItem *TestTreeItem::findChildByFileAndType(const FilePath &filePath, Type tType)
{
return findFirstLevelChildItem([filePath, tType](const TestTreeItem *other) {
return other->type() == tType && other->filePath() == filePath;
});}
TestTreeItem *TestTreeItem::findChildByNameAndFile(const QString &name, const Utils::FilePath &filePath)
TestTreeItem *TestTreeItem::findChildByNameAndFile(const QString &name, const FilePath &filePath)
{
return findFirstLevelChildItem([name, filePath](const TestTreeItem *other) {
return other->filePath() == filePath && other->name() == name;
@@ -280,7 +282,7 @@ ITestConfiguration *TestTreeItem::asConfiguration(TestRunMode mode) const
}
}
QList<ITestConfiguration *> TestTreeItem::getTestConfigurationsForFile(const Utils::FilePath &) const
QList<ITestConfiguration *> TestTreeItem::getTestConfigurationsForFile(const FilePath &) const
{
return QList<ITestConfiguration *>();
}
@@ -342,7 +344,7 @@ void TestTreeItem::copyBasicDataFrom(const TestTreeItem *other)
m_status = other->m_status;
}
inline bool TestTreeItem::modifyFilePath(const Utils::FilePath &filepath)
inline bool TestTreeItem::modifyFilePath(const FilePath &filepath)
{
if (filePath() != filepath) {
setFilePath(filepath);