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 TESTRESULT_H
|
|
|
|
|
#define TESTRESULT_H
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QColor>
|
2015-02-16 13:12:50 +01:00
|
|
|
#include <QMetaType>
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-01-08 13:46:28 +01:00
|
|
|
namespace Result{
|
|
|
|
|
enum Type {
|
2014-10-07 15:51:02 +02:00
|
|
|
PASS,
|
|
|
|
|
FAIL,
|
|
|
|
|
EXPECTED_FAIL,
|
|
|
|
|
UNEXPECTED_PASS,
|
|
|
|
|
SKIP,
|
2014-12-01 11:42:28 +01:00
|
|
|
BLACKLISTED_PASS,
|
|
|
|
|
BLACKLISTED_FAIL,
|
2014-12-01 16:12:05 +01:00
|
|
|
BENCHMARK,
|
2014-10-07 15:51:02 +02:00
|
|
|
MESSAGE_DEBUG,
|
|
|
|
|
MESSAGE_WARN,
|
|
|
|
|
MESSAGE_FATAL,
|
|
|
|
|
MESSAGE_INTERNAL,
|
2014-12-05 14:01:16 +01:00
|
|
|
MESSAGE_CURRENT_TEST,
|
2014-10-07 15:51:02 +02:00
|
|
|
UNKNOWN // ???
|
|
|
|
|
};
|
2015-01-08 13:46:28 +01:00
|
|
|
}
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
class TestResult
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2015-01-08 12:51:01 +01:00
|
|
|
TestResult(const QString &className = QString(), const QString &testCase = QString(),
|
|
|
|
|
const QString &dataTag = QString(),
|
2015-01-08 13:46:28 +01:00
|
|
|
Result::Type result = Result::UNKNOWN, const QString &description = QString());
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
QString className() const { return m_class; }
|
|
|
|
|
QString testCase() const { return m_case; }
|
|
|
|
|
QString dataTag() const { return m_dataTag; }
|
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-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);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_class;
|
|
|
|
|
QString m_case;
|
|
|
|
|
QString m_dataTag;
|
2015-01-08 13:46:28 +01:00
|
|
|
Result::Type m_result;
|
2014-10-07 15:51:02 +02:00
|
|
|
QString m_description;
|
|
|
|
|
QString m_file;
|
|
|
|
|
int m_line;
|
|
|
|
|
// environment?
|
|
|
|
|
};
|
|
|
|
|
|
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
|
|
|
bool operator==(const TestResult &t1, const TestResult &t2);
|
|
|
|
|
|
|
|
|
|
} // 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)
|
2014-10-21 13:10:37 +02:00
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
#endif // TESTRESULT_H
|