qsequentialanimationgroup.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/animation/qsequentialanimationgroup.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore 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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40/*!-
41 \class QSequentialAnimationGroup-
42 \inmodule QtCore-
43 \brief The QSequentialAnimationGroup class provides a sequential group of animations.-
44 \since 4.6-
45 \ingroup animation-
46-
47 QSequentialAnimationGroup is a QAnimationGroup that runs its-
48 animations in sequence, i.e., it starts one animation after-
49 another has finished playing. The animations are played in the-
50 order they are added to the group (using-
51 \l{QAnimationGroup::}{addAnimation()} or-
52 \l{QAnimationGroup::}{insertAnimation()}). The animation group-
53 finishes when its last animation has finished.-
54-
55 At each moment there is at most one animation that is active in-
56 the group; it is returned by currentAnimation(). An empty group-
57 has no current animation.-
58-
59 A sequential animation group can be treated as any other-
60 animation, i.e., it can be started, stopped, and added to other-
61 groups. You can also call addPause() or insertPause() to add a-
62 pause to a sequential animation group.-
63-
64 \code-
65 QSequentialAnimationGroup *group = new QSequentialAnimationGroup;-
66-
67 group->addAnimation(anim1);-
68 group->addAnimation(anim2);-
69-
70 group->start();-
71 \endcode-
72-
73 In this example, \c anim1 and \c anim2 are two already set up-
74 \l{QPropertyAnimation}s.-
75-
76 \sa QAnimationGroup, QAbstractAnimation, {The Animation Framework}-
77*/-
78-
79#include "qsequentialanimationgroup.h"-
80#include "qsequentialanimationgroup_p.h"-
81-
82#include "qpauseanimation.h"-
83-
84#include <QtCore/qdebug.h>-
85-
86#ifndef QT_NO_ANIMATION-
87-
88QT_BEGIN_NAMESPACE-
89-
90typedef QList<QAbstractAnimation *>::ConstIterator AnimationListConstIt;-
91-
92bool QSequentialAnimationGroupPrivate::atEnd() const-
93{-
94 // we try to detect if we're at the end of the group-
95 //this is true if the following conditions are true:-
96 // 1. we're in the last loop-
97 // 2. the direction is forward-
98 // 3. the current animation is the last one-
99 // 4. the current animation has reached its end-
100 const int animTotalCurrentTime = QAbstractAnimationPrivate::get(currentAnimation)->totalCurrentTime;-
101 return (currentLoop == loopCount - 1
executed 621 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
621
102 && direction == QAbstractAnimation::Forward
executed 621 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
621
103 && currentAnimation == animations.last()
executed 621 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
621
104 && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));
executed 621 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
621
105}-
106-
107int QSequentialAnimationGroupPrivate::animationActualTotalDuration(int index) const-
108{-
109 QAbstractAnimation *anim = animations.at(index);-
110 int ret = anim->totalDuration();-
111 if (ret == -1 && actualDuration.size() > index)
ret == -1Description
TRUEevaluated 78 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 1232 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
actualDuration.size() > indexDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
22-1232
112 ret = actualDuration.at(index); //we can try the actual duration there
executed 22 times by 1 test: ret = actualDuration.at(index);
Executed by:
  • tst_QSequentialAnimationGroup
22
113 return ret;
executed 1310 times by 5 tests: return ret;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1310
114}-
115-
116QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivate::indexForCurrentTime() const-
117{-
118 Q_ASSERT(!animations.isEmpty());-
119-
120 AnimationIndex ret;-
121 int duration = 0;-
122-
123 for (int i = 0; i < animations.size(); ++i) {
i < animations.size()Description
TRUEevaluated 952 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 35 times by 4 tests
Evaluated by:
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
35-952
124 duration = animationActualTotalDuration(i);-
125-
126 // 'animation' is the current animation if one of these reasons is true:-
127 // 1. it's duration is undefined-
128 // 2. it ends after msecs-
129 // 3. it is the last animation (this can happen in case there is at least 1 uncontrolled animation)-
130 // 4. it ends exactly in msecs and the direction is backwards-
131 if (duration == -1 || currentTime < (ret.timeOffset + duration)
duration == -1Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 914 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
currentTime < ...et + duration)Description
TRUEevaluated 546 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 368 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
38-914
132 || (currentTime == (ret.timeOffset + duration) && direction == QAbstractAnimation::Backward)) {
currentTime ==...et + duration)Description
TRUEevaluated 57 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 311 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
direction == Q...tion::BackwardDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
FALSEevaluated 54 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
3-311
133 ret.index = i;-
134 return ret;
executed 587 times by 5 tests: return ret;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
587
135 }-
136-
137 // 'animation' has a non-null defined duration and is not the one at time 'msecs'.-
138 ret.timeOffset += duration;-
139 }
executed 365 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
365
140-
141 // this can only happen when one of those conditions is true:-
142 // 1. the duration of the group is undefined and we passed its actual duration-
143 // 2. there are only 0-duration animations in the group-
144 ret.timeOffset -= duration;-
145 ret.index = animations.size() - 1;-
146 return ret;
executed 35 times by 4 tests: return ret;
Executed by:
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
35
147}-
148-
149void QSequentialAnimationGroupPrivate::restart()-
150{-
151 // restarting the group by making the first/last animation the current one-
152 if (direction == QAbstractAnimation::Forward) {
direction == Q...ation::ForwardDescription
TRUEevaluated 45 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
1-45
153 lastLoop = 0;-
154 if (currentAnimationIndex == 0)
currentAnimationIndex == 0Description
TRUEevaluated 34 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
11-34
155 activateCurrentAnimation();
executed 34 times by 5 tests: activateCurrentAnimation();
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
34
156 else-
157 setCurrentAnimation(0);
executed 11 times by 2 tests: setCurrentAnimation(0);
Executed by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
11
158 } else { // direction == QAbstractAnimation::Backward-
159 lastLoop = loopCount - 1;-
160 int index = animations.size() - 1;-
161 if (currentAnimationIndex == index)
currentAnimationIndex == indexDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
FALSEnever evaluated
0-1
162 activateCurrentAnimation();
executed 1 time by 1 test: activateCurrentAnimation();
Executed by:
  • tst_QPropertyAnimation
1
163 else-
164 setCurrentAnimation(index);
never executed: setCurrentAnimation(index);
0
165 }-
166}-
167-
168/*!-
169 \internal-
170 This manages advancing the execution of a group running forwards (time has gone forward),-
171 which is the same behaviour for rewinding the execution of a group running backwards-
172 (time has gone backward).-
173*/-
174void QSequentialAnimationGroupPrivate::advanceForwards(const AnimationIndex &newAnimationIndex)-
175{-
176 if (lastLoop < currentLoop) {
lastLoop < currentLoopDescription
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
FALSEevaluated 50 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
7-50
177 // we need to fast forward to the end-
178 for (int i = currentAnimationIndex; i < animations.size(); ++i) {
i < animations.size()Description
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
7-13
179 QAbstractAnimation *anim = animations.at(i);-
180 setCurrentAnimation(i, true);-
181 anim->setCurrentTime(animationActualTotalDuration(i));-
182 }
executed 13 times by 2 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
13
183 // this will make sure the current animation is reset to the beginning-
184 if (animations.size() == 1)
animations.size() == 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
2-5
185 // we need to force activation because setCurrentAnimation will have no effect-
186 activateCurrentAnimation();
executed 2 times by 1 test: activateCurrentAnimation();
Executed by:
  • tst_QSequentialAnimationGroup
2
187 else-
188 setCurrentAnimation(0, true);
executed 5 times by 2 tests: setCurrentAnimation(0, true);
Executed by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
5
189 }-
190-
191 // and now we need to fast forward from the current position to-
192 for (int i = currentAnimationIndex; i < newAnimationIndex.index; ++i) { //### WRONG,
i < newAnimationIndex.indexDescription
TRUEevaluated 65 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 57 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
57-65
193 QAbstractAnimation *anim = animations.at(i);-
194 setCurrentAnimation(i, true);-
195 anim->setCurrentTime(animationActualTotalDuration(i));-
196 }
executed 65 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
65
197 // setting the new current animation will happen later-
198}
executed 57 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
57
199-
200/*!-
201 \internal-
202 This manages rewinding the execution of a group running forwards (time has gone forward),-
203 which is the same behaviour for advancing the execution of a group running backwards-
204 (time has gone backward).-
205*/-
206void QSequentialAnimationGroupPrivate::rewindForwards(const AnimationIndex &newAnimationIndex)-
207{-
208 if (lastLoop > currentLoop) {
lastLoop > currentLoopDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
1-3
209 // we need to fast rewind to the beginning-
210 for (int i = currentAnimationIndex; i >= 0 ; --i) {
i >= 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPropertyAnimation
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
1-4
211 QAbstractAnimation *anim = animations.at(i);-
212 setCurrentAnimation(i, true);-
213 anim->setCurrentTime(0);-
214 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QPropertyAnimation
4
215 // this will make sure the current animation is reset to the end-
216 if (animations.size() == 1)
animations.size() == 1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
0-1
217 // we need to force activation because setCurrentAnimation will have no effect-
218 activateCurrentAnimation();
never executed: activateCurrentAnimation();
0
219 else-
220 setCurrentAnimation(animations.count() - 1, true);
executed 1 time by 1 test: setCurrentAnimation(animations.count() - 1, true);
Executed by:
  • tst_QPropertyAnimation
1
221 }-
222-
223 // and now we need to fast rewind from the current position to-
224 for (int i = currentAnimationIndex; i > newAnimationIndex.index; --i) {
i > newAnimationIndex.indexDescription
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
4-9
225 QAbstractAnimation *anim = animations.at(i);-
226 setCurrentAnimation(i, true);-
227 anim->setCurrentTime(0);-
228 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
9
229 // setting the new current animation will happen later-
230}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
4
231-
232/*!-
233 \fn QSequentialAnimationGroup::currentAnimationChanged(QAbstractAnimation *current)-
234-
235 QSequentialAnimationGroup emits this signal when currentAnimation-
236 has been changed. \a current is the current animation.-
237-
238 \sa currentAnimation()-
239*/-
240-
241-
242/*!-
243 Constructs a QSequentialAnimationGroup.-
244 \a parent is passed to QObject's constructor.-
245*/-
246QSequentialAnimationGroup::QSequentialAnimationGroup(QObject *parent)-
247 : QAnimationGroup(*new QSequentialAnimationGroupPrivate, parent)-
248{-
249}
executed 64 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
64
250-
251/*!-
252 \internal-
253*/-
254QSequentialAnimationGroup::QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd,-
255 QObject *parent)-
256 : QAnimationGroup(dd, parent)-
257{-
258}
never executed: end of block
0
259-
260/*!-
261 Destroys the animation group. It will also destroy all its animations.-
262*/-
263QSequentialAnimationGroup::~QSequentialAnimationGroup()-
264{-
265}-
266-
267/*!-
268 Adds a pause of \a msecs to this animation group.-
269 The pause is considered as a special type of animation, thus-
270 \l{QAnimationGroup::animationCount()}{animationCount} will be-
271 increased by one.-
272-
273 \sa insertPause(), QAnimationGroup::addAnimation()-
274*/-
275QPauseAnimation *QSequentialAnimationGroup::addPause(int msecs)-
276{-
277 QPauseAnimation *pause = new QPauseAnimation(msecs);-
278 addAnimation(pause);-
279 return pause;
executed 22 times by 1 test: return pause;
Executed by:
  • tst_QSequentialAnimationGroup
22
280}-
281-
282/*!-
283 Inserts a pause of \a msecs milliseconds at \a index in this animation-
284 group.-
285-
286 \sa addPause(), QAnimationGroup::insertAnimation()-
287*/-
288QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs)-
289{-
290 Q_D(const QSequentialAnimationGroup);-
291-
292 if (index < 0 || index > d->animations.size()) {
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
index > d->animations.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
293 qWarning("QSequentialAnimationGroup::insertPause: index is out of bounds");-
294 return 0;
never executed: return 0;
0
295 }-
296-
297 QPauseAnimation *pause = new QPauseAnimation(msecs);-
298 insertAnimation(index, pause);-
299 return pause;
never executed: return pause;
0
300}-
301-
302-
303/*!-
304 \property QSequentialAnimationGroup::currentAnimation-
305 Returns the animation in the current time.-
306*/-
307QAbstractAnimation *QSequentialAnimationGroup::currentAnimation() const-
308{-
309 Q_D(const QSequentialAnimationGroup);-
310 return d->currentAnimation;
executed 28 times by 3 tests: return d->currentAnimation;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
28
311}-
312-
313/*!-
314 \reimp-
315*/-
316int QSequentialAnimationGroup::duration() const-
317{-
318 Q_D(const QSequentialAnimationGroup);-
319 int ret = 0;-
320-
321 for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
it != cendDescription
TRUEevaluated 4322 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 1924 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1924-4322
322 const int currentDuration = (*it)->totalDuration();-
323 if (currentDuration == -1)
currentDuration == -1Description
TRUEevaluated 66 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 4256 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
66-4256
324 return -1; // Undetermined length
executed 66 times by 1 test: return -1;
Executed by:
  • tst_QSequentialAnimationGroup
66
325-
326 ret += currentDuration;-
327 }
executed 4256 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
4256
328-
329 return ret;
executed 1924 times by 5 tests: return ret;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1924
330}-
331-
332/*!-
333 \reimp-
334*/-
335void QSequentialAnimationGroup::updateCurrentTime(int currentTime)-
336{-
337 Q_D(QSequentialAnimationGroup);-
338 if (!d->currentAnimation)
!d->currentAnimationDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QAnimationGroup
FALSEevaluated 622 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
2-622
339 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QAnimationGroup
2
340-
341 const QSequentialAnimationGroupPrivate::AnimationIndex newAnimationIndex = d->indexForCurrentTime();-
342-
343 // remove unneeded animations from actualDuration list-
344 while (newAnimationIndex.index < d->actualDuration.size())
newAnimationIn...uration.size()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 622 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1-622
345 d->actualDuration.removeLast();
executed 1 time by 1 test: d->actualDuration.removeLast();
Executed by:
  • tst_QSequentialAnimationGroup
1
346-
347 // newAnimationIndex.index is the new current animation-
348 if (d->lastLoop < d->currentLoop
d->lastLoop < d->currentLoopDescription
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
FALSEevaluated 615 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
7-615
349 || (d->lastLoop == d->currentLoop && d->currentAnimationIndex < newAnimationIndex.index)) {
d->lastLoop == d->currentLoopDescription
TRUEevaluated 614 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
d->currentAnim...ionIndex.indexDescription
TRUEevaluated 50 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 564 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1-614
350 // advancing with forward direction is the same as rewinding with backwards direction-
351 d->advanceForwards(newAnimationIndex);-
352 } else if (d->lastLoop > d->currentLoop
executed 57 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
d->lastLoop > d->currentLoopDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
FALSEevaluated 564 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1-564
353 || (d->lastLoop == d->currentLoop && d->currentAnimationIndex > newAnimationIndex.index)) {
d->lastLoop == d->currentLoopDescription
TRUEevaluated 564 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEnever evaluated
d->currentAnim...ionIndex.indexDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 561 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
0-564
354 // rewinding with forward direction is the same as advancing with backwards direction-
355 d->rewindForwards(newAnimationIndex);-
356 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
4
357-
358 d->setCurrentAnimation(newAnimationIndex.index);-
359-
360 const int newCurrentTime = currentTime - newAnimationIndex.timeOffset;-
361-
362 if (d->currentAnimation) {
d->currentAnimationDescription
TRUEevaluated 621 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
1-621
363 d->currentAnimation->setCurrentTime(newCurrentTime);-
364 if (d->atEnd()) {
d->atEnd()Description
TRUEevaluated 35 times by 4 tests
Evaluated by:
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 586 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
35-586
365 //we make sure that we don't exceed the duration here-
366 d->currentTime += QAbstractAnimationPrivate::get(d->currentAnimation)->totalCurrentTime - newCurrentTime;-
367 stop();-
368 }
executed 35 times by 4 tests: end of block
Executed by:
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
35
369 } else {
executed 621 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
621
370 //the only case where currentAnimation could be null-
371 //is when all animations have been removed-
372 Q_ASSERT(d->animations.isEmpty());-
373 d->currentTime = 0;-
374 stop();-
375 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSequentialAnimationGroup
1
376-
377 d->lastLoop = d->currentLoop;-
378}
executed 622 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
622
379-
380/*!-
381 \reimp-
382*/-
383void QSequentialAnimationGroup::updateState(QAbstractAnimation::State newState,-
384 QAbstractAnimation::State oldState)-
385{-
386 Q_D(QSequentialAnimationGroup);-
387 QAnimationGroup::updateState(newState, oldState);-
388-
389 if (!d->currentAnimation)
!d->currentAnimationDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAnimationGroup
FALSEevaluated 101 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
4-101
390 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_QAnimationGroup
4
391-
392 switch (newState) {-
393 case Stopped:
executed 40 times by 5 tests: case Stopped:
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
40
394 d->currentAnimation->stop();-
395 break;
executed 40 times by 5 tests: break;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
40
396 case Paused:
executed 13 times by 1 test: case Paused:
Executed by:
  • tst_QSequentialAnimationGroup
13
397 if (oldState == d->currentAnimation->state()
oldState == d-...ation->state()Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEnever evaluated
0-13
398 && oldState == QSequentialAnimationGroup::Running) {
oldState == QS...Group::RunningDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEnever evaluated
0-13
399 d->currentAnimation->pause();-
400 }
executed 13 times by 1 test: end of block
Executed by:
  • tst_QSequentialAnimationGroup
13
401 else-
402 d->restart();
never executed: d->restart();
0
403 break;
executed 13 times by 1 test: break;
Executed by:
  • tst_QSequentialAnimationGroup
13
404 case Running:
executed 48 times by 5 tests: case Running:
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
48
405 if (oldState == d->currentAnimation->state()
oldState == d-...ation->state()Description
TRUEevaluated 47 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
1-47
406 && oldState == QSequentialAnimationGroup::Paused)
oldState == QS...nGroup::PausedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 45 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
2-45
407 d->currentAnimation->start();
executed 2 times by 1 test: d->currentAnimation->start();
Executed by:
  • tst_QSequentialAnimationGroup
2
408 else-
409 d->restart();
executed 46 times by 5 tests: d->restart();
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
46
410 break;
executed 48 times by 5 tests: break;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
48
411 }-
412}
executed 101 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
101
413-
414/*!-
415 \reimp-
416*/-
417void QSequentialAnimationGroup::updateDirection(QAbstractAnimation::Direction direction)-
418{-
419 Q_D(QSequentialAnimationGroup);-
420 // we need to update the direction of the current animation-
421 if (state() != Stopped && d->currentAnimation)
state() != StoppedDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
d->currentAnimationDescription
TRUEnever evaluated
FALSEnever evaluated
0-2
422 d->currentAnimation->setDirection(direction);
never executed: d->currentAnimation->setDirection(direction);
0
423}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
2
424-
425/*!-
426 \reimp-
427*/-
428bool QSequentialAnimationGroup::event(QEvent *event)-
429{-
430 return QAnimationGroup::event(event);
executed 266 times by 5 tests: return QAnimationGroup::event(event);
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
266
431}-
432-
433void QSequentialAnimationGroupPrivate::setCurrentAnimation(int index, bool intermediate)-
434{-
435 Q_Q(QSequentialAnimationGroup);-
436-
437 index = qMin(index, animations.count() - 1);-
438-
439 if (index == -1) {
index == -1Description
TRUEevaluated 23 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
FALSEevaluated 899 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
23-899
440 Q_ASSERT(animations.isEmpty());-
441 currentAnimationIndex = -1;-
442 currentAnimation = 0;-
443 return;
executed 23 times by 4 tests: return;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
23
444 }-
445-
446 // need these two checks below because this func can be called after the current animation-
447 // has been removed-
448 if (index == currentAnimationIndex && animations.at(index) == currentAnimation)
index == currentAnimationIndexDescription
TRUEevaluated 721 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 178 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
animations.at(...rrentAnimationDescription
TRUEevaluated 694 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 27 times by 3 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
27-721
449 return;
executed 694 times by 5 tests: return;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
694
450-
451 // stop the old current animation-
452 if (currentAnimation)
currentAnimationDescription
TRUEevaluated 140 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 65 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
65-140
453 currentAnimation->stop();
executed 140 times by 5 tests: currentAnimation->stop();
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
140
454-
455 currentAnimation = animations.at(index);-
456 currentAnimationIndex = index;-
457-
458 emit q->currentAnimationChanged(currentAnimation);-
459-
460 activateCurrentAnimation(intermediate);-
461}
executed 205 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
205
462-
463void QSequentialAnimationGroupPrivate::activateCurrentAnimation(bool intermediate)-
464{-
465 if (!currentAnimation || state == QSequentialAnimationGroup::Stopped)
!currentAnimationDescription
TRUEnever evaluated
FALSEevaluated 242 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
state == QSequ...Group::StoppedDescription
TRUEevaluated 126 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 116 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
0-242
466 return;
executed 126 times by 5 tests: return;
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
126
467-
468 currentAnimation->stop();-
469-
470 // we ensure the direction is consistent with the group's direction-
471 currentAnimation->setDirection(direction);-
472-
473 // connects to the finish signal of uncontrolled animations-
474 if (currentAnimation->totalDuration() == -1)
currentAnimati...ration() == -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 110 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
6-110
475 connectUncontrolledAnimation(currentAnimation);
executed 6 times by 1 test: connectUncontrolledAnimation(currentAnimation);
Executed by:
  • tst_QSequentialAnimationGroup
6
476-
477 currentAnimation->start();-
478 if (!intermediate && state == QSequentialAnimationGroup::Paused)
!intermediateDescription
TRUEevaluated 91 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
state == QSequ...nGroup::PausedDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 82 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
9-91
479 currentAnimation->pause();
executed 9 times by 1 test: currentAnimation->pause();
Executed by:
  • tst_QSequentialAnimationGroup
9
480}
executed 116 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
116
481-
482void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished()-
483{-
484 Q_Q(QSequentialAnimationGroup);-
485 Q_ASSERT(qobject_cast<QAbstractAnimation *>(q->sender()) == currentAnimation);-
486-
487 // we trust the duration returned by the animation-
488 while (actualDuration.size() < (currentAnimationIndex + 1))
actualDuration...tionIndex + 1)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
6-7
489 actualDuration.append(-1);
executed 7 times by 1 test: actualDuration.append(-1);
Executed by:
  • tst_QSequentialAnimationGroup
7
490 actualDuration[currentAnimationIndex] = currentAnimation->currentTime();-
491-
492 disconnectUncontrolledAnimation(currentAnimation);-
493-
494 if ((direction == QAbstractAnimation::Forward && currentAnimation == animations.last())
direction == Q...ation::ForwardDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEnever evaluated
currentAnimati...mations.last()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
0-6
495 || (direction == QAbstractAnimation::Backward && currentAnimationIndex == 0)) {
direction == Q...tion::BackwardDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
currentAnimationIndex == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-3
496 // we don't handle looping of a group with undefined duration-
497 q->stop();-
498 } else if (direction == QAbstractAnimation::Forward) {
executed 3 times by 1 test: end of block
Executed by:
  • tst_QSequentialAnimationGroup
direction == Q...ation::ForwardDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEnever evaluated
0-3
499 // set the current animation to be the next one-
500 setCurrentAnimation(currentAnimationIndex + 1);-
501 } else {
executed 3 times by 1 test: end of block
Executed by:
  • tst_QSequentialAnimationGroup
3
502 // set the current animation to be the previous one-
503 setCurrentAnimation(currentAnimationIndex - 1);-
504 }
never executed: end of block
0
505}-
506-
507/*!-
508 \internal-
509 This method is called whenever an animation is added to-
510 the group at index \a index.-
511 Note: We only support insertion after the current animation-
512*/-
513void QSequentialAnimationGroupPrivate::animationInsertedAt(int index)-
514{-
515 if (currentAnimation == 0)
currentAnimation == 0Description
TRUEevaluated 65 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 79 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
65-79
516 setCurrentAnimation(0); // initialize the current animation
executed 65 times by 5 tests: setCurrentAnimation(0);
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
65
517-
518 if (currentAnimationIndex == index
currentAnimationIndex == indexDescription
TRUEevaluated 66 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 78 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
66-78
519 && currentAnimation->currentTime() == 0 && currentAnimation->currentLoop() == 0) {
currentAnimati...entTime() == 0Description
TRUEevaluated 66 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEnever evaluated
currentAnimati...entLoop() == 0Description
TRUEevaluated 66 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEnever evaluated
0-66
520 //in this case we simply insert an animation before the current one has actually started-
521 setCurrentAnimation(index);-
522 }
executed 66 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
66
523-
524 //we update currentAnimationIndex in case it has changed (the animation pointer is still valid)-
525 currentAnimationIndex = animations.indexOf(currentAnimation);-
526-
527 if (index < currentAnimationIndex || currentLoop != 0) {
index < currentAnimationIndexDescription
TRUEnever evaluated
FALSEevaluated 144 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
currentLoop != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 143 times by 5 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
0-144
528 qWarning("QSequentialGroup::insertAnimation only supports to add animations after the current one.");-
529 return; //we're not affected because it is added after the current one
executed 1 time by 1 test: return;
Executed by:
  • tst_QSequentialAnimationGroup
1
530 }-
531}
executed 143 times by 5 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
143
532-
533/*!-
534 \internal-
535 This method is called whenever an animation is removed from-
536 the group at index \a index. The animation is no more listed when this-
537 method is called.-
538*/-
539void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim)-
540{-
541 Q_Q(QSequentialAnimationGroup);-
542 QAnimationGroupPrivate::animationRemoved(index, anim);-
543-
544 Q_ASSERT(currentAnimation); // currentAnimation should always be set-
545-
546 if (actualDuration.size() > index)
actualDuration.size() > indexDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
3-62
547 actualDuration.removeAt(index);
executed 3 times by 1 test: actualDuration.removeAt(index);
Executed by:
  • tst_QSequentialAnimationGroup
3
548-
549 const int currentIndex = animations.indexOf(currentAnimation);-
550 if (currentIndex == -1) {
currentIndex == -1Description
TRUEevaluated 58 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
7-58
551 //we're removing the current animation-
552-
553 disconnectUncontrolledAnimation(currentAnimation);-
554-
555 if (index < animations.count())
index < animations.count()Description
TRUEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
FALSEevaluated 33 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
25-33
556 setCurrentAnimation(index); //let's try to take the next one
executed 25 times by 3 tests: setCurrentAnimation(index);
Executed by:
  • tst_QAnimationGroup
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
25
557 else if (index > 0)
index > 0Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
FALSEevaluated 22 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
11-22
558 setCurrentAnimation(index - 1);
executed 11 times by 2 tests: setCurrentAnimation(index - 1);
Executed by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
11
559 else// case all animations were removed-
560 setCurrentAnimation(-1);
executed 22 times by 4 tests: setCurrentAnimation(-1);
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
22
561 } else if (currentAnimationIndex > index) {
currentAnimationIndex > indexDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSequentialAnimationGroup
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
1-6
562 currentAnimationIndex--;-
563 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSequentialAnimationGroup
1
564-
565 // duration of the previous animations up to the current animation-
566 currentTime = 0;-
567 for (int i = 0; i < currentAnimationIndex; ++i) {
i < currentAnimationIndexDescription
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
FALSEevaluated 65 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
7-65
568 const int current = animationActualTotalDuration(i);-
569 currentTime += current;-
570 }
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
7
571-
572 if (currentIndex != -1) {
currentIndex != -1Description
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
FALSEevaluated 58 times by 4 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
7-58
573 //the current animation is not the one being removed-
574 //so we add its current time to the current time of this group-
575 currentTime += QAbstractAnimationPrivate::get(currentAnimation)->totalCurrentTime;-
576 }
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QSequentialAnimationGroup
7
577-
578 //let's also update the total current time-
579 totalCurrentTime = currentTime + loopCount * q->duration();-
580}
executed 65 times by 4 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
65
581-
582QT_END_NAMESPACE-
583-
584#include "moc_qsequentialanimationgroup.cpp"-
585-
586#endif //QT_NO_ANIMATION-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9