Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | QAnimationGroup::QAnimationGroup(QObject *parent) | - |
12 | : QAbstractAnimation(*new QAnimationGroupPrivate, parent) | - |
13 | { | - |
14 | } executed: } Execution Count:1 | 1 |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | QAnimationGroup::QAnimationGroup(QAnimationGroupPrivate &dd, QObject *parent) | - |
20 | : QAbstractAnimation(dd, parent) | - |
21 | { | - |
22 | } executed: } Execution Count:145 | 145 |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | QAnimationGroup::~QAnimationGroup() | - |
28 | { | - |
29 | } | - |
30 | QAbstractAnimation *QAnimationGroup::animationAt(int index) const | - |
31 | { | - |
32 | const QAnimationGroupPrivate * const d = d_func(); | - |
33 | | - |
34 | if (index < 0 || index >= d->animations.size()) { partially evaluated: index < 0 no Evaluation Count:0 | yes Evaluation Count:85 |
partially evaluated: index >= d->animations.size() no Evaluation Count:0 | yes Evaluation Count:85 |
| 0-85 |
35 | QMessageLogger("animation/qanimationgroup.cpp", 132, __PRETTY_FUNCTION__).warning("QAnimationGroup::animationAt: index is out of bounds"); | - |
36 | return 0; never executed: return 0; | 0 |
37 | } | - |
38 | | - |
39 | return d->animations.at(index); executed: return d->animations.at(index); Execution Count:85 | 85 |
40 | } | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
48 | int QAnimationGroup::animationCount() const | - |
49 | { | - |
50 | const QAnimationGroupPrivate * const d = d_func(); | - |
51 | return d->animations.size(); executed: return d->animations.size(); Execution Count:37 | 37 |
52 | } | - |
53 | | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const | - |
61 | { | - |
62 | const QAnimationGroupPrivate * const d = d_func(); | - |
63 | return d->animations.indexOf(animation); never executed: return d->animations.indexOf(animation); | 0 |
64 | } | - |
65 | void QAnimationGroup::addAnimation(QAbstractAnimation *animation) | - |
66 | { | - |
67 | QAnimationGroupPrivate * const d = d_func(); | - |
68 | insertAnimation(d->animations.count(), animation); | - |
69 | } executed: } Execution Count:335 | 335 |
70 | void QAnimationGroup::insertAnimation(int index, QAbstractAnimation *animation) | - |
71 | { | - |
72 | QAnimationGroupPrivate * const d = d_func(); | - |
73 | | - |
74 | if (index < 0 || index > d->animations.size()) { partially evaluated: index < 0 no Evaluation Count:0 | yes Evaluation Count:337 |
partially evaluated: index > d->animations.size() no Evaluation Count:0 | yes Evaluation Count:337 |
| 0-337 |
75 | QMessageLogger("animation/qanimationgroup.cpp", 191, __PRETTY_FUNCTION__).warning("QAnimationGroup::insertAnimation: index is out of bounds"); | - |
76 | return; | 0 |
77 | } | - |
78 | | - |
79 | if (QAnimationGroup *oldGroup = animation->group()) evaluated: QAnimationGroup *oldGroup = animation->group() yes Evaluation Count:2 | yes Evaluation Count:335 |
| 2-335 |
80 | oldGroup->removeAnimation(animation); executed: oldGroup->removeAnimation(animation); Execution Count:2 | 2 |
81 | | - |
82 | d->animations.insert(index, animation); | - |
83 | QAbstractAnimationPrivate::get(animation)->group = this; | - |
84 | | - |
85 | animation->setParent(this); | - |
86 | d->animationInsertedAt(index); | - |
87 | } executed: } Execution Count:337 | 337 |
88 | | - |
89 | | - |
90 | | - |
91 | | - |
92 | | - |
93 | | - |
94 | | - |
95 | void QAnimationGroup::removeAnimation(QAbstractAnimation *animation) | - |
96 | { | - |
97 | QAnimationGroupPrivate * const d = d_func(); | - |
98 | | - |
99 | if (!animation) { partially evaluated: !animation no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
100 | QMessageLogger("animation/qanimationgroup.cpp", 216, __PRETTY_FUNCTION__).warning("QAnimationGroup::remove: cannot remove null animation"); | - |
101 | return; | 0 |
102 | } | - |
103 | int index = d->animations.indexOf(animation); | - |
104 | if (index == -1) { partially evaluated: index == -1 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
105 | QMessageLogger("animation/qanimationgroup.cpp", 221, __PRETTY_FUNCTION__).warning("QAnimationGroup::remove: animation is not part of this group"); | - |
106 | return; | 0 |
107 | } | - |
108 | | - |
109 | takeAnimation(index); | - |
110 | } executed: } Execution Count:8 | 8 |
111 | QAbstractAnimation *QAnimationGroup::takeAnimation(int index) | - |
112 | { | - |
113 | QAnimationGroupPrivate * const d = d_func(); | - |
114 | if (index < 0 || index >= d->animations.size()) { partially evaluated: index < 0 no Evaluation Count:0 | yes Evaluation Count:229 |
partially evaluated: index >= d->animations.size() no Evaluation Count:0 | yes Evaluation Count:229 |
| 0-229 |
115 | QMessageLogger("animation/qanimationgroup.cpp", 239, __PRETTY_FUNCTION__).warning("QAnimationGroup::takeAnimation: no animation at index %d", index); | - |
116 | return 0; never executed: return 0; | 0 |
117 | } | - |
118 | QAbstractAnimation *animation = d->animations.at(index); | - |
119 | QAbstractAnimationPrivate::get(animation)->group = 0; | - |
120 | | - |
121 | | - |
122 | d->animations.removeAt(index); | - |
123 | animation->setParent(0); | - |
124 | d->animationRemoved(index, animation); | - |
125 | return animation; executed: return animation; Execution Count:229 | 229 |
126 | } | - |
127 | | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | | - |
134 | void QAnimationGroup::clear() | - |
135 | { | - |
136 | QAnimationGroupPrivate * const d = d_func(); | - |
137 | qDeleteAll(d->animations); | - |
138 | } executed: } Execution Count:5 | 5 |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | bool QAnimationGroup::event(QEvent *event) | - |
144 | { | - |
145 | QAnimationGroupPrivate * const d = d_func(); | - |
146 | if (event->type() == QEvent::ChildAdded) { evaluated: event->type() == QEvent::ChildAdded yes Evaluation Count:337 | yes Evaluation Count:450 |
| 337-450 |
147 | QChildEvent *childEvent = static_cast<QChildEvent *>(event); | - |
148 | if (QAbstractAnimation *a = qobject_cast<QAbstractAnimation *>(childEvent->child())) { partially evaluated: QAbstractAnimation *a = qobject_cast<QAbstractAnimation *>(childEvent->child()) yes Evaluation Count:337 | no Evaluation Count:0 |
| 0-337 |
149 | if (a->group() != this) evaluated: a->group() != this yes Evaluation Count:65 | yes Evaluation Count:272 |
| 65-272 |
150 | addAnimation(a); executed: addAnimation(a); Execution Count:65 | 65 |
151 | } executed: } Execution Count:337 | 337 |
152 | } else if (event->type() == QEvent::ChildRemoved) { executed: } Execution Count:337 partially evaluated: event->type() == QEvent::ChildRemoved yes Evaluation Count:450 | no Evaluation Count:0 |
| 0-450 |
153 | QChildEvent *childEvent = static_cast<QChildEvent *>(event); | - |
154 | QAbstractAnimation *a = static_cast<QAbstractAnimation *>(childEvent->child()); | - |
155 | | - |
156 | | - |
157 | int index = d->animations.indexOf(a); | - |
158 | if (index != -1) evaluated: index != -1 yes Evaluation Count:221 | yes Evaluation Count:229 |
| 221-229 |
159 | takeAnimation(index); executed: takeAnimation(index); Execution Count:221 | 221 |
160 | } executed: } Execution Count:450 | 450 |
161 | return QAbstractAnimation::event(event); executed: return QAbstractAnimation::event(event); Execution Count:787 | 787 |
162 | } | - |
163 | | - |
164 | | - |
165 | void QAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *) | - |
166 | { | - |
167 | QAnimationGroup * const q = q_func(); | - |
168 | (void)index;; | - |
169 | if (animations.isEmpty()) { evaluated: animations.isEmpty() yes Evaluation Count:77 | yes Evaluation Count:152 |
| 77-152 |
170 | currentTime = 0; | - |
171 | q->stop(); | - |
172 | } executed: } Execution Count:77 | 77 |
173 | } executed: } Execution Count:229 | 229 |
174 | | - |
175 | | - |
176 | | - |
177 | | - |
| | |