TestResult: Devirtualize the class - part 5 of 5

Step 5 - implement createResultHook.

Change-Id: Ibe81fb93c8c1c12d1af458d0f9707d02864febd8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2023-01-14 13:28:10 +01:00
parent 2b99ba1db7
commit f9090dab0c
4 changed files with 29 additions and 32 deletions

View File

@@ -178,6 +178,11 @@ bool TestResult::isIntermediateFor(const TestResult *other) const
TestResult *TestResult::createIntermediateResultFor(const TestResult *other) const
{
QTC_ASSERT(other, return nullptr);
if (other->m_hooks.createResult) {
TestResult *newResult = new TestResult;
*newResult = other->m_hooks.createResult(*other);
return newResult;
}
TestResult *intermediate = new TestResult(other->m_id, other->m_name);
return intermediate;
}