diff --git a/src/plugins/autotest/itestframework.cpp b/src/plugins/autotest/itestframework.cpp index ca60e960192..0f2fccdbf67 100644 --- a/src/plugins/autotest/itestframework.cpp +++ b/src/plugins/autotest/itestframework.cpp @@ -28,16 +28,11 @@ namespace Autotest { -ITestFramework::ITestFramework(bool activeByDefault) +ITestBase::ITestBase(bool activeByDefault) : m_active(activeByDefault) {} -ITestFramework::~ITestFramework() -{ - delete m_testParser; -} - -TestTreeItem *ITestFramework::rootNode() +TestTreeItem *ITestBase::rootNode() { if (!m_rootNode) m_rootNode = createRootNode(); @@ -45,25 +40,18 @@ TestTreeItem *ITestFramework::rootNode() return m_rootNode; } -ITestParser *ITestFramework::testParser() -{ - if (!m_testParser) - m_testParser = createTestParser(); - return m_testParser; -} - -Utils::Id ITestFramework::settingsId() const +Utils::Id ITestBase::settingsId() const { return Utils::Id(Constants::SETTINGSPAGE_PREFIX) .withSuffix(QString("%1.%2").arg(priority()).arg(QLatin1String(name()))); } -Utils::Id ITestFramework::id() const +Utils::Id ITestBase::id() const { return Utils::Id(Constants::FRAMEWORK_PREFIX).withSuffix(name()); } -void ITestFramework::resetRootNode() +void ITestBase::resetRootNode() { if (!m_rootNode) return; @@ -73,4 +61,21 @@ void ITestFramework::resetRootNode() m_rootNode = nullptr; } + +ITestFramework::ITestFramework(bool activeByDefault) + : ITestBase(activeByDefault) +{} + +ITestFramework::~ITestFramework() +{ + delete m_testParser; +} + +ITestParser *ITestFramework::testParser() +{ + if (!m_testParser) + m_testParser = createTestParser(); + return m_testParser; +} + } // namespace Autotest diff --git a/src/plugins/autotest/itestframework.h b/src/plugins/autotest/itestframework.h index eebb0326173..8cd760b38e8 100644 --- a/src/plugins/autotest/itestframework.h +++ b/src/plugins/autotest/itestframework.h @@ -32,40 +32,53 @@ namespace Autotest { class IFrameworkSettings; -class ITestFramework +class ITestBase { public: - explicit ITestFramework(bool activeByDefault); - virtual ~ITestFramework(); + explicit ITestBase(bool activeByDefault); + virtual ~ITestBase() = default; virtual const char *name() const = 0; virtual unsigned priority() const = 0; // should this be modifyable? - virtual IFrameworkSettings *frameworkSettings() { return nullptr; } - TestTreeItem *rootNode(); - ITestParser *testParser(); Utils::Id settingsId() const; Utils::Id id() const; bool active() const { return m_active; } void setActive(bool active) { m_active = active; } + + void resetRootNode(); + +protected: + virtual TestTreeItem *createRootNode() = 0; + +private: + TestTreeItem *m_rootNode = nullptr; + bool m_active = false; +}; + +class ITestFramework : public ITestBase +{ +public: + explicit ITestFramework(bool activeByDefault); + ~ITestFramework() override; + + virtual IFrameworkSettings *frameworkSettings() { return nullptr; } + + ITestParser *testParser(); + bool grouping() const { return m_grouping; } void setGrouping(bool group) { m_grouping = group; } // framework specific tool tip to be displayed on the general settings page virtual QString groupingToolTip() const { return QString(); } - void resetRootNode(); - protected: virtual ITestParser *createTestParser() = 0; - virtual TestTreeItem *createRootNode() = 0; private: - TestTreeItem *m_rootNode = nullptr; ITestParser *m_testParser = nullptr; - bool m_active = false; bool m_grouping = false; };