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 QTESTJUNITSTREAMER_P_H
5#define QTESTJUNITSTREAMER_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 <QtCore/private/qglobal_p.h>
19#include <vector>
20
21QT_BEGIN_NAMESPACE
22
23
24class QTestElement;
25class QTestElementAttribute;
26class QJUnitTestLogger;
27struct QTestCharBuffer;
28
29class QTestJUnitStreamer
30{
31 public:
32 QTestJUnitStreamer(QJUnitTestLogger *logger);
33 ~QTestJUnitStreamer();
34
35 void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
36 void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
37 void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
38 void output(QTestElement *element) const;
39 void outputElements(const std::vector<QTestElement*> &) const;
40 void outputElementAttributes(const QTestElement *element, const std::vector<QTestElementAttribute*> &attributes) const;
41
42 void outputString(const char *msg) const;
43
44 private:
45 [[nodiscard]] bool formatAttributes(const QTestElement *element,
46 const QTestElementAttribute *attribute,
47 QTestCharBuffer *formatted) const;
48 static void indentForElement(const QTestElement* element, char* buf, int size);
49
50 QJUnitTestLogger *testLogger;
51};
52
53QT_END_NAMESPACE
54
55#endif
56

source code of qtbase/src/testlib/qtestjunitstreamer_p.h