AutoTest: Add a itestframework.cpp

To get a few things out-of-line in itestframework.h.

Change-Id: Iae6f702b789c98b17a4d255008736377030e3b6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-04-17 17:04:35 +02:00
parent 90fd6870c5
commit 6285696091
6 changed files with 87 additions and 36 deletions

View File

@@ -35,34 +35,19 @@ class IFrameworkSettings;
class ITestFramework
{
public:
explicit ITestFramework(bool activeByDefault) : m_active(activeByDefault) {}
virtual ~ITestFramework()
{
delete m_testParser;
}
explicit ITestFramework(bool activeByDefault);
virtual ~ITestFramework();
virtual const char *name() const = 0;
virtual unsigned priority() const = 0; // should this be modifyable?
virtual IFrameworkSettings *frameworkSettings() { return nullptr; }
TestTreeItem *rootNode()
{ if (!m_rootNode)
m_rootNode = createRootNode();
// These are stored in the TestTreeModel and destroyed on shutdown there.
return m_rootNode;
}
ITestParser *testParser()
{
if (!m_testParser)
m_testParser = createTestParser();
return m_testParser;
}
TestTreeItem *rootNode();
ITestParser *testParser();
Core::Id settingsId() const;
Core::Id id() const { return Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(name()); }
Core::Id id() const;
bool active() const { return m_active; }
void setActive(bool active) { m_active = active; }
@@ -71,15 +56,7 @@ public:
// framework specific tool tip to be displayed on the general settings page
virtual QString groupingToolTip() const { return QString(); }
void resetRootNode()
{
if (!m_rootNode)
return;
if (m_rootNode->model())
static_cast<TestTreeModel *>(m_rootNode->model())->takeItem(m_rootNode);
delete m_rootNode;
m_rootNode = nullptr;
}
void resetRootNode();
protected:
virtual ITestParser *createTestParser() = 0;