2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2019 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2018-12-07 10:00:23 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "../testtreeitem.h"
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class BoostTestParseResult;
|
|
|
|
|
|
|
|
|
|
class BoostTestTreeItem : public TestTreeItem
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum TestState
|
|
|
|
|
{
|
|
|
|
|
Enabled = 0x00,
|
|
|
|
|
Disabled = 0x01,
|
|
|
|
|
ExplicitlyEnabled = 0x02,
|
|
|
|
|
|
|
|
|
|
Parameterized = 0x10,
|
|
|
|
|
Fixture = 0x20,
|
2019-06-03 14:47:54 +02:00
|
|
|
Templated = 0x40,
|
2018-12-07 10:00:23 +01:00
|
|
|
};
|
|
|
|
|
Q_FLAGS(TestState)
|
|
|
|
|
Q_DECLARE_FLAGS(TestStates, TestState)
|
|
|
|
|
|
2021-01-29 19:32:39 +01:00
|
|
|
explicit BoostTestTreeItem(ITestFramework *framework,
|
2020-03-26 10:11:39 +01:00
|
|
|
const QString &name = QString(),
|
2021-05-26 15:50:03 +02:00
|
|
|
const Utils::FilePath &filePath = Utils::FilePath(),
|
2020-03-26 10:11:39 +01:00
|
|
|
Type type = Root)
|
2021-01-29 19:32:39 +01:00
|
|
|
: TestTreeItem(framework, name, filePath, type)
|
2020-03-26 10:11:39 +01:00
|
|
|
{}
|
2018-12-07 10:00:23 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TestTreeItem *copyWithoutChildren() override;
|
|
|
|
|
QVariant data(int column, int role) const override;
|
|
|
|
|
TestTreeItem *find(const TestParseResult *result) override;
|
|
|
|
|
TestTreeItem *findChild(const TestTreeItem *other) override;
|
|
|
|
|
bool modify(const TestParseResult *result) override;
|
|
|
|
|
TestTreeItem *createParentGroupNode() const override;
|
|
|
|
|
|
|
|
|
|
void setFullName(const QString &fullName) { m_fullName = fullName; }
|
|
|
|
|
QString fullName() const { return m_fullName; }
|
|
|
|
|
void setStates(TestStates states) { m_state = states; }
|
|
|
|
|
void setState(TestState state) { m_state |= state; }
|
|
|
|
|
TestStates state() const { return m_state; }
|
|
|
|
|
|
2020-10-13 11:37:37 +02:00
|
|
|
QList<ITestConfiguration *> getAllTestConfigurations() const override;
|
|
|
|
|
QList<ITestConfiguration *> getSelectedTestConfigurations() const override;
|
|
|
|
|
QList<ITestConfiguration *> getFailedTestConfigurations() const override;
|
2018-12-07 10:00:23 +01:00
|
|
|
bool canProvideTestConfiguration() const override { return type() != Root; }
|
|
|
|
|
bool canProvideDebugConfiguration() const override { return canProvideTestConfiguration(); }
|
2020-10-13 11:37:37 +02:00
|
|
|
ITestConfiguration *testConfiguration() const override;
|
|
|
|
|
ITestConfiguration *debugConfiguration() const override;
|
2018-12-07 10:00:23 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString nameSuffix() const;
|
|
|
|
|
bool enabled() const;
|
|
|
|
|
TestTreeItem *findChildByNameStateAndFile(const QString &name,
|
|
|
|
|
BoostTestTreeItem::TestStates state,
|
2021-05-26 15:50:03 +02:00
|
|
|
const Utils::FilePath &proFile) const;
|
2018-12-07 10:00:23 +01:00
|
|
|
QString prependWithParentsSuitePaths(const QString &testName) const;
|
2020-10-13 11:37:37 +02:00
|
|
|
QList<ITestConfiguration *> getTestConfigurations(
|
2020-09-11 14:30:15 +02:00
|
|
|
std::function<bool(BoostTestTreeItem *)> predicate) const;
|
2018-12-07 10:00:23 +01:00
|
|
|
bool modifyTestContent(const BoostTestParseResult *result);
|
|
|
|
|
TestStates m_state = Enabled;
|
|
|
|
|
QString m_fullName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct BoostTestInfo
|
|
|
|
|
{
|
|
|
|
|
QString fullName; // formatted like UNIX path
|
|
|
|
|
BoostTestTreeItem::TestStates state;
|
2019-07-24 18:40:10 +02:00
|
|
|
int line;
|
2018-12-07 10:00:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef QVector<BoostTestInfo> BoostTestInfoList;
|
|
|
|
|
|
|
|
|
|
class BoostTestCodeLocationAndType : public TestCodeLocationAndType
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
BoostTestTreeItem::TestStates m_state;
|
|
|
|
|
BoostTestInfoList m_suitesState;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef QVector<BoostTestCodeLocationAndType> BoostTestCodeLocationList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|