qtestelementattribute.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtTest module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include <QtTest/private/qtestelementattribute_p.h> -
43#include <QtCore/qbytearray.h> -
44#include <string.h> -
45#include <stdlib.h> -
46 -
47QT_BEGIN_NAMESPACE -
48 -
49/*! \enum QTest::AttributeIndex -
50 This enum numbers the different tests. -
51 -
52 \value AI_Undefined -
53 -
54 \value AI_Name -
55 -
56 \value AI_Result -
57 -
58 \value AI_Tests -
59 -
60 \value AI_Failures -
61 -
62 \value AI_Errors -
63 -
64 \value AI_Type -
65 -
66 \value AI_Description -
67 -
68 \value AI_PropertyValue -
69 -
70 \value AI_QTestVersion -
71 -
72 \value AI_QtVersion -
73 -
74 \value AI_File -
75 -
76 \value AI_Line -
77 -
78 \value AI_Metric -
79 -
80 \value AI_Tag -
81 -
82 \value AI_Value -
83 -
84 \value AI_Iterations -
85*/ -
86 -
87/*! \enum QTest::LogElementType -
88 The enum specifies the kinds of test log messages. -
89 -
90 \value LET_Undefined -
91 -
92 \value LET_Property -
93 -
94 \value LET_Properties -
95 -
96 \value LET_Failure -
97 -
98 \value LET_Error -
99 -
100 \value LET_TestCase -
101 -
102 \value LET_TestSuite -
103 -
104 \value LET_Benchmark -
105 -
106 \value LET_SystemError -
107*/ -
108 -
109QTestElementAttribute::QTestElementAttribute() -
110 :attributeValue(0), -
111 attributeIndex(QTest::AI_Undefined) -
112{ -
113}
never executed: }
0
114 -
115QTestElementAttribute::~QTestElementAttribute() -
116{ -
117 delete[] attributeValue;
never executed (the execution status of this line is deduced): delete[] attributeValue;
-
118}
never executed: }
0
119 -
120const char *QTestElementAttribute::value() const -
121{ -
122 return attributeValue;
never executed: return attributeValue;
0
123} -
124 -
125const char *QTestElementAttribute::name() const -
126{ -
127 const char *AttributeNames[] =
never executed (the execution status of this line is deduced): const char *AttributeNames[] =
-
128 {
never executed (the execution status of this line is deduced): {
-
129 "name",
never executed (the execution status of this line is deduced): "name",
-
130 "result",
never executed (the execution status of this line is deduced): "result",
-
131 "tests",
never executed (the execution status of this line is deduced): "tests",
-
132 "failures",
never executed (the execution status of this line is deduced): "failures",
-
133 "errors",
never executed (the execution status of this line is deduced): "errors",
-
134 "type",
never executed (the execution status of this line is deduced): "type",
-
135 "description",
never executed (the execution status of this line is deduced): "description",
-
136 "value",
never executed (the execution status of this line is deduced): "value",
-
137 "qtestversion",
never executed (the execution status of this line is deduced): "qtestversion",
-
138 "qtversion",
never executed (the execution status of this line is deduced): "qtversion",
-
139 "file",
never executed (the execution status of this line is deduced): "file",
-
140 "line",
never executed (the execution status of this line is deduced): "line",
-
141 "metric",
never executed (the execution status of this line is deduced): "metric",
-
142 "tag",
never executed (the execution status of this line is deduced): "tag",
-
143 "value",
never executed (the execution status of this line is deduced): "value",
-
144 "iterations"
never executed (the execution status of this line is deduced): "iterations"
-
145 };
never executed (the execution status of this line is deduced): };
-
146 -
147 if (attributeIndex != QTest::AI_Undefined)
never evaluated: attributeIndex != QTest::AI_Undefined
0
148 return AttributeNames[attributeIndex];
never executed: return AttributeNames[attributeIndex];
0
149 -
150 return 0;
never executed: return 0;
0
151} -
152 -
153QTest::AttributeIndex QTestElementAttribute::index() const -
154{ -
155 return attributeIndex;
never executed: return attributeIndex;
0
156} -
157 -
158bool QTestElementAttribute::isNull() const -
159{ -
160 return attributeIndex == QTest::AI_Undefined;
never executed: return attributeIndex == QTest::AI_Undefined;
0
161} -
162 -
163bool QTestElementAttribute::setPair(QTest::AttributeIndex index, const char *value) -
164{ -
165 if (!value)
never evaluated: !value
0
166 return false;
never executed: return false;
0
167 -
168 delete[] attributeValue;
never executed (the execution status of this line is deduced): delete[] attributeValue;
-
169 -
170 attributeIndex = index;
never executed (the execution status of this line is deduced): attributeIndex = index;
-
171 attributeValue = qstrdup(value);
never executed (the execution status of this line is deduced): attributeValue = qstrdup(value);
-
172 -
173 return (attributeValue!=0) ? true:false;
never executed: return (attributeValue!=0) ? true:false;
0
174} -
175 -
176QT_END_NAMESPACE -
177 -
178 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial