Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtestcoreelement_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QTESTCOREELEMENT_P_H
5#define QTESTCOREELEMENT_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/qttestglobal.h>
19#include <QtTest/private/qtestelementattribute_p.h>
20
21#include <vector>
22
24
25
26template <class ElementType>
28{
29 public:
32
34 const std::vector<QTestElementAttribute*> &attributes() const;
38
39 const char *elementName() const;
41
42 private:
43 std::vector<QTestElementAttribute*> listOfAttributes;
45};
46
47template<class ElementType>
52
53template<class ElementType>
55{
56 for (auto *attribute : listOfAttributes)
57 delete attribute;
58}
59
60template <class ElementType>
62{
63 if (attributeIndex == -1 || attribute(attributeIndex))
64 return;
65
67 testAttribute->setPair(attributeIndex, value);
68 listOfAttributes.push_back(testAttribute);
69}
70
71template <class ElementType>
72const std::vector<QTestElementAttribute*> &QTestCoreElement<ElementType>::attributes() const
73{
74 return listOfAttributes;
75}
76
77template <class ElementType>
79{
81 if (attrb)
82 return attrb->value();
83
84 return nullptr;
85}
86
87template <class ElementType>
89{
91 if (attrb)
92 return attrb->name();
93
94 return nullptr;
95}
96
97template <class ElementType>
99{
100 const char *xmlElementNames[] =
101 {
102 "property",
103 "properties",
104 "failure",
105 "error",
106 "testcase",
107 "testsuite",
108 "message",
109 "system-err",
110 "system-out",
111 "skipped"
112 };
113
115 return xmlElementNames[type];
116
117 return nullptr;
118}
119
120template <class ElementType>
125
126template <class ElementType>
128{
129 for (auto *attribute : listOfAttributes) {
130 if (attribute->index() == index)
131 return attribute;
132 }
133
134 return nullptr;
135}
136
138
139#endif
const char * attributeValue(QTest::AttributeIndex index) const
const char * attributeName(QTest::AttributeIndex index) const
void addAttribute(const QTest::AttributeIndex index, const char *value)
const std::vector< QTestElementAttribute * > & attributes() const
QTest::LogElementType elementType() const
const char * elementName() const
QTestCoreElement(QTest::LogElementType type=QTest::LET_Undefined)
const QTestElementAttribute * attribute(QTest::AttributeIndex index) const
bool setPair(QTest::AttributeIndex attributeIndex, const char *value)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputLayerEXT EGLint attribute
GLuint index
[2]
GLenum type
GLdouble GLdouble t
Definition qopenglext.h:243