| 1 | // Copyright (C) 2021 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 QXMLTESTLOGGER_P_H |
| 5 | #define QXMLTESTLOGGER_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 | |
| 19 | #include <QtTest/private/qabstracttestlogger_p.h> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class QXmlTestLogger : public QAbstractTestLogger |
| 24 | { |
| 25 | public: |
| 26 | enum XmlMode { Complete = 0, Light }; |
| 27 | |
| 28 | QXmlTestLogger(XmlMode mode, const char *filename); |
| 29 | ~QXmlTestLogger(); |
| 30 | |
| 31 | void startLogging() override; |
| 32 | void stopLogging() override; |
| 33 | |
| 34 | void enterTestFunction(const char *function) override; |
| 35 | void leaveTestFunction() override; |
| 36 | |
| 37 | void addIncident(IncidentTypes type, const char *description, |
| 38 | const char *file = nullptr, int line = 0) override; |
| 39 | void addBenchmarkResult(const QBenchmarkResult &result) override; |
| 40 | |
| 41 | void addMessage(MessageTypes type, const QString &message, |
| 42 | const char *file = nullptr, int line = 0) override; |
| 43 | |
| 44 | [[nodiscard]] static bool xmlCdata(QTestCharBuffer *dest, char const *src); |
| 45 | [[nodiscard]] static bool xmlQuote(QTestCharBuffer *dest, char const *src); |
| 46 | private: |
| 47 | [[nodiscard]] static int xmlCdata(QTestCharBuffer *dest, char const *src, qsizetype n); |
| 48 | [[nodiscard]] static int xmlQuote(QTestCharBuffer *dest, char const *src, qsizetype n); |
| 49 | |
| 50 | XmlMode xmlmode; |
| 51 | }; |
| 52 | |
| 53 | QT_END_NAMESPACE |
| 54 | |
| 55 | #endif |
| 56 | |