2014-10-07 15:51:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-02-19 08:09:02 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd
|
2014-10-07 15:51:02 +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 15:51:02 +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 15:51:02 +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 15:51:02 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TESTRESULTMODEL_H
|
|
|
|
|
#define TESTRESULTMODEL_H
|
|
|
|
|
|
|
|
|
|
#include "testresult.h"
|
|
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
2014-10-21 13:10:37 +02:00
|
|
|
#include <QSortFilterProxyModel>
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <QFont>
|
2014-10-21 13:10:37 +02:00
|
|
|
#include <QSet>
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-08-20 15:59:15 +02:00
|
|
|
#include <utils/treemodel.h>
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-08-20 15:59:15 +02:00
|
|
|
class TestResultItem : public Utils::TreeItem
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit TestResultItem(TestResult *testResult);
|
|
|
|
|
~TestResultItem();
|
|
|
|
|
QVariant data(int column, int role) const;
|
|
|
|
|
const TestResult *testResult() const { return m_testResult; }
|
|
|
|
|
void updateDescription(const QString &description);
|
|
|
|
|
void updateResult();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
TestResult *m_testResult;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TestResultModel : public Utils::TreeModel
|
2014-10-07 15:51:02 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit TestResultModel(QObject *parent = 0);
|
2015-08-20 15:59:15 +02:00
|
|
|
QVariant data(const QModelIndex &idx, int role) const;
|
|
|
|
|
|
|
|
|
|
void addTestResult(TestResult *testResult, bool autoExpand = false);
|
2014-12-05 14:01:16 +01:00
|
|
|
void removeCurrentTestMessage();
|
2014-10-07 15:51:02 +02:00
|
|
|
void clearTestResults();
|
|
|
|
|
|
2015-08-20 15:59:15 +02:00
|
|
|
TestResult testResult(const QModelIndex &idx);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
int maxWidthOfFileName(const QFont &font);
|
|
|
|
|
int maxWidthOfLineNumber(const QFont &font);
|
|
|
|
|
|
2015-08-20 15:59:15 +02:00
|
|
|
int resultTypeCount(Result::Type type) const { return m_testResultCount.value(type, 0); }
|
2015-12-14 12:48:58 +01:00
|
|
|
int disabledTests() const { return m_disabled; }
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
private:
|
2015-01-08 13:46:28 +01:00
|
|
|
QMap<Result::Type, int> m_testResultCount;
|
2014-10-07 15:51:02 +02:00
|
|
|
int m_widthOfLineNumber;
|
|
|
|
|
int m_maxWidthOfFileName;
|
2015-12-14 12:48:58 +01:00
|
|
|
int m_disabled;
|
2015-08-20 15:59:15 +02:00
|
|
|
QList<int> m_processedIndices;
|
2014-10-07 15:51:02 +02:00
|
|
|
QFont m_measurementFont;
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-21 13:10:37 +02:00
|
|
|
class TestResultFilterModel : public QSortFilterProxyModel
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
TestResultFilterModel(TestResultModel *sourceModel, QObject *parent = 0);
|
|
|
|
|
|
|
|
|
|
void enableAllResultTypes();
|
2015-01-08 13:46:28 +01:00
|
|
|
void toggleTestResultType(Result::Type type);
|
2014-10-21 13:10:37 +02:00
|
|
|
void clearTestResults();
|
|
|
|
|
bool hasResults();
|
|
|
|
|
TestResult testResult(const QModelIndex &index) const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
TestResultModel *m_sourceModel;
|
2015-01-08 13:46:28 +01:00
|
|
|
QSet<Result::Type> m_enabled;
|
2014-10-21 13:10:37 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|
|
|
|
|
|
|
|
|
|
#endif // TESTRESULTMODEL_H
|