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

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