AutoTest: Use TestResult as value type

Don't construct it on heap and don't use shared pointer for it.

Change-Id: I51c9da405ed14d24b5f20242b4d049f9e2958f09
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-01-14 16:25:51 +01:00
parent 3ff5661327
commit d05c5b7d07
54 changed files with 396 additions and 437 deletions

View File

@@ -22,7 +22,7 @@ QuickTestConfiguration::QuickTestConfiguration(ITestFramework *framework)
}
TestOutputReader *QuickTestConfiguration::createOutputReader(
const QFutureInterface<TestResultPtr> &fi, Utils::QtcProcess *app) const
const QFutureInterface<TestResult> &fi, Utils::QtcProcess *app) const
{
auto qtSettings = static_cast<QtTestSettings *>(framework()->testSettings());
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput.value()

View File

@@ -12,7 +12,7 @@ class QuickTestConfiguration : public DebuggableTestConfiguration
{
public:
explicit QuickTestConfiguration(ITestFramework *framework);
TestOutputReader *createOutputReader(const QFutureInterface<TestResultPtr> &fi,
TestOutputReader *createOutputReader(const QFutureInterface<TestResult> &fi,
Utils::QtcProcess *app) const override;
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
Utils::Environment filteredEnvironment(const Utils::Environment &original) const override;

View File

@@ -20,8 +20,7 @@ ITestParser *QuickTestFramework::createTestParser()
ITestTreeItem *QuickTestFramework::createRootNode()
{
return new QuickTestTreeItem(this, displayName(),
Utils::FilePath(), ITestTreeItem::Root);
return new QuickTestTreeItem(this, displayName(), {}, ITestTreeItem::Root);
}
const char *QuickTestFramework::name() const

View File

@@ -121,7 +121,7 @@ QString QuickTestParser::quickTestName(const CPlusPlus::Document::Ptr &doc) cons
// check for using quick_test_main() directly
CPlusPlus::Document::Ptr document = m_cppSnapshot.preprocessedDocument(fileContent, filePath);
if (document.isNull())
return QString();
return {};
document->check();
CPlusPlus::AST *ast = document->translationUnit()->ast();
QuickTestAstVisitor astVisitor(document, m_cppSnapshot);
@@ -202,7 +202,7 @@ QList<Document::Ptr> QuickTestParser::scanDirectoryForQuickTestQmlFiles(const Ut
static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr> &futureInterface,
const Document::Ptr &qmlJSDoc,
ITestFramework *framework,
const Utils::FilePath &proFile = Utils::FilePath(),
const Utils::FilePath &proFile = {},
bool checkForDerivedTest = false)
{
if (qmlJSDoc.isNull())

View File

@@ -11,10 +11,8 @@ namespace Internal {
class QuickTestTreeItem : public TestTreeItem
{
public:
explicit QuickTestTreeItem(ITestFramework *testFramework,
const QString &name = QString(),
const Utils::FilePath &filePath = Utils::FilePath(),
Type type = Root)
explicit QuickTestTreeItem(ITestFramework *testFramework, const QString &name = {},
const Utils::FilePath &filePath = {}, Type type = Root)
: TestTreeItem(testFramework, name, filePath, type)
{}