forked from qt-creator/qt-creator
TestResult: Make createIntermediateResultFor() a const method
Change-Id: I60dc08117504611857885668d1ad0d565a0ee020 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
#include "catchresult.h"
|
#include "catchresult.h"
|
||||||
|
|
||||||
#include "../autotesttr.h"
|
#include "../autotesttr.h"
|
||||||
#include "../testtreeitem.h"
|
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -174,7 +173,7 @@ TestResultPtr CatchOutputReader::createDefaultResult() const
|
|||||||
{
|
{
|
||||||
CatchResult *result = nullptr;
|
CatchResult *result = nullptr;
|
||||||
if (m_testCaseInfo.size() > 0) {
|
if (m_testCaseInfo.size() > 0) {
|
||||||
result = new CatchResult(id(), m_testCaseInfo.first().name);
|
result = new CatchResult(id(), m_testCaseInfo.first().name, m_sectionDepth);
|
||||||
result->setDescription(m_testCaseInfo.last().name);
|
result->setDescription(m_testCaseInfo.last().name);
|
||||||
result->setLine(m_testCaseInfo.last().line);
|
result->setLine(m_testCaseInfo.last().line);
|
||||||
const QString givenPath = m_testCaseInfo.last().filename;
|
const QString givenPath = m_testCaseInfo.last().filename;
|
||||||
@@ -182,9 +181,8 @@ TestResultPtr CatchOutputReader::createDefaultResult() const
|
|||||||
result->setFileName(constructSourceFilePath(m_buildDir, givenPath));
|
result->setFileName(constructSourceFilePath(m_buildDir, givenPath));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = new CatchResult(id(), QString());
|
result = new CatchResult(id(), {}, m_sectionDepth);
|
||||||
}
|
}
|
||||||
result->setSectionDepth(m_sectionDepth);
|
|
||||||
|
|
||||||
return TestResultPtr(result);
|
return TestResultPtr(result);
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,9 @@
|
|||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
CatchResult::CatchResult(const QString &id, const QString &name)
|
CatchResult::CatchResult(const QString &id, const QString &name, int depth)
|
||||||
: TestResult(id, name)
|
: TestResult(id, name)
|
||||||
|
, m_sectionDepth(depth)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,14 +11,13 @@ namespace Internal {
|
|||||||
class CatchResult : public TestResult
|
class CatchResult : public TestResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CatchResult(const QString &id, const QString &name);
|
CatchResult(const QString &id, const QString &name, int depth);
|
||||||
|
|
||||||
bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const override;
|
bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const override;
|
||||||
const ITestTreeItem *findTestTreeItem() const override;
|
const ITestTreeItem *findTestTreeItem() const override;
|
||||||
|
|
||||||
void setSectionDepth(int depth) { m_sectionDepth = depth; }
|
|
||||||
int sectionDepth() const { return m_sectionDepth; }
|
|
||||||
private:
|
private:
|
||||||
|
int sectionDepth() const { return m_sectionDepth; }
|
||||||
int m_sectionDepth = 0;
|
int m_sectionDepth = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -98,7 +98,7 @@ bool QtTestResult::isIntermediateFor(const TestResult *other) const
|
|||||||
&& m_projectFile == qtOther->m_projectFile;
|
&& m_projectFile == qtOther->m_projectFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResult *QtTestResult::createIntermediateResultFor(const TestResult *other)
|
TestResult *QtTestResult::createIntermediateResultFor(const TestResult *other) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(other, return nullptr);
|
QTC_ASSERT(other, return nullptr);
|
||||||
const QtTestResult *qtOther = static_cast<const QtTestResult *>(other);
|
const QtTestResult *qtOther = static_cast<const QtTestResult *>(other);
|
||||||
|
@@ -20,7 +20,7 @@ public:
|
|||||||
|
|
||||||
bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const override;
|
bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const override;
|
||||||
bool isIntermediateFor(const TestResult *other) const override;
|
bool isIntermediateFor(const TestResult *other) const override;
|
||||||
TestResult *createIntermediateResultFor(const TestResult *other) override;
|
TestResult *createIntermediateResultFor(const TestResult *other) const override;
|
||||||
const ITestTreeItem *findTestTreeItem() const override;
|
const ITestTreeItem *findTestTreeItem() const override;
|
||||||
private:
|
private:
|
||||||
bool isTestCase() const { return m_function.isEmpty() && m_dataTag.isEmpty(); }
|
bool isTestCase() const { return m_function.isEmpty() && m_dataTag.isEmpty(); }
|
||||||
|
@@ -166,7 +166,7 @@ bool TestResult::isIntermediateFor(const TestResult *other) const
|
|||||||
return !m_id.isEmpty() && m_id == other->m_id && m_name == other->m_name;
|
return !m_id.isEmpty() && m_id == other->m_id && m_name == other->m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResult *TestResult::createIntermediateResultFor(const TestResult *other)
|
TestResult *TestResult::createIntermediateResultFor(const TestResult *other) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(other, return nullptr);
|
QTC_ASSERT(other, return nullptr);
|
||||||
TestResult *intermediate = new TestResult(other->m_id, other->m_name);
|
TestResult *intermediate = new TestResult(other->m_id, other->m_name);
|
||||||
|
@@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
virtual bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const;
|
virtual bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const;
|
||||||
virtual bool isIntermediateFor(const TestResult *other) const;
|
virtual bool isIntermediateFor(const TestResult *other) const;
|
||||||
virtual TestResult *createIntermediateResultFor(const TestResult *other);
|
virtual TestResult *createIntermediateResultFor(const TestResult *other) const;
|
||||||
private:
|
private:
|
||||||
QString m_id;
|
QString m_id;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
Reference in New Issue
Block a user