TestResult: Change semantic for createIntermediateResultFor

Don't pass the other test result into createIntermediateResultFor().
Rename it to createIntermediateResult() and create a new result based
on this object. Fix the caller so that it calls
createIntermediateResult() for previously passed "other".

Change-Id: I2c87cee1daa4f400c867852d071bd5c91b84dfd5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2023-01-14 13:37:33 +01:00
parent f9090dab0c
commit 18aebc785f
3 changed files with 6 additions and 7 deletions

View File

@@ -175,15 +175,14 @@ 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) const
TestResult *TestResult::createIntermediateResult() const
{
QTC_ASSERT(other, return nullptr);
if (other->m_hooks.createResult) {
if (m_hooks.createResult) {
TestResult *newResult = new TestResult;
*newResult = other->m_hooks.createResult(*other);
*newResult = m_hooks.createResult(*this);
return newResult;
}
TestResult *intermediate = new TestResult(other->m_id, other->m_name);
TestResult *intermediate = new TestResult(m_id, m_name);
return intermediate;
}

View File

@@ -105,7 +105,7 @@ public:
bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const;
bool isIntermediateFor(const TestResult *other) const;
TestResult *createIntermediateResultFor(const TestResult *other) const;
TestResult *createIntermediateResult() const;
private:
QString m_id;

View File

@@ -179,7 +179,7 @@ TestResultItem *TestResultItem::intermediateFor(const TestResultItem *item) cons
TestResultItem *TestResultItem::createAndAddIntermediateFor(const TestResultItem *child)
{
TestResultPtr result(m_testResult->createIntermediateResultFor(child->testResult()));
TestResultPtr result(child->testResult()->createIntermediateResult());
QTC_ASSERT(!result.isNull(), return nullptr);
result->setResult(ResultType::TestStart);
TestResultItem *intermediate = new TestResultItem(result);