OpenCoverage

qqmlpropertymap.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/util/qqmlpropertymap.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8class QQmlPropertyMapMetaObject : public QQmlOpenMetaObject-
9{-
10public:-
11 QQmlPropertyMapMetaObject(QQmlPropertyMap *obj, QQmlPropertyMapPrivate *objPriv, const QMetaObject *staticMetaObject);-
12-
13protected:-
14 QVariant propertyWriteValue(int, const QVariant &) override;-
15 void propertyWritten(int index) override;-
16 void propertyCreated(int, QMetaPropertyBuilder &) override;-
17 int createProperty(const char *, const char *) override;-
18-
19 const QString &propertyName(int index);-
20-
21private:-
22 QQmlPropertyMap *map;-
23 QQmlPropertyMapPrivate *priv;-
24};-
25-
26class QQmlPropertyMapPrivate : public QObjectPrivate-
27{-
28 inline QQmlPropertyMap* q_func() { return static_cast<QQmlPropertyMap *>(q_ptr); } inline const QQmlPropertyMap* q_func() const { return static_cast<const QQmlPropertyMap *>(q_ptr); } friend class QQmlPropertyMap;-
29public:-
30 QQmlPropertyMapMetaObject *mo;-
31 QStringList keys;-
32-
33 QVariant updateValue(const QString &key, const QVariant &input);-
34 void emitChanged(const QString &key, const QVariant &value);-
35 bool validKeyName(const QString& name);-
36-
37 const QString &propertyName(int index) const;-
38};-
39-
40bool QQmlPropertyMapPrivate::validKeyName(const QString& name)-
41{-
42-
43 return
executed 100 times by 1 test: return name != QLatin1String("keys") && name != QLatin1String("valueChanged") && name != QLatin1String("QObject") && name != QLatin1String("destroyed") && name != QLatin1String("deleteLater");
Executed by:
  • tst_qqmlpropertymap
name != QLatin1String("keys")
executed 100 times by 1 test: return name != QLatin1String("keys") && name != QLatin1String("valueChanged") && name != QLatin1String("QObject") && name != QLatin1String("destroyed") && name != QLatin1String("deleteLater");
Executed by:
  • tst_qqmlpropertymap
100
44 && name != QLatin1String("valueChanged")
executed 100 times by 1 test: return name != QLatin1String("keys") && name != QLatin1String("valueChanged") && name != QLatin1String("QObject") && name != QLatin1String("destroyed") && name != QLatin1String("deleteLater");
Executed by:
  • tst_qqmlpropertymap
100
45 && name != QLatin1String("QObject")
executed 100 times by 1 test: return name != QLatin1String("keys") && name != QLatin1String("valueChanged") && name != QLatin1String("QObject") && name != QLatin1String("destroyed") && name != QLatin1String("deleteLater");
Executed by:
  • tst_qqmlpropertymap
100
46 && name != QLatin1String("destroyed")
executed 100 times by 1 test: return name != QLatin1String("keys") && name != QLatin1String("valueChanged") && name != QLatin1String("QObject") && name != QLatin1String("destroyed") && name != QLatin1String("deleteLater");
Executed by:
  • tst_qqmlpropertymap
100
47 && name != QLatin1String("deleteLater");
executed 100 times by 1 test: return name != QLatin1String("keys") && name != QLatin1String("valueChanged") && name != QLatin1String("QObject") && name != QLatin1String("destroyed") && name != QLatin1String("deleteLater");
Executed by:
  • tst_qqmlpropertymap
100
48}-
49-
50QVariant QQmlPropertyMapPrivate::updateValue(const QString &key, const QVariant &input)-
51{-
52 QQmlPropertyMap * const q = q_func();-
53 return
executed 10 times by 1 test: return q->updateValue(key, input);
Executed by:
  • tst_qqmlpropertymap
q->updateValue(key, input);
executed 10 times by 1 test: return q->updateValue(key, input);
Executed by:
  • tst_qqmlpropertymap
10
54}-
55-
56void QQmlPropertyMapPrivate::emitChanged(const QString &key, const QVariant &value)-
57{-
58 QQmlPropertyMap * const q = q_func();-
59 q->valueChanged(key, value);-
60}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qqmlpropertymap
10
61-
62const QString &QQmlPropertyMapPrivate::propertyName(int index) const-
63{-
64 ((index < keys.size()) ? static_cast<void>(0) : qt_assert("index < keys.size()", __FILE__, 107));-
65 return
executed 20 times by 1 test: return keys[index];
Executed by:
  • tst_qqmlpropertymap
keys[index];
executed 20 times by 1 test: return keys[index];
Executed by:
  • tst_qqmlpropertymap
20
66}-
67-
68QQmlPropertyMapMetaObject::QQmlPropertyMapMetaObject(QQmlPropertyMap *obj, QQmlPropertyMapPrivate *objPriv, const QMetaObject *staticMetaObject)-
69 : QQmlOpenMetaObject(obj, staticMetaObject)-
70{-
71 map = obj;-
72 priv = objPriv;-
73}
executed 68 times by 6 tests: end of block
Executed by:
  • tst_qqmlpropertymap
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_signalspy
  • tst_testfiltering
68
74-
75QVariant QQmlPropertyMapMetaObject::propertyWriteValue(int index, const QVariant &input)-
76{-
77 return
executed 10 times by 1 test: return priv->updateValue(priv->propertyName(index), input);
Executed by:
  • tst_qqmlpropertymap
priv->updateValue(priv->propertyName(index), input);
executed 10 times by 1 test: return priv->updateValue(priv->propertyName(index), input);
Executed by:
  • tst_qqmlpropertymap
10
78}-
79-
80void QQmlPropertyMapMetaObject::propertyWritten(int index)-
81{-
82 priv->emitChanged(priv->propertyName(index), value(index));-
83}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qqmlpropertymap
10
84-
85void QQmlPropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilder &b)-
86{-
87 priv->keys.append(QString::fromUtf8(b.name()));-
88}
executed 46 times by 1 test: end of block
Executed by:
  • tst_qqmlpropertymap
46
89-
90int QQmlPropertyMapMetaObject::createProperty(const char *name, const char *value)-
91{-
92 if (!priv->validKeyName(QString::fromUtf8(name))
!priv->validKe...romUtf8(name))Description
TRUEnever evaluated
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qqmlpropertymap
)
0-46
93 return
never executed: return -1;
-1;
never executed: return -1;
0
94 return
executed 46 times by 1 test: return QQmlOpenMetaObject::createProperty(name, value);
Executed by:
  • tst_qqmlpropertymap
QQmlOpenMetaObject::createProperty(name, value);
executed 46 times by 1 test: return QQmlOpenMetaObject::createProperty(name, value);
Executed by:
  • tst_qqmlpropertymap
46
95}-
96QQmlPropertyMap::QQmlPropertyMap(QObject *parent)-
97: QQmlPropertyMap(&staticMetaObject, parent)-
98{-
99}
executed 54 times by 5 tests: end of block
Executed by:
  • tst_qqmlpropertymap
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
54
100-
101-
102-
103-
104QQmlPropertyMap::~QQmlPropertyMap()-
105{-
106}-
107-
108-
109-
110-
111void QQmlPropertyMap::clear(const QString &key)-
112{-
113 QQmlPropertyMapPrivate * const d = d_func();-
114 d->mo->setValue(key.toUtf8(), QVariant());-
115}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlpropertymap
6
116-
117-
118-
119-
120-
121-
122-
123QVariant QQmlPropertyMap::value(const QString &key) const-
124{-
125 const QQmlPropertyMapPrivate * const d = d_func();-
126 return
executed 44 times by 1 test: return d->mo->value(key.toUtf8());
Executed by:
  • tst_qqmlpropertymap
d->mo->value(key.toUtf8());
executed 44 times by 1 test: return d->mo->value(key.toUtf8());
Executed by:
  • tst_qqmlpropertymap
44
127}-
128-
129-
130-
131-
132-
133-
134void QQmlPropertyMap::insert(const QString &key, const QVariant &value)-
135{-
136 QQmlPropertyMapPrivate * const d = d_func();-
137-
138 if (d->validKeyName(key)
d->validKeyName(key)Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qqmlpropertymap
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlpropertymap
) {
6-48
139 d->mo->setValue(key.toUtf8(), value);-
140 }
executed 48 times by 1 test: end of block
Executed by:
  • tst_qqmlpropertymap
else {
48
141 QMessageLogger(__FILE__, 233, __PRETTY_FUNCTION__).warning() << "Creating property with name"-
142 << key-
143 << "is not permitted, conflicts with internal symbols.";-
144 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlpropertymap
6
145}-
146-
147-
148-
149-
150-
151-
152-
153QStringList QQmlPropertyMap::keys() const-
154{-
155 const QQmlPropertyMapPrivate * const d = d_func();-
156 return
executed 20 times by 1 test: return d->keys;
Executed by:
  • tst_qqmlpropertymap
d->keys;
executed 20 times by 1 test: return d->keys;
Executed by:
  • tst_qqmlpropertymap
20
157}-
158-
159-
160-
161-
162-
163-
164int QQmlPropertyMap::count() const-
165{-
166 const QQmlPropertyMapPrivate * const d = d_func();-
167 return
executed 10 times by 1 test: return d->keys.count();
Executed by:
  • tst_qqmlpropertymap
d->keys.count();
executed 10 times by 1 test: return d->keys.count();
Executed by:
  • tst_qqmlpropertymap
10
168}-
169-
170-
171-
172-
173-
174-
175int QQmlPropertyMap::size() const-
176{-
177 const QQmlPropertyMapPrivate * const d = d_func();-
178 return
executed 2 times by 1 test: return d->keys.size();
Executed by:
  • tst_qqmlpropertymap
d->keys.size();
executed 2 times by 1 test: return d->keys.size();
Executed by:
  • tst_qqmlpropertymap
2
179}-
180-
181-
182-
183-
184-
185-
186-
187bool QQmlPropertyMap::isEmpty() const-
188{-
189 const QQmlPropertyMapPrivate * const d = d_func();-
190 return
executed 6 times by 1 test: return d->keys.isEmpty();
Executed by:
  • tst_qqmlpropertymap
d->keys.isEmpty();
executed 6 times by 1 test: return d->keys.isEmpty();
Executed by:
  • tst_qqmlpropertymap
6
191}-
192-
193-
194-
195-
196-
197-
198bool QQmlPropertyMap::contains(const QString &key) const-
199{-
200 const QQmlPropertyMapPrivate * const d = d_func();-
201 return
executed 16 times by 1 test: return d->keys.contains(key);
Executed by:
  • tst_qqmlpropertymap
d->keys.contains(key);
executed 16 times by 1 test: return d->keys.contains(key);
Executed by:
  • tst_qqmlpropertymap
16
202}-
203QVariant &QQmlPropertyMap::operator[](const QString &key)-
204{-
205-
206 QQmlPropertyMapPrivate * const d = d_func();-
207 QByteArray utf8key = key.toUtf8();-
208 if (!d->keys.contains(key)
!d->keys.contains(key)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlpropertymap
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlpropertymap
)
2-4
209 insert(key, QVariant());
executed 4 times by 1 test: insert(key, QVariant());
Executed by:
  • tst_qqmlpropertymap
4
210-
211 return
executed 6 times by 1 test: return d->mo->valueRef(utf8key);
Executed by:
  • tst_qqmlpropertymap
d->mo->valueRef(utf8key);
executed 6 times by 1 test: return d->mo->valueRef(utf8key);
Executed by:
  • tst_qqmlpropertymap
6
212}-
213-
214-
215-
216-
217-
218-
219QVariant QQmlPropertyMap::operator[](const QString &key) const-
220{-
221 return
executed 4 times by 1 test: return value(key);
Executed by:
  • tst_qqmlpropertymap
value(key);
executed 4 times by 1 test: return value(key);
Executed by:
  • tst_qqmlpropertymap
4
222}-
223QVariant QQmlPropertyMap::updateValue(const QString &key, const QVariant &input)-
224{-
225 (void)key;-
226 return
executed 6 times by 1 test: return input;
Executed by:
  • tst_qqmlpropertymap
input;
executed 6 times by 1 test: return input;
Executed by:
  • tst_qqmlpropertymap
6
227}-
228-
229-
230QQmlPropertyMap::QQmlPropertyMap(const QMetaObject *staticMetaObject, QObject *parent)-
231 : QObject(*(new QQmlPropertyMapPrivate), parent)-
232{-
233 QQmlPropertyMapPrivate * const d = d_func();-
234 d->mo = new QQmlPropertyMapMetaObject(this, d, staticMetaObject);-
235}
executed 68 times by 6 tests: end of block
Executed by:
  • tst_qqmlpropertymap
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_signalspy
  • tst_testfiltering
68
236-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0