2014-10-07 12:30:54 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-02-19 08:09:02 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd
|
2014-10-07 12:30:54 +02:00
|
|
|
** All rights reserved.
|
2015-02-19 08:09:02 +01:00
|
|
|
** For any questions to The Qt Company, please use contact form at
|
|
|
|
|
** http://www.qt.io/contact-us
|
2014-10-07 12:30:54 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of the Qt Creator Enterprise Auto Test Add-on.
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Enterprise licenses may use this file in
|
|
|
|
|
** accordance with the Qt Enterprise License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-02-19 08:09:02 +01:00
|
|
|
** a written agreement between you and The Qt Company.
|
2014-10-07 12:30:54 +02:00
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please use
|
2015-02-19 08:09:02 +01:00
|
|
|
** contact form at http://www.qt.io/contact-us
|
2014-10-07 12:30:54 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TESTTREEITEM_H
|
|
|
|
|
#define TESTTREEITEM_H
|
|
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
|
#include <QString>
|
2015-02-13 15:44:18 +01:00
|
|
|
#include <QMetaType>
|
2014-10-07 12:30:54 +02:00
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class TestTreeItem
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum Type {
|
2014-11-13 12:31:58 +01:00
|
|
|
ROOT,
|
|
|
|
|
TEST_CLASS,
|
|
|
|
|
TEST_FUNCTION,
|
|
|
|
|
TEST_DATAFUNCTION,
|
|
|
|
|
TEST_SPECIALFUNCTION
|
2014-10-07 12:30:54 +02:00
|
|
|
};
|
|
|
|
|
|
2015-02-13 15:44:18 +01:00
|
|
|
TestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
|
|
|
|
Type type = ROOT, TestTreeItem *parent = 0);
|
2014-10-07 12:30:54 +02:00
|
|
|
virtual ~TestTreeItem();
|
2014-11-11 17:30:34 +01:00
|
|
|
TestTreeItem(const TestTreeItem& other);
|
2014-10-07 12:30:54 +02:00
|
|
|
|
2015-02-05 16:07:45 +01:00
|
|
|
TestTreeItem *child(int row) const;
|
2014-10-07 12:30:54 +02:00
|
|
|
TestTreeItem *parent() const;
|
|
|
|
|
void appendChild(TestTreeItem *child);
|
|
|
|
|
int row() const;
|
|
|
|
|
int childCount() const;
|
|
|
|
|
void removeChildren();
|
|
|
|
|
bool removeChild(int row);
|
|
|
|
|
bool modifyContent(const TestTreeItem *modified);
|
|
|
|
|
|
|
|
|
|
const QString name() const { return m_name; }
|
|
|
|
|
void setName(const QString &name) { m_name = name; }
|
|
|
|
|
const QString filePath() const { return m_filePath; }
|
|
|
|
|
void setFilePath(const QString &filePath) { m_filePath = filePath; }
|
|
|
|
|
void setLine(unsigned line) { m_line = line;}
|
|
|
|
|
unsigned line() const { return m_line; }
|
|
|
|
|
void setColumn(unsigned column) { m_column = column; }
|
|
|
|
|
unsigned column() const { return m_column; }
|
2014-11-06 16:01:06 +01:00
|
|
|
QString mainFile() const { return m_mainFile; }
|
|
|
|
|
void setMainFile(const QString &mainFile) { m_mainFile = mainFile; }
|
2014-10-07 12:30:54 +02:00
|
|
|
void setChecked(const Qt::CheckState checked);
|
2014-11-13 12:31:58 +01:00
|
|
|
Qt::CheckState checked() const;
|
2014-10-07 12:30:54 +02:00
|
|
|
Type type() const { return m_type; }
|
2014-11-11 17:30:34 +01:00
|
|
|
void setParent(TestTreeItem *parent) { m_parent = parent; }
|
2015-01-27 15:22:17 +01:00
|
|
|
QList<QString> getChildNames() const;
|
2014-10-07 12:30:54 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void revalidateCheckState();
|
|
|
|
|
|
|
|
|
|
QString m_name;
|
|
|
|
|
QString m_filePath;
|
|
|
|
|
Qt::CheckState m_checked;
|
|
|
|
|
Type m_type;
|
|
|
|
|
unsigned m_line;
|
|
|
|
|
unsigned m_column;
|
2014-11-06 16:01:06 +01:00
|
|
|
QString m_mainFile;
|
2014-10-07 12:30:54 +02:00
|
|
|
TestTreeItem *m_parent;
|
|
|
|
|
QList<TestTreeItem *> m_children;
|
|
|
|
|
};
|
|
|
|
|
|
2015-02-05 16:07:45 +01:00
|
|
|
struct TestCodeLocationAndType {
|
|
|
|
|
QString m_fileName;
|
|
|
|
|
unsigned m_line;
|
|
|
|
|
unsigned m_column;
|
|
|
|
|
TestTreeItem::Type m_type;
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-07 12:30:54 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|
|
|
|
|
|
2015-02-13 15:44:18 +01:00
|
|
|
Q_DECLARE_METATYPE(Autotest::Internal::TestTreeItem)
|
|
|
|
|
Q_DECLARE_METATYPE(Autotest::Internal::TestCodeLocationAndType)
|
|
|
|
|
|
2014-10-07 12:30:54 +02:00
|
|
|
#endif // TESTTREEITEM_H
|