Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/util/qqmllistaccessor.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | QQmlListAccessor::QQmlListAccessor() | - | ||||||||||||
9 | : m_type(Invalid) | - | ||||||||||||
10 | { | - | ||||||||||||
11 | } executed 5622 times by 27 tests: end of block Executed by:
| 5622 | ||||||||||||
12 | - | |||||||||||||
13 | QQmlListAccessor::~QQmlListAccessor() | - | ||||||||||||
14 | { | - | ||||||||||||
15 | } | - | ||||||||||||
16 | - | |||||||||||||
17 | QVariant QQmlListAccessor::list() const | - | ||||||||||||
18 | { | - | ||||||||||||
19 | return executed 5492 times by 25 tests: d;return d; Executed by:
executed 5492 times by 25 tests: return d; Executed by:
| 5492 | ||||||||||||
20 | } | - | ||||||||||||
21 | - | |||||||||||||
22 | void QQmlListAccessor::setList(const QVariant &v, QQmlEngine *engine) | - | ||||||||||||
23 | { | - | ||||||||||||
24 | d = v; | - | ||||||||||||
25 | - | |||||||||||||
26 | - | |||||||||||||
27 | - | |||||||||||||
28 | if (d.userType() == qMetaTypeId<QJSValue>()
| 46-5436 | ||||||||||||
29 | d = d.value<QJSValue>().toVariant(); executed 46 times by 2 tests: d = d.value<QJSValue>().toVariant(); Executed by:
| 46 | ||||||||||||
30 | - | |||||||||||||
31 | QQmlEnginePrivate *enginePrivate = engine
| 516-4966 | ||||||||||||
32 | - | |||||||||||||
33 | if (!d.isValid()
| 548-4934 | ||||||||||||
34 | m_type = Invalid; | - | ||||||||||||
35 | } executed 548 times by 6 tests: else if (d.userType() == QVariant::StringListend of block Executed by:
| 10-4924 | ||||||||||||
36 | m_type = StringList; | - | ||||||||||||
37 | } executed 10 times by 2 tests: else if (d.userType() == QMetaType::QVariantListend of block Executed by:
| 10-4730 | ||||||||||||
38 | m_type = VariantList; | - | ||||||||||||
39 | } executed 194 times by 9 tests: else if (d.canConvert(QVariant::Int)end of block Executed by:
| 194-4184 | ||||||||||||
40 | m_type = Integer; | - | ||||||||||||
41 | } executed 546 times by 21 tests: else if ((!enginePrivateend of block Executed by:
| 0-4184 | ||||||||||||
42 | (enginePrivate
| 0-4184 | ||||||||||||
43 | QObject *data = enginePrivate
| 0-3966 | ||||||||||||
44 | d = QVariant::fromValue(data); | - | ||||||||||||
45 | m_type = Instance; | - | ||||||||||||
46 | } executed 3966 times by 12 tests: else if (d.userType() == qMetaTypeId<QQmlListReference>()end of block Executed by:
| 22-3966 | ||||||||||||
47 | m_type = ListProperty; | - | ||||||||||||
48 | } executed 22 times by 3 tests: else {end of block Executed by:
| 22 | ||||||||||||
49 | m_type = Instance; | - | ||||||||||||
50 | } executed 196 times by 3 tests: end of block Executed by:
| 196 | ||||||||||||
51 | } | - | ||||||||||||
52 | - | |||||||||||||
53 | int QQmlListAccessor::count() const | - | ||||||||||||
54 | { | - | ||||||||||||
55 | switch(m_type) { | - | ||||||||||||
56 | case executed 530 times by 2 tests: StringList:case StringList: Executed by:
executed 530 times by 2 tests: case StringList: Executed by:
| 530 | ||||||||||||
57 | return executed 530 times by 2 tests: qvariant_cast<QStringList>(d).count();return qvariant_cast<QStringList>(d).count(); Executed by:
executed 530 times by 2 tests: return qvariant_cast<QStringList>(d).count(); Executed by:
| 530 | ||||||||||||
58 | case executed 6014 times by 9 tests: VariantList:case VariantList: Executed by:
executed 6014 times by 9 tests: case VariantList: Executed by:
| 6014 | ||||||||||||
59 | return executed 6014 times by 9 tests: qvariant_cast<QVariantList>(d).count();return qvariant_cast<QVariantList>(d).count(); Executed by:
executed 6014 times by 9 tests: return qvariant_cast<QVariantList>(d).count(); Executed by:
| 6014 | ||||||||||||
60 | case executed 1926 times by 3 tests: ListProperty:case ListProperty: Executed by:
executed 1926 times by 3 tests: case ListProperty: Executed by:
| 1926 | ||||||||||||
61 | return executed 1926 times by 3 tests: ((const QQmlListReference *)d.constData())->count();return ((const QQmlListReference *)d.constData())->count(); Executed by:
executed 1926 times by 3 tests: return ((const QQmlListReference *)d.constData())->count(); Executed by:
| 1926 | ||||||||||||
62 | case executed 10 times by 1 test: Instance:case Instance: Executed by:
executed 10 times by 1 test: case Instance: Executed by:
| 10 | ||||||||||||
63 | return executed 10 times by 1 test: 1;return 1; Executed by:
executed 10 times by 1 test: return 1; Executed by:
| 10 | ||||||||||||
64 | case executed 34212 times by 21 tests: Integer:case Integer: Executed by:
executed 34212 times by 21 tests: case Integer: Executed by:
| 34212 | ||||||||||||
65 | return executed 34212 times by 21 tests: d.toInt();return d.toInt(); Executed by:
executed 34212 times by 21 tests: return d.toInt(); Executed by:
| 34212 | ||||||||||||
66 | default never executed: :default: never executed: default: | 0 | ||||||||||||
67 | case never executed: Invalid:case Invalid: never executed: case Invalid: | 0 | ||||||||||||
68 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
69 | } | - | ||||||||||||
70 | } | - | ||||||||||||
71 | - | |||||||||||||
72 | QVariant QQmlListAccessor::at(int idx) const | - | ||||||||||||
73 | { | - | ||||||||||||
74 | ((idx >= 0 && idx < count()) ? static_cast<void>(0) : qt_assert("idx >= 0 && idx < count()", __FILE__, 118)); | - | ||||||||||||
75 | switch(m_type) { | - | ||||||||||||
76 | case executed 130 times by 2 tests: StringList:case StringList: Executed by:
executed 130 times by 2 tests: case StringList: Executed by:
| 130 | ||||||||||||
77 | return executed 130 times by 2 tests: QVariant::fromValue(qvariant_cast<QStringList>(d).at(idx));return QVariant::fromValue(qvariant_cast<QStringList>(d).at(idx)); Executed by:
executed 130 times by 2 tests: return QVariant::fromValue(qvariant_cast<QStringList>(d).at(idx)); Executed by:
| 130 | ||||||||||||
78 | case executed 1442 times by 5 tests: VariantList:case VariantList: Executed by:
executed 1442 times by 5 tests: case VariantList: Executed by:
| 1442 | ||||||||||||
79 | return executed 1442 times by 5 tests: qvariant_cast<QVariantList>(d).at(idx);return qvariant_cast<QVariantList>(d).at(idx); Executed by:
executed 1442 times by 5 tests: return qvariant_cast<QVariantList>(d).at(idx); Executed by:
| 1442 | ||||||||||||
80 | case executed 494 times by 3 tests: ListProperty:case ListProperty: Executed by:
executed 494 times by 3 tests: case ListProperty: Executed by:
| 494 | ||||||||||||
81 | return executed 494 times by 3 tests: QVariant::fromValue(((const QQmlListReference *)d.constData())->at(idx));return QVariant::fromValue(((const QQmlListReference *)d.constData())->at(idx)); Executed by:
executed 494 times by 3 tests: return QVariant::fromValue(((const QQmlListReference *)d.constData())->at(idx)); Executed by:
| 494 | ||||||||||||
82 | case executed 2 times by 1 test: Instance:case Instance: Executed by:
executed 2 times by 1 test: case Instance: Executed by:
| 2 | ||||||||||||
83 | return executed 2 times by 1 test: d;return d; Executed by:
executed 2 times by 1 test: return d; Executed by:
| 2 | ||||||||||||
84 | case executed 8483 times by 21 tests: Integer:case Integer: Executed by:
executed 8483 times by 21 tests: case Integer: Executed by:
| 8483 | ||||||||||||
85 | return executed 8483 times by 21 tests: QVariant(idx);return QVariant(idx); Executed by:
executed 8483 times by 21 tests: return QVariant(idx); Executed by:
| 8483 | ||||||||||||
86 | default never executed: :default: never executed: default: | 0 | ||||||||||||
87 | case never executed: Invalid:case Invalid: never executed: case Invalid: | 0 | ||||||||||||
88 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||
89 | } | - | ||||||||||||
90 | } | - | ||||||||||||
91 | - | |||||||||||||
92 | bool QQmlListAccessor::isValid() const | - | ||||||||||||
93 | { | - | ||||||||||||
94 | return never executed: m_type != Invalid;return m_type != Invalid; never executed: return m_type != Invalid; | 0 | ||||||||||||
95 | } | - | ||||||||||||
96 | - | |||||||||||||
97 | - | |||||||||||||
Switch to Source code | Preprocessed file |