TestResult: Devirtualize the class - part 1 of 5

The goal is to make the TestResult a value type without a need
to create these objects on heap.

Introduce a ResultHooks class that will replace all 5 virtual
methods.

Step 1 - implement outputStringHook.

Reorder constructor arguments of TestResult's subclasses so that
the first 2 args are always: id and name.

Change-Id: Iae93e5a348328414f057d1471afad8020b3c1171
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2023-01-13 17:31:35 +01:00
parent e592e0e83f
commit d03c4f77c9
12 changed files with 158 additions and 144 deletions

View File

@@ -13,19 +13,17 @@ class BoostTestTreeItem;
class BoostTestResult : public TestResult
{
public:
BoostTestResult(const QString &id, const Utils::FilePath &projectFile, const QString &name);
const QString outputString(bool selected) const override;
BoostTestResult(const QString &id, const QString &name, const Utils::FilePath &projectFile,
const QString &testCaseName = {}, const QString &testSuiteName = {});
bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const override;
const ITestTreeItem * findTestTreeItem() const override;
void setTestSuite(const QString &testSuite) { m_testSuite = testSuite; }
void setTestCase(const QString &testCase) { m_testCase = testCase; }
private:
bool matches(const BoostTestTreeItem *item) const;
Utils::FilePath m_projectFile;
QString m_testSuite;
QString m_testCase;
QString m_testCaseName;
QString m_testSuiteName;
};
} // namespace Internal