| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QPLAINTESTLOGGER_P_H |
| 5 | #define QPLAINTESTLOGGER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtTest/private/qabstracttestlogger_p.h> |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | class QPlainTestLogger : public QAbstractTestLogger |
| 23 | { |
| 24 | public: |
| 25 | QPlainTestLogger(const char *filename); |
| 26 | ~QPlainTestLogger(); |
| 27 | |
| 28 | void startLogging() override; |
| 29 | void stopLogging() override; |
| 30 | |
| 31 | void enterTestFunction(const char *function) override; |
| 32 | void leaveTestFunction() override; |
| 33 | |
| 34 | void addIncident(IncidentTypes type, const char *description, |
| 35 | const char *file = nullptr, int line = 0) override; |
| 36 | void addBenchmarkResult(const QBenchmarkResult &) final override |
| 37 | { Q_UNREACHABLE(); } |
| 38 | void addBenchmarkResults(const QList<QBenchmarkResult> &results) override; |
| 39 | |
| 40 | void addMessage(QtMsgType, const QMessageLogContext &, |
| 41 | const QString &) override; |
| 42 | |
| 43 | void addMessage(MessageTypes type, const QString &message, |
| 44 | const char *file = nullptr, int line = 0) override; |
| 45 | |
| 46 | bool isRepeatSupported() const override; |
| 47 | |
| 48 | private: |
| 49 | enum class MessageSource { |
| 50 | Incident, |
| 51 | Other, |
| 52 | }; |
| 53 | void printMessage(MessageSource source, const char *type, const char *msg, |
| 54 | const char *file = nullptr, int line = 0); |
| 55 | void outputMessage(const char *str); |
| 56 | void (const QBenchmarkResult &result); |
| 57 | void printBenchmarkResults(const QList<QBenchmarkResult> &result); |
| 58 | }; |
| 59 | |
| 60 | QT_END_NAMESPACE |
| 61 | |
| 62 | #endif |
| 63 | |