qtimeline.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qtimeline.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5class QTimeLinePrivate : public QObjectPrivate-
6{-
7 inline QTimeLine* q_func() { return static_cast<QTimeLine *>(q_ptr); } inline const QTimeLine* q_func() const { return static_cast<const QTimeLine *>(q_ptr); } friend class QTimeLine;-
8public:-
9 inline QTimeLinePrivate()-
10 : easingCurve(QEasingCurve::InOutSine),-
11 startTime(0), duration(1000), startFrame(0), endFrame(0),-
12 updateInterval(1000 / 25),-
13 totalLoopCount(1), currentLoopCount(0), currentTime(0), timerId(0),-
14 direction(QTimeLine::Forward),-
15 state(QTimeLine::NotRunning)-
16 { }
executed 28 times by 3 tests: end of block
Executed by:
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
28
17-
18 QElapsedTimer timer;-
19 QEasingCurve easingCurve;-
20-
21 int startTime;-
22 int duration;-
23 int startFrame;-
24 int endFrame;-
25 int updateInterval;-
26 int totalLoopCount;-
27 int currentLoopCount;-
28-
29 int currentTime;-
30 int timerId;-
31-
32 QTimeLine::Direction direction;-
33 QTimeLine::State state;-
34 inline void setState(QTimeLine::State newState)-
35 {-
36 QTimeLine * const q = q_func();-
37 if (newState != state
newState != stateDescription
TRUEevaluated 84 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEnever evaluated
)
0-84
38 q->stateChanged(state = newState, QTimeLine::QPrivateSignal());
executed 84 times by 2 tests: q->stateChanged(state = newState, QTimeLine::QPrivateSignal());
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
84
39 }
executed 84 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
84
40-
41 void setCurrentTime(int msecs);-
42};-
43-
44-
45-
46-
47void QTimeLinePrivate::setCurrentTime(int msecs)-
48{-
49 QTimeLine * const q = q_func();-
50-
51 qreal lastValue = q->currentValue();-
52 int lastFrame = q->currentFrame();-
53-
54-
55 int elapsed = (
(direction == ...ine::Backward)Description
TRUEevaluated 281 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 1160 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
direction == QTimeLine::Backward)
(direction == ...ine::Backward)Description
TRUEevaluated 281 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 1160 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
? (-msecs + duration) : msecs;
281-1160
56 int loopCount = elapsed / duration;-
57-
58 bool looping = (loopCount != currentLoopCount);-
59-
60-
61-
62-
63-
64 if (looping
loopingDescription
TRUEevaluated 35 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEevaluated 1406 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
)
35-1406
65 currentLoopCount = loopCount;
executed 35 times by 2 tests: currentLoopCount = loopCount;
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
35
66-
67-
68 currentTime = elapsed % duration;-
69 if (direction == QTimeLine::Backward
direction == Q...Line::BackwardDescription
TRUEevaluated 281 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 1160 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
)
281-1160
70 currentTime = duration - currentTime;
executed 281 times by 1 test: currentTime = duration - currentTime;
Executed by:
  • tst_QTimeLine
281
71-
72-
73 bool finished = false;-
74 if (totalLoopCount
totalLoopCountDescription
TRUEevaluated 1406 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QTimeLine
&& currentLoopCount >= totalLoopCount
currentLoopCou...totalLoopCountDescription
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEevaluated 1386 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
) {
20-1406
75 finished = true;-
76 currentTime = (
(direction == ...ine::Backward)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
direction == QTimeLine::Backward)
(direction == ...ine::Backward)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
? 0 : duration;
1-19
77 currentLoopCount = totalLoopCount - 1;-
78 }
executed 20 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
20
79-
80 int currentFrame = q->frameForTime(currentTime);-
81-
82-
83-
84 if (!qFuzzyCompare(lastValue, q->currentValue())
!qFuzzyCompare...urrentValue())Description
TRUEevaluated 1412 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEevaluated 29 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
)
29-1412
85 q->valueChanged(q->currentValue(), QTimeLine::QPrivateSignal());
executed 1412 times by 2 tests: q->valueChanged(q->currentValue(), QTimeLine::QPrivateSignal());
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
1412
86 if (lastFrame != currentFrame
lastFrame != currentFrameDescription
TRUEevaluated 314 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 1127 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
) {
314-1127
87 const int transitionframe = (direction == QTimeLine::Forward
direction == Q...eLine::ForwardDescription
TRUEevaluated 290 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTimeLine
? endFrame : startFrame);
24-290
88 if (looping
loopingDescription
TRUEevaluated 31 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 283 times by 1 test
Evaluated by:
  • tst_QTimeLine
&& !finished
!finishedDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QTimeLine
&& transitionframe != currentFrame
transitionfram...= currentFrameDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEnever evaluated
) {
0-283
89-
90-
91-
92 q->frameChanged(transitionframe, QTimeLine::QPrivateSignal());-
93 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
15
94 q->frameChanged(currentFrame, QTimeLine::QPrivateSignal());-
95 }
executed 314 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
314
96 if (finished
finishedDescription
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEevaluated 1421 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
&& state == QTimeLine::Running
state == QTimeLine::RunningDescription
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEnever evaluated
) {
0-1421
97 q->stop();-
98 q->finished(QTimeLine::QPrivateSignal());-
99 }
executed 20 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
20
100}
executed 1441 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
1441
101QTimeLine::QTimeLine(int duration, QObject *parent)-
102 : QObject(*new QTimeLinePrivate, parent)-
103{-
104 setDuration(duration);-
105}
executed 28 times by 3 tests: end of block
Executed by:
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
28
106-
107-
108-
109-
110QTimeLine::~QTimeLine()-
111{-
112 QTimeLinePrivate * const d = d_func();-
113-
114 if (d->state == Running
d->state == RunningDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 22 times by 3 tests
Evaluated by:
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
)
6-22
115 stop();
executed 6 times by 1 test: stop();
Executed by:
  • tst_QTimeLine
6
116}
executed 28 times by 3 tests: end of block
Executed by:
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
28
117-
118-
119-
120-
121-
122-
123QTimeLine::State QTimeLine::state() const-
124{-
125 const QTimeLinePrivate * const d = d_func();-
126 return
executed 250 times by 1 test: return d->state;
Executed by:
  • tst_QTimeLine
d->state;
executed 250 times by 1 test: return d->state;
Executed by:
  • tst_QTimeLine
250
127}-
128int QTimeLine::loopCount() const-
129{-
130 const QTimeLinePrivate * const d = d_func();-
131 return
executed 4 times by 1 test: return d->totalLoopCount;
Executed by:
  • tst_QTimeLine
d->totalLoopCount;
executed 4 times by 1 test: return d->totalLoopCount;
Executed by:
  • tst_QTimeLine
4
132}-
133void QTimeLine::setLoopCount(int count)-
134{-
135 QTimeLinePrivate * const d = d_func();-
136 d->totalLoopCount = count;-
137}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
2
138QTimeLine::Direction QTimeLine::direction() const-
139{-
140 const QTimeLinePrivate * const d = d_func();-
141 return
executed 6 times by 1 test: return d->direction;
Executed by:
  • tst_QTimeLine
d->direction;
executed 6 times by 1 test: return d->direction;
Executed by:
  • tst_QTimeLine
6
142}-
143void QTimeLine::setDirection(Direction direction)-
144{-
145 QTimeLinePrivate * const d = d_func();-
146 d->direction = direction;-
147 d->startTime = d->currentTime;-
148 d->timer.start();-
149}
executed 38 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
38
150int QTimeLine::duration() const-
151{-
152 const QTimeLinePrivate * const d = d_func();-
153 return
executed 83 times by 1 test: return d->duration;
Executed by:
  • tst_QTimeLine
d->duration;
executed 83 times by 1 test: return d->duration;
Executed by:
  • tst_QTimeLine
83
154}-
155void QTimeLine::setDuration(int duration)-
156{-
157 QTimeLinePrivate * const d = d_func();-
158 if (duration <= 0
duration <= 0Description
TRUEnever evaluated
FALSEevaluated 32 times by 3 tests
Evaluated by:
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
) {
0-32
159 QMessageLogger(__FILE__, 401, __PRETTY_FUNCTION__).warning("QTimeLine::setDuration: cannot set duration <= 0");-
160 return;
never executed: return;
0
161 }-
162 d->duration = duration;-
163}
executed 32 times by 3 tests: end of block
Executed by:
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
32
164-
165-
166-
167-
168-
169-
170-
171int QTimeLine::startFrame() const-
172{-
173 const QTimeLinePrivate * const d = d_func();-
174 return
executed 7 times by 1 test: return d->startFrame;
Executed by:
  • tst_QTimeLine
d->startFrame;
executed 7 times by 1 test: return d->startFrame;
Executed by:
  • tst_QTimeLine
7
175}-
176-
177-
178-
179-
180-
181-
182-
183void QTimeLine::setStartFrame(int frame)-
184{-
185 QTimeLinePrivate * const d = d_func();-
186 d->startFrame = frame;-
187}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
2
188-
189-
190-
191-
192-
193-
194-
195int QTimeLine::endFrame() const-
196{-
197 const QTimeLinePrivate * const d = d_func();-
198 return
executed 24 times by 1 test: return d->endFrame;
Executed by:
  • tst_QTimeLine
d->endFrame;
executed 24 times by 1 test: return d->endFrame;
Executed by:
  • tst_QTimeLine
24
199}-
200-
201-
202-
203-
204-
205-
206-
207void QTimeLine::setEndFrame(int frame)-
208{-
209 QTimeLinePrivate * const d = d_func();-
210 d->endFrame = frame;-
211}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
2
212void QTimeLine::setFrameRange(int startFrame, int endFrame)-
213{-
214 QTimeLinePrivate * const d = d_func();-
215 d->startFrame = startFrame;-
216 d->endFrame = endFrame;-
217}
executed 22 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
22
218int QTimeLine::updateInterval() const-
219{-
220 const QTimeLinePrivate * const d = d_func();-
221 return
executed 2 times by 1 test: return d->updateInterval;
Executed by:
  • tst_QTimeLine
d->updateInterval;
executed 2 times by 1 test: return d->updateInterval;
Executed by:
  • tst_QTimeLine
2
222}-
223void QTimeLine::setUpdateInterval(int interval)-
224{-
225 QTimeLinePrivate * const d = d_func();-
226 d->updateInterval = interval;-
227}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
5
228QTimeLine::CurveShape QTimeLine::curveShape() const-
229{-
230 const QTimeLinePrivate * const d = d_func();-
231 switch (d->easingCurve.type()) {-
232 default
never executed: default:
:
never executed: default:
0
233 case
executed 1 time by 1 test: case QEasingCurve::InOutSine:
Executed by:
  • tst_QTimeLine
QEasingCurve::InOutSine:
executed 1 time by 1 test: case QEasingCurve::InOutSine:
Executed by:
  • tst_QTimeLine
1
234 return
executed 1 time by 1 test: return EaseInOutCurve;
Executed by:
  • tst_QTimeLine
EaseInOutCurve;
executed 1 time by 1 test: return EaseInOutCurve;
Executed by:
  • tst_QTimeLine
1
235 case
never executed: case QEasingCurve::InCurve:
QEasingCurve::InCurve:
never executed: case QEasingCurve::InCurve:
0
236 return
never executed: return EaseInCurve;
EaseInCurve;
never executed: return EaseInCurve;
0
237 case
never executed: case QEasingCurve::OutCurve:
QEasingCurve::OutCurve:
never executed: case QEasingCurve::OutCurve:
0
238 return
never executed: return EaseOutCurve;
EaseOutCurve;
never executed: return EaseOutCurve;
0
239 case
executed 1 time by 1 test: case QEasingCurve::Linear:
Executed by:
  • tst_QTimeLine
QEasingCurve::Linear:
executed 1 time by 1 test: case QEasingCurve::Linear:
Executed by:
  • tst_QTimeLine
1
240 return
executed 1 time by 1 test: return LinearCurve;
Executed by:
  • tst_QTimeLine
LinearCurve;
executed 1 time by 1 test: return LinearCurve;
Executed by:
  • tst_QTimeLine
1
241 case
never executed: case QEasingCurve::SineCurve:
QEasingCurve::SineCurve:
never executed: case QEasingCurve::SineCurve:
0
242 return
never executed: return SineCurve;
SineCurve;
never executed: return SineCurve;
0
243 case
never executed: case QEasingCurve::CosineCurve:
QEasingCurve::CosineCurve:
never executed: case QEasingCurve::CosineCurve:
0
244 return
never executed: return CosineCurve;
CosineCurve;
never executed: return CosineCurve;
0
245 }-
246 return
dead code: return EaseInOutCurve;
EaseInOutCurve;
dead code: return EaseInOutCurve;
-
247}-
248-
249void QTimeLine::setCurveShape(CurveShape shape)-
250{-
251 switch (shape) {-
252 default
never executed: default:
:
never executed: default:
0
253 case
executed 1 time by 1 test: case EaseInOutCurve:
Executed by:
  • tst_QTimeLine
EaseInOutCurve:
executed 1 time by 1 test: case EaseInOutCurve:
Executed by:
  • tst_QTimeLine
1
254 setEasingCurve(QEasingCurve(QEasingCurve::InOutSine));-
255 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QTimeLine
1
256 case
never executed: case EaseInCurve:
EaseInCurve:
never executed: case EaseInCurve:
0
257 setEasingCurve(QEasingCurve(QEasingCurve::InCurve));-
258 break;
never executed: break;
0
259 case
never executed: case EaseOutCurve:
EaseOutCurve:
never executed: case EaseOutCurve:
0
260 setEasingCurve(QEasingCurve(QEasingCurve::OutCurve));-
261 break;
never executed: break;
0
262 case
executed 6 times by 1 test: case LinearCurve:
Executed by:
  • tst_QTimeLine
LinearCurve:
executed 6 times by 1 test: case LinearCurve:
Executed by:
  • tst_QTimeLine
6
263 setEasingCurve(QEasingCurve(QEasingCurve::Linear));-
264 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QTimeLine
6
265 case
executed 2 times by 1 test: case SineCurve:
Executed by:
  • tst_QTimeLine
SineCurve:
executed 2 times by 1 test: case SineCurve:
Executed by:
  • tst_QTimeLine
2
266 setEasingCurve(QEasingCurve(QEasingCurve::SineCurve));-
267 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QTimeLine
2
268 case
executed 1 time by 1 test: case CosineCurve:
Executed by:
  • tst_QTimeLine
CosineCurve:
executed 1 time by 1 test: case CosineCurve:
Executed by:
  • tst_QTimeLine
1
269 setEasingCurve(QEasingCurve(QEasingCurve::CosineCurve));-
270 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QTimeLine
1
271 }-
272}-
273QEasingCurve QTimeLine::easingCurve() const-
274{-
275 const QTimeLinePrivate * const d = d_func();-
276 return
never executed: return d->easingCurve;
d->easingCurve;
never executed: return d->easingCurve;
0
277}-
278-
279void QTimeLine::setEasingCurve(const QEasingCurve& curve)-
280{-
281 QTimeLinePrivate * const d = d_func();-
282 d->easingCurve = curve;-
283}
executed 10 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
10
284int QTimeLine::currentTime() const-
285{-
286 const QTimeLinePrivate * const d = d_func();-
287 return
executed 112 times by 1 test: return d->currentTime;
Executed by:
  • tst_QTimeLine
d->currentTime;
executed 112 times by 1 test: return d->currentTime;
Executed by:
  • tst_QTimeLine
112
288}-
289void QTimeLine::setCurrentTime(int msec)-
290{-
291 QTimeLinePrivate * const d = d_func();-
292 d->startTime = 0;-
293 d->currentLoopCount = 0;-
294 d->timer.restart();-
295 d->setCurrentTime(msec);-
296}
executed 12 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
12
297-
298-
299-
300-
301-
302-
303int QTimeLine::currentFrame() const-
304{-
305 const QTimeLinePrivate * const d = d_func();-
306 return
executed 1507 times by 2 tests: return frameForTime(d->currentTime);
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
frameForTime(d->currentTime);
executed 1507 times by 2 tests: return frameForTime(d->currentTime);
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
1507
307}-
308-
309-
310-
311-
312-
313-
314qreal QTimeLine::currentValue() const-
315{-
316 const QTimeLinePrivate * const d = d_func();-
317 return
executed 4315 times by 2 tests: return valueForTime(d->currentTime);
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
valueForTime(d->currentTime);
executed 4315 times by 2 tests: return valueForTime(d->currentTime);
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
4315
318}-
319int QTimeLine::frameForTime(int msec) const-
320{-
321 const QTimeLinePrivate * const d = d_func();-
322 if (d->direction == Forward
d->direction == ForwardDescription
TRUEevaluated 2370 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEevaluated 578 times by 1 test
Evaluated by:
  • tst_QTimeLine
)
578-2370
323 return
executed 2370 times by 2 tests: return d->startFrame + int((d->endFrame - d->startFrame) * valueForTime(msec));
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
d->startFrame + int((d->endFrame - d->startFrame) * valueForTime(msec));
executed 2370 times by 2 tests: return d->startFrame + int((d->endFrame - d->startFrame) * valueForTime(msec));
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
2370
324 return
executed 578 times by 1 test: return d->startFrame + qCeil((d->endFrame - d->startFrame) * valueForTime(msec));
Executed by:
  • tst_QTimeLine
d->startFrame + qCeil((d->endFrame - d->startFrame) * valueForTime(msec));
executed 578 times by 1 test: return d->startFrame + qCeil((d->endFrame - d->startFrame) * valueForTime(msec));
Executed by:
  • tst_QTimeLine
578
325}-
326qreal QTimeLine::valueForTime(int msec) const-
327{-
328 const QTimeLinePrivate * const d = d_func();-
329 msec = qMin(qMax(msec, 0), d->duration);-
330-
331 qreal value = msec / qreal(d->duration);-
332 return
executed 7276 times by 2 tests: return d->easingCurve.valueForProgress(value);
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
d->easingCurve.valueForProgress(value);
executed 7276 times by 2 tests: return d->easingCurve.valueForProgress(value);
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
7276
333}-
334void QTimeLine::start()-
335{-
336 QTimeLinePrivate * const d = d_func();-
337 if (d->timerId
d->timerIdDescription
TRUEnever evaluated
FALSEevaluated 38 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
) {
0-38
338 QMessageLogger(__FILE__, 675, __PRETTY_FUNCTION__).warning("QTimeLine::start: already running");-
339 return;
never executed: return;
0
340 }-
341 int curTime = 0;-
342 if (d->direction == Backward
d->direction == BackwardDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
)
5-33
343 curTime = d->duration;
executed 5 times by 1 test: curTime = d->duration;
Executed by:
  • tst_QTimeLine
5
344 d->timerId = startTimer(d->updateInterval);-
345 d->startTime = curTime;-
346 d->currentLoopCount = 0;-
347 d->timer.start();-
348 d->setState(Running);-
349 d->setCurrentTime(curTime);-
350}
executed 38 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
38
351void QTimeLine::resume()-
352{-
353 QTimeLinePrivate * const d = d_func();-
354 if (d->timerId
d->timerIdDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeLine
) {
0-3
355 QMessageLogger(__FILE__, 703, __PRETTY_FUNCTION__).warning("QTimeLine::resume: already running");-
356 return;
never executed: return;
0
357 }-
358 d->timerId = startTimer(d->updateInterval);-
359 d->startTime = d->currentTime;-
360 d->timer.start();-
361 d->setState(Running);-
362}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
3
363-
364-
365-
366-
367-
368-
369void QTimeLine::stop()-
370{-
371 QTimeLinePrivate * const d = d_func();-
372 if (d->timerId
d->timerIdDescription
TRUEevaluated 41 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEnever evaluated
)
0-41
373 killTimer(d->timerId);
executed 41 times by 2 tests: killTimer(d->timerId);
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
41
374 d->setState(NotRunning);-
375 d->timerId = 0;-
376}
executed 41 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
41
377void QTimeLine::setPaused(bool paused)-
378{-
379 QTimeLinePrivate * const d = d_func();-
380 if (d->state == NotRunning
d->state == NotRunningDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeLine
) {
0-2
381 QMessageLogger(__FILE__, 738, __PRETTY_FUNCTION__).warning("QTimeLine::setPaused: Not running");-
382 return;
never executed: return;
0
383 }-
384 if (paused
pausedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeLine
&& d->state != Paused
d->state != PausedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEnever evaluated
) {
0-1
385 d->startTime = d->currentTime;-
386 killTimer(d->timerId);-
387 d->timerId = 0;-
388 d->setState(Paused);-
389 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTimeLine
else if (!paused
!pausedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEnever evaluated
&& d->state == Paused
d->state == PausedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeLine
FALSEnever evaluated
) {
0-1
390-
391 d->timerId = startTimer(d->updateInterval);-
392 d->startTime = d->currentTime;-
393 d->timer.start();-
394 d->setState(Running);-
395 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTimeLine
1
396}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
2
397-
398-
399-
400-
401-
402-
403-
404void QTimeLine::toggleDirection()-
405{-
406 QTimeLinePrivate * const d = d_func();-
407 setDirection(d->direction == Forward ? Backward : Forward);-
408}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
2
409-
410-
411-
412-
413void QTimeLine::timerEvent(QTimerEvent *event)-
414{-
415 QTimeLinePrivate * const d = d_func();-
416 if (event->timerId() != d->timerId
event->timerId() != d->timerIdDescription
TRUEnever evaluated
FALSEevaluated 1391 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
) {
0-1391
417 event->ignore();-
418 return;
never executed: return;
0
419 }-
420 event->accept();-
421-
422 if (d->direction == Forward
d->direction == ForwardDescription
TRUEevaluated 1119 times by 2 tests
Evaluated by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
FALSEevaluated 272 times by 1 test
Evaluated by:
  • tst_QTimeLine
) {
272-1119
423 d->setCurrentTime(d->startTime + d->timer.elapsed());-
424 }
executed 1119 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLayout
  • tst_QTimeLine
else {
1119
425 d->setCurrentTime(d->startTime - d->timer.elapsed());-
426 }
executed 272 times by 1 test: end of block
Executed by:
  • tst_QTimeLine
272
427}-
428-
429-
Switch to Source codePreprocessed file

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