diff --git a/src/plugins/autotest/catch/catchoutputreader.cpp b/src/plugins/autotest/catch/catchoutputreader.cpp index 95185c8bdfc..893b458281d 100644 --- a/src/plugins/autotest/catch/catchoutputreader.cpp +++ b/src/plugins/autotest/catch/catchoutputreader.cpp @@ -5,7 +5,6 @@ #include "catchresult.h" #include "../autotesttr.h" -#include "../testtreeitem.h" #include #include @@ -174,7 +173,7 @@ TestResultPtr CatchOutputReader::createDefaultResult() const { CatchResult *result = nullptr; 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->setLine(m_testCaseInfo.last().line); const QString givenPath = m_testCaseInfo.last().filename; @@ -182,9 +181,8 @@ TestResultPtr CatchOutputReader::createDefaultResult() const result->setFileName(constructSourceFilePath(m_buildDir, givenPath)); } } else { - result = new CatchResult(id(), QString()); + result = new CatchResult(id(), {}, m_sectionDepth); } - result->setSectionDepth(m_sectionDepth); return TestResultPtr(result); } diff --git a/src/plugins/autotest/catch/catchresult.cpp b/src/plugins/autotest/catch/catchresult.cpp index 80b1476ebda..13b1dc8172b 100644 --- a/src/plugins/autotest/catch/catchresult.cpp +++ b/src/plugins/autotest/catch/catchresult.cpp @@ -12,8 +12,9 @@ namespace Autotest { namespace Internal { -CatchResult::CatchResult(const QString &id, const QString &name) +CatchResult::CatchResult(const QString &id, const QString &name, int depth) : TestResult(id, name) + , m_sectionDepth(depth) { } diff --git a/src/plugins/autotest/catch/catchresult.h b/src/plugins/autotest/catch/catchresult.h index bd0f58a0d15..e8c2cbd1457 100644 --- a/src/plugins/autotest/catch/catchresult.h +++ b/src/plugins/autotest/catch/catchresult.h @@ -11,14 +11,13 @@ namespace Internal { class CatchResult : public TestResult { 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; const ITestTreeItem *findTestTreeItem() const override; - void setSectionDepth(int depth) { m_sectionDepth = depth; } - int sectionDepth() const { return m_sectionDepth; } private: + int sectionDepth() const { return m_sectionDepth; } int m_sectionDepth = 0; }; diff --git a/src/plugins/autotest/qtest/qttestresult.cpp b/src/plugins/autotest/qtest/qttestresult.cpp index bcff35c5462..6fcffe8f0cf 100644 --- a/src/plugins/autotest/qtest/qttestresult.cpp +++ b/src/plugins/autotest/qtest/qttestresult.cpp @@ -98,7 +98,7 @@ bool QtTestResult::isIntermediateFor(const TestResult *other) const && m_projectFile == qtOther->m_projectFile; } -TestResult *QtTestResult::createIntermediateResultFor(const TestResult *other) +TestResult *QtTestResult::createIntermediateResultFor(const TestResult *other) const { QTC_ASSERT(other, return nullptr); const QtTestResult *qtOther = static_cast(other); diff --git a/src/plugins/autotest/qtest/qttestresult.h b/src/plugins/autotest/qtest/qttestresult.h index 46d75d446fe..9cd17ddce2d 100644 --- a/src/plugins/autotest/qtest/qttestresult.h +++ b/src/plugins/autotest/qtest/qttestresult.h @@ -20,7 +20,7 @@ public: bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) 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; private: bool isTestCase() const { return m_function.isEmpty() && m_dataTag.isEmpty(); } diff --git a/src/plugins/autotest/testresult.cpp b/src/plugins/autotest/testresult.cpp index 838df046695..f275669a78b 100644 --- a/src/plugins/autotest/testresult.cpp +++ b/src/plugins/autotest/testresult.cpp @@ -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; } -TestResult *TestResult::createIntermediateResultFor(const TestResult *other) +TestResult *TestResult::createIntermediateResultFor(const TestResult *other) const { QTC_ASSERT(other, return nullptr); TestResult *intermediate = new TestResult(other->m_id, other->m_name); diff --git a/src/plugins/autotest/testresult.h b/src/plugins/autotest/testresult.h index 5130eb20ae8..62e5d36f098 100644 --- a/src/plugins/autotest/testresult.h +++ b/src/plugins/autotest/testresult.h @@ -95,7 +95,7 @@ public: virtual bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const; virtual bool isIntermediateFor(const TestResult *other) const; - virtual TestResult *createIntermediateResultFor(const TestResult *other); + virtual TestResult *createIntermediateResultFor(const TestResult *other) const; private: QString m_id; QString m_name;