2014-10-07 15:51:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** This file is part of Qt Creator.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
2014-10-07 15:51:02 +02:00
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-01-12 13:52:21 +01:00
|
|
|
#include "autotestconstants.h"
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <QString>
|
|
|
|
|
#include <QColor>
|
2015-02-16 13:12:50 +01:00
|
|
|
#include <QMetaType>
|
2016-02-25 13:02:31 +01:00
|
|
|
#include <QSharedPointer>
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-01-08 13:46:28 +01:00
|
|
|
namespace Result{
|
|
|
|
|
enum Type {
|
2015-12-07 08:26:54 +01:00
|
|
|
Pass, FIRST_TYPE = Pass,
|
|
|
|
|
Fail,
|
|
|
|
|
ExpectedFail,
|
|
|
|
|
UnexpectedPass,
|
|
|
|
|
Skip,
|
|
|
|
|
BlacklistedPass,
|
|
|
|
|
BlacklistedFail,
|
|
|
|
|
Benchmark,
|
|
|
|
|
MessageDebug,
|
2016-07-11 10:55:43 +02:00
|
|
|
MessageInfo,
|
2015-12-07 08:26:54 +01:00
|
|
|
MessageWarn,
|
|
|
|
|
MessageFatal,
|
2016-07-11 15:13:52 +02:00
|
|
|
MessageSystem,
|
2015-09-23 07:14:25 +02:00
|
|
|
|
2015-12-07 08:26:54 +01:00
|
|
|
MessageInternal, INTERNAL_MESSAGES_BEGIN = MessageInternal,
|
2015-12-14 12:48:58 +01:00
|
|
|
MessageDisabledTests,
|
2015-12-07 08:26:54 +01:00
|
|
|
MessageTestCaseStart,
|
|
|
|
|
MessageTestCaseSuccess,
|
2017-07-10 15:02:24 +02:00
|
|
|
MessageTestCaseSuccessWarn,
|
2015-12-07 08:26:54 +01:00
|
|
|
MessageTestCaseFail,
|
2017-07-10 15:02:24 +02:00
|
|
|
MessageTestCaseFailWarn,
|
2015-12-07 08:26:54 +01:00
|
|
|
MessageTestCaseEnd,
|
2016-10-31 13:11:52 +01:00
|
|
|
MessageIntermediate,
|
2015-12-07 08:26:54 +01:00
|
|
|
MessageCurrentTest, INTERNAL_MESSAGES_END = MessageCurrentTest,
|
2015-09-23 07:14:25 +02:00
|
|
|
|
2015-12-07 08:26:54 +01:00
|
|
|
Invalid,
|
|
|
|
|
LAST_TYPE = Invalid
|
2014-10-07 15:51:02 +02:00
|
|
|
};
|
2015-01-08 13:46:28 +01:00
|
|
|
}
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
class TestResult
|
|
|
|
|
{
|
|
|
|
|
public:
|
2017-06-27 15:15:43 +02:00
|
|
|
TestResult();
|
2016-04-13 10:20:17 +02:00
|
|
|
explicit TestResult(const QString &name);
|
2017-06-27 15:15:43 +02:00
|
|
|
TestResult(const QString &executable, const QString &name);
|
2016-04-13 10:20:17 +02:00
|
|
|
virtual ~TestResult() {}
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-04-13 10:20:17 +02:00
|
|
|
virtual const QString outputString(bool selected) const;
|
|
|
|
|
|
2017-06-27 15:15:43 +02:00
|
|
|
QString executable() const { return m_executable; }
|
2016-04-13 10:20:17 +02:00
|
|
|
QString name() const { return m_name; }
|
2015-01-08 13:46:28 +01:00
|
|
|
Result::Type result() const { return m_result; }
|
2014-10-07 15:51:02 +02:00
|
|
|
QString description() const { return m_description; }
|
|
|
|
|
QString fileName() const { return m_file; }
|
|
|
|
|
int line() const { return m_line; }
|
|
|
|
|
|
2015-01-08 12:51:01 +01:00
|
|
|
void setDescription(const QString &description) { m_description = description; }
|
2014-10-07 15:51:02 +02:00
|
|
|
void setFileName(const QString &fileName) { m_file = fileName; }
|
|
|
|
|
void setLine(int line) { m_line = line; }
|
2015-08-20 15:59:15 +02:00
|
|
|
void setResult(Result::Type type) { m_result = type; }
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-01-08 13:46:28 +01:00
|
|
|
static Result::Type resultFromString(const QString &resultString);
|
|
|
|
|
static Result::Type toResultType(int rt);
|
|
|
|
|
static QString resultToString(const Result::Type type);
|
|
|
|
|
static QColor colorForType(const Result::Type type);
|
2017-01-19 12:15:59 +01:00
|
|
|
static bool isMessageCaseStart(const Result::Type type);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-10-31 13:11:52 +01:00
|
|
|
virtual bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const;
|
|
|
|
|
virtual bool isIntermediateFor(const TestResult *other) const;
|
|
|
|
|
virtual TestResult *createIntermediateResultFor(const TestResult *other);
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
private:
|
2017-06-27 15:15:43 +02:00
|
|
|
QString m_executable;
|
2016-04-13 10:20:17 +02:00
|
|
|
QString m_name;
|
|
|
|
|
Result::Type m_result = Result::Invalid;
|
2014-10-07 15:51:02 +02:00
|
|
|
QString m_description;
|
|
|
|
|
QString m_file;
|
2016-04-13 10:20:17 +02:00
|
|
|
int m_line = 0;
|
2014-10-07 15:51:02 +02:00
|
|
|
};
|
|
|
|
|
|
2016-02-25 13:02:31 +01:00
|
|
|
using TestResultPtr = QSharedPointer<TestResult>;
|
|
|
|
|
|
2014-12-19 11:22:53 +01:00
|
|
|
class FaultyTestResult : public TestResult
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-01-08 13:46:28 +01:00
|
|
|
FaultyTestResult(Result::Type result, const QString &description);
|
2014-12-19 11:22:53 +01:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|
|
|
|
|
|
2015-01-08 12:51:01 +01:00
|
|
|
Q_DECLARE_METATYPE(Autotest::Internal::TestResult)
|
2015-01-08 13:46:28 +01:00
|
|
|
Q_DECLARE_METATYPE(Autotest::Internal::Result::Type)
|