2016-06-01 16:22:50 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "testtreeitem.h"
|
|
|
|
|
#include "itestparser.h"
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
|
2016-10-05 12:39:23 +02:00
|
|
|
class IFrameworkSettings;
|
|
|
|
|
|
2016-06-01 16:22:50 +02:00
|
|
|
class ITestFramework
|
|
|
|
|
{
|
|
|
|
|
public:
|
2016-09-29 12:15:43 +02:00
|
|
|
explicit ITestFramework(bool activeByDefault) : m_active(activeByDefault) {}
|
2016-06-06 15:35:00 +02:00
|
|
|
virtual ~ITestFramework()
|
|
|
|
|
{
|
|
|
|
|
delete m_testParser;
|
|
|
|
|
}
|
2016-06-01 16:22:50 +02:00
|
|
|
|
|
|
|
|
virtual const char *name() const = 0;
|
|
|
|
|
virtual unsigned priority() const = 0; // should this be modifyable?
|
2020-03-12 13:58:09 +01:00
|
|
|
|
|
|
|
|
virtual IFrameworkSettings *frameworkSettings() { return nullptr; }
|
2016-06-01 16:22:50 +02:00
|
|
|
|
|
|
|
|
TestTreeItem *rootNode()
|
|
|
|
|
{ if (!m_rootNode)
|
|
|
|
|
m_rootNode = createRootNode();
|
2020-03-16 12:59:23 +01:00
|
|
|
// These are stored in the TestTreeModel and destroyed on shutdown there.
|
2016-06-01 16:22:50 +02:00
|
|
|
return m_rootNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ITestParser *testParser()
|
|
|
|
|
{
|
|
|
|
|
if (!m_testParser)
|
|
|
|
|
m_testParser = createTestParser();
|
|
|
|
|
return m_testParser;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-10 12:00:37 +01:00
|
|
|
Core::Id settingsId() const;
|
|
|
|
|
|
2020-03-13 12:16:26 +01:00
|
|
|
Core::Id id() const { return Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(name()); }
|
|
|
|
|
|
2016-06-06 15:35:00 +02:00
|
|
|
bool active() const { return m_active; }
|
|
|
|
|
void setActive(bool active) { m_active = active; }
|
2017-12-06 08:45:36 +01:00
|
|
|
bool grouping() const { return m_grouping; }
|
|
|
|
|
void setGrouping(bool group) { m_grouping = group; }
|
2018-03-13 10:04:46 +01:00
|
|
|
// framework specific tool tip to be displayed on the general settings page
|
|
|
|
|
virtual QString groupingToolTip() const { return QString(); }
|
2020-03-16 12:59:23 +01:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-01 16:22:50 +02:00
|
|
|
protected:
|
2020-03-13 13:54:33 +01:00
|
|
|
virtual ITestParser *createTestParser() = 0;
|
2020-03-26 10:11:39 +01:00
|
|
|
virtual TestTreeItem *createRootNode() = 0;
|
2016-06-01 16:22:50 +02:00
|
|
|
|
|
|
|
|
private:
|
2018-05-31 07:38:04 +02:00
|
|
|
TestTreeItem *m_rootNode = nullptr;
|
|
|
|
|
ITestParser *m_testParser = nullptr;
|
2016-06-06 15:35:00 +02:00
|
|
|
bool m_active = false;
|
2017-12-06 08:45:36 +01:00
|
|
|
bool m_grouping = false;
|
2016-06-01 16:22:50 +02:00
|
|
|
};
|
|
|
|
|
|
2020-03-13 13:54:33 +01:00
|
|
|
using TestFrameworks = QList<ITestFramework *>;
|
|
|
|
|
|
2016-06-01 16:22:50 +02:00
|
|
|
} // namespace Autotest
|