OpenCoverage

qquicksmoothedanimation.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquicksmoothedanimation.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13QSmoothedAnimationTimer::QSmoothedAnimationTimer(QSmoothedAnimation *animation, QObject *parent)-
14 : QTimer(parent)-
15 , m_animation(animation)-
16{-
17 connect(this, qFlagLocation("2""timeout()" "\0" __FILE__ ":" "64"), this, qFlagLocation("1""stopAnimation()" "\0" __FILE__ ":" "64"));-
18}
executed 10652 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
10652
19-
20QSmoothedAnimationTimer::~QSmoothedAnimationTimer()-
21{-
22}-
23-
24void QSmoothedAnimationTimer::stopAnimation()-
25{-
26 m_animation->stop();-
27}
executed 195 times by 4 tests: end of block
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
195
28-
29QSmoothedAnimation::QSmoothedAnimation(QQuickSmoothedAnimationPrivate *priv)-
30 : QAbstractAnimationJob(), to(0), velocity(200), userDuration(-1), maximumEasingTime(-1),-
31 reversingMode(QQuickSmoothedAnimation::Eased), initialVelocity(0),-
32 trackVelocity(0), initialValue(0), invert(false), finalDuration(-1), lastTime(0),-
33 skipUpdate(false), delayedStopTimer(new QSmoothedAnimationTimer(this)), animationTemplate(priv)-
34{-
35 delayedStopTimer->setInterval(32);-
36 delayedStopTimer->setSingleShot(true);-
37}
executed 10652 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
10652
38-
39QSmoothedAnimation::~QSmoothedAnimation()-
40{-
41 delete delayedStopTimer;-
42 if (animationTemplate
animationTemplateDescription
TRUEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 10612 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
) {
24-10612
43 if (target.object()
target.object()Description
TRUEnever evaluated
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
) {
0-24
44 QHash<QQmlProperty, QSmoothedAnimation* >::iterator it =-
45 animationTemplate->activeAnimations.find(target);-
46 if (it != animationTemplate->activeAnimations.end()
it != animatio...imations.end()Description
TRUEnever evaluated
FALSEnever evaluated
&& it.value() == this
it.value() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
47 animationTemplate->activeAnimations.erase(it);
never executed: animationTemplate->activeAnimations.erase(it);
0
48 }
never executed: end of block
else {
0
49-
50 QHash<QQmlProperty, QSmoothedAnimation* >::iterator it;-
51 for (it = animationTemplate->activeAnimations.begin(); it != animationTemplate->activeAnimations.end()
it != animatio...imations.end()Description
TRUEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEnever evaluated
; ++it) {
0-24
52 if (it.value() == this
it.value() == thisDescription
TRUEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEnever evaluated
) {
0-24
53 animationTemplate->activeAnimations.erase(it);-
54 break;
executed 24 times by 3 tests: break;
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
24
55 }-
56 }
never executed: end of block
0
57 }
executed 24 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
24
58 }-
59}
executed 10636 times by 12 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
10636
60-
61void QSmoothedAnimation::restart()-
62{-
63 initialVelocity = trackVelocity;-
64 if (isRunning()
isRunning()Description
TRUEevaluated 9164 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
FALSEevaluated 41531 times by 11 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
)
9164-41531
65 init();
executed 9164 times by 4 tests: init();
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
9164
66 else-
67 start();
executed 41531 times by 11 tests: start();
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
41531
68}-
69-
70void QSmoothedAnimation::prepareForRestart()-
71{-
72 initialVelocity = trackVelocity;-
73 if (isRunning()
isRunning()Description
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
) {
15-50
74-
75 skipUpdate = true;-
76 init();-
77 lastTime = 0;-
78 }
executed 50 times by 2 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
else {
50
79 skipUpdate = false;-
80-
81 }
executed 15 times by 2 tests: end of block
Executed by:
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
15
82}-
83-
84void QSmoothedAnimation::updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State )-
85{-
86 if (newState == QAbstractAnimationJob::Running
newState == QA...onJob::RunningDescription
TRUEevaluated 41572 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
FALSEevaluated 40292 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
)
40292-41572
87 init();
executed 41572 times by 13 tests: init();
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
41572
88}
executed 81864 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
81864
89-
90void QSmoothedAnimation::delayedStop()-
91{-
92 if (!delayedStopTimer->isActive()
!delayedStopTimer->isActive()Description
TRUEevaluated 678 times by 4 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
FALSEevaluated 577 times by 4 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
)
577-678
93 delayedStopTimer->start();
executed 678 times by 4 tests: delayedStopTimer->start();
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
678
94}
executed 1255 times by 4 tests: end of block
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
1255
95-
96int QSmoothedAnimation::duration() const-
97{-
98 return
executed 49139 times by 13 tests: return -1;
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
-1;
executed 49139 times by 13 tests: return -1;
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
49139
99}-
100-
101bool QSmoothedAnimation::recalc()-
102{-
103 s = to - initialValue;-
104 vi = initialVelocity;-
105-
106 s = (invert
invertDescription
TRUEevaluated 4038 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
FALSEevaluated 6910 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
? -1.0: 1.0) * s;
4038-6910
107-
108 if (userDuration >= 0
userDuration >= 0Description
TRUEevaluated 6075 times by 4 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 4873 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
&& velocity > 0
velocity > 0Description
TRUEevaluated 6071 times by 3 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickbehaviors
) {
4-6075
109 tf = s / velocity;-
110 if (tf > (userDuration / 1000.)
tf > (userDuration / 1000.)Description
TRUEevaluated 5374 times by 3 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 697 times by 2 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicksmoothedanimation
) tf = (userDuration / 1000.);
executed 5374 times by 3 tests: tf = (userDuration / 1000.);
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
697-5374
111 }
executed 6071 times by 3 tests: end of block
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
else if (userDuration >= 0
userDuration >= 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickbehaviors
FALSEevaluated 4873 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
4-6071
112 tf = userDuration / 1000.;-
113 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickbehaviors
else if (velocity > 0
velocity > 0Description
TRUEevaluated 4873 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
FALSEnever evaluated
) {
0-4873
114 tf = s / velocity;-
115 }
executed 4873 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
else {
4873
116 return
never executed: return false;
false;
never executed: return false;
0
117 }-
118-
119 finalDuration = qCeil(tf * 1000.0);-
120-
121 if (maximumEasingTime == 0
maximumEasingTime == 0Description
TRUEnever evaluated
FALSEevaluated 10948 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
0-10948
122 a = 0;-
123 d = 0;-
124 tp = 0;-
125 td = tf;-
126 vp = velocity;-
127 sp = 0;-
128 sd = s;-
129 }
never executed: end of block
else if (maximumEasingTime != -1
maximumEasingTime != -1Description
TRUEnever evaluated
FALSEevaluated 10948 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
&& tf > (maximumEasingTime / 1000.)
tf > (maximumE...gTime / 1000.)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-10948
130 qreal met = maximumEasingTime / 1000.;-
131 qreal ta = met / 2.;-
132 a = (s - (vi * tf - 0.5 * vi * ta)) / (tf * ta - ta * ta);-
133-
134 vp = vi + a * ta;-
135 d = vp / ta;-
136 tp = ta;-
137 sp = vi * ta + 0.5 * a * tp * tp;-
138 sd = sp + vp * (tf - 2 * ta);-
139 td = tf - ta;-
140 }
never executed: end of block
else {
0
141 qreal c1 = 0.25 * tf * tf;-
142 qreal c2 = 0.5 * vi * tf - s;-
143 qreal c3 = -0.25 * vi * vi;-
144-
145 qreal a1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);-
146-
147 qreal tp1 = 0.5 * tf - 0.5 * vi / a1;-
148 qreal vp1 = a1 * tp1 + vi;-
149-
150 qreal sp1 = 0.5 * a1 * tp1 * tp1 + vi * tp1;-
151-
152 a = a1;-
153 d = a1;-
154 tp = tp1;-
155 td = tp1;-
156 vp = vp1;-
157 sp = sp1;-
158 sd = sp1;-
159 }
executed 10948 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
10948
160 return
executed 10948 times by 6 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
true;
executed 10948 times by 6 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
10948
161}-
162-
163qreal QSmoothedAnimation::easeFollow(qreal time_seconds)-
164{-
165 qreal value;-
166 if (time_seconds < tp
time_seconds < tpDescription
TRUEevaluated 5931 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
FALSEevaluated 2798 times by 4 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
2798-5931
167 trackVelocity = vi + time_seconds * a;-
168 value = 0.5 * a * time_seconds * time_seconds + vi * time_seconds;-
169 }
executed 5931 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
else if (time_seconds < td
time_seconds < tdDescription
TRUEnever evaluated
FALSEevaluated 2798 times by 4 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
0-5931
170 time_seconds -= tp;-
171 trackVelocity = vp;-
172 value = sp + time_seconds * vp;-
173 }
never executed: end of block
else if (time_seconds < tf
time_seconds < tfDescription
TRUEevaluated 1543 times by 4 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
FALSEevaluated 1255 times by 4 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
0-1543
174 time_seconds -= td;-
175 trackVelocity = vp - time_seconds * a;-
176 value = sd - 0.5 * d * time_seconds * time_seconds + vp * time_seconds;-
177 }
executed 1543 times by 4 tests: end of block
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
else {
1543
178 trackVelocity = 0;-
179 value = s;-
180 delayedStop();-
181 }
executed 1255 times by 4 tests: end of block
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
1255
182-
183-
184 return
executed 8729 times by 6 tests: return value;
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
value;
executed 8729 times by 6 tests: return value;
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
8729
185}-
186-
187void QSmoothedAnimation::updateCurrentTime(int t)-
188{-
189 if (skipUpdate
skipUpdateDescription
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
FALSEevaluated 8729 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
50-8729
190 skipUpdate = false;-
191 return;
executed 50 times by 2 tests: return;
Executed by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
50
192 }-
193-
194 if (!isRunning()
!isRunning()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicksmoothedanimation
FALSEevaluated 8727 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
&& !isPaused()
!isPaused()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicksmoothedanimation
)
0-8727
195 return;
never executed: return;
0
196-
197 qreal time_seconds = qreal(t - lastTime) / 1000.;-
198-
199 qreal value = easeFollow(time_seconds);-
200 value *= (invert
invertDescription
TRUEevaluated 3199 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
FALSEevaluated 5530 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
? -1.0: 1.0);
3199-5530
201 QQmlPropertyPrivate::write(target, initialValue + value,-
202 QQmlPropertyData::BypassInterceptor-
203 | QQmlPropertyData::DontRemoveBinding);-
204}
executed 8729 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
8729
205-
206void QSmoothedAnimation::init()-
207{-
208 if (velocity == 0
velocity == 0Description
TRUEnever evaluated
FALSEevaluated 50786 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
) {
0-50786
209 stop();-
210 return;
never executed: return;
0
211 }-
212-
213 if (delayedStopTimer->isActive()
delayedStopTimer->isActive()Description
TRUEevaluated 256 times by 3 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
FALSEevaluated 50530 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquicksmoothedanimation
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
)
256-50530
214 delayedStopTimer->stop();
executed 256 times by 3 tests: delayedStopTimer->stop();
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
256
215-
216 initialValue = target.read().toReal();-
217 lastTime = this->currentTime();-
218-
219 if (to == initialValue
to == initialValueDescription
TRUEevaluated 39838 times by 11 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
FALSEevaluated 10948 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
10948-39838
220 stop();-
221 return;
executed 39838 times by 11 tests: return;
Executed by:
  • tst_examples
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
39838
222 }-
223-
224 bool hasReversed = trackVelocity != 0.
trackVelocity != 0.Description
TRUEevaluated 2697 times by 5 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
FALSEevaluated 8251 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
&&
2697-8251
225 ((
((!invert) == ...ue - to) > 0))Description
TRUEevaluated 180 times by 2 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
FALSEevaluated 2517 times by 5 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
!invert) == ((initialValue - to) > 0))
((!invert) == ...ue - to) > 0))Description
TRUEevaluated 180 times by 2 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
FALSEevaluated 2517 times by 5 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
;
180-2517
226-
227 if (hasReversed
hasReversedDescription
TRUEevaluated 180 times by 2 tests
Evaluated by:
  • tst_qquickgridview
  • tst_qquicklistview
FALSEevaluated 10768 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
180-10768
228 switch (reversingMode) {-
229 default
never executed: default:
:
never executed: default:
0
230 case
executed 180 times by 2 tests: case QQuickSmoothedAnimation::Eased:
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
QQuickSmoothedAnimation::Eased:
executed 180 times by 2 tests: case QQuickSmoothedAnimation::Eased:
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
180
231 initialVelocity = -trackVelocity;-
232 break;
executed 180 times by 2 tests: break;
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
180
233 case
never executed: case QQuickSmoothedAnimation::Sync:
QQuickSmoothedAnimation::Sync:
never executed: case QQuickSmoothedAnimation::Sync:
0
234 QQmlPropertyPrivate::write(target, to,-
235 QQmlPropertyData::BypassInterceptor-
236 | QQmlPropertyData::DontRemoveBinding);-
237 trackVelocity = 0;-
238 stop();-
239 return;
never executed: return;
0
240 case
never executed: case QQuickSmoothedAnimation::Immediate:
QQuickSmoothedAnimation::Immediate:
never executed: case QQuickSmoothedAnimation::Immediate:
0
241 initialVelocity = 0;-
242 break;
never executed: break;
0
243 }-
244 }-
245-
246 trackVelocity = initialVelocity;-
247-
248 invert = (to < initialValue);-
249-
250 if (!recalc()
!recalc()Description
TRUEnever evaluated
FALSEevaluated 10948 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
) {
0-10948
251 QQmlPropertyPrivate::write(target, to,-
252 QQmlPropertyData::BypassInterceptor-
253 | QQmlPropertyData::DontRemoveBinding);-
254 stop();-
255 return;
never executed: return;
0
256 }-
257}
executed 10948 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickbehaviors
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
  • tst_qquickvisualdatamodel
10948
258-
259void QSmoothedAnimation::debugAnimation(QDebug d) const-
260{-
261 d << "SmoothedAnimationJob(" << hex << (const void *) this << dec << ")" << "duration:" << userDuration-
262 << "velocity:" << velocity << "target:" << target.object() << "property:" << target.name()-
263 << "to:" << to << "current velocity:" << trackVelocity;-
264}
never executed: end of block
0
265QQuickSmoothedAnimation::QQuickSmoothedAnimation(QObject *parent)-
266: QQuickNumberAnimation(*(new QQuickSmoothedAnimationPrivate), parent)-
267{-
268}
executed 42 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
42
269-
270QQuickSmoothedAnimation::~QQuickSmoothedAnimation()-
271{-
272-
273}-
274-
275QQuickSmoothedAnimationPrivate::QQuickSmoothedAnimationPrivate()-
276 : anim(new QSmoothedAnimation)-
277{-
278}
executed 42 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
42
279-
280QQuickSmoothedAnimationPrivate::~QQuickSmoothedAnimationPrivate()-
281{-
282 typedef QHash<QQmlProperty, QSmoothedAnimation* >::iterator ActiveAnimationsHashIt;-
283-
284 delete anim;-
285 for (ActiveAnimationsHashIt it = activeAnimations.begin(), end = activeAnimations.end(); it != end
it != endDescription
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
; ++it)
0-40
286 it.value()->clearTemplate();
never executed: it.value()->clearTemplate();
0
287}
executed 40 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
40
288-
289void QQuickSmoothedAnimationPrivate::updateRunningAnimations()-
290{-
291 for (QSmoothedAnimation *ease : qAsConst(activeAnimations)) {-
292 ease->maximumEasingTime = anim->maximumEasingTime;-
293 ease->reversingMode = anim->reversingMode;-
294 ease->velocity = anim->velocity;-
295 ease->userDuration = anim->userDuration;-
296 ease->init();-
297 }
never executed: end of block
0
298}
executed 34 times by 2 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
34
299-
300QAbstractAnimationJob* QQuickSmoothedAnimation::transition(QQuickStateActions &actions,-
301 QQmlProperties &modified,-
302 TransitionDirection direction,-
303 QObject *defaultTarget)-
304{-
305 (void)direction;;-
306 QQuickSmoothedAnimationPrivate * const d = d_func();-
307-
308 const QQuickStateActions dataActions = QQuickPropertyAnimation::createTransitionActions(actions, modified, defaultTarget);-
309-
310 QContinuingAnimationGroupJob *wrapperGroup = new QContinuingAnimationGroupJob();-
311-
312 if (!dataActions.isEmpty()
!dataActions.isEmpty()Description
TRUEevaluated 91 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicksmoothedanimation
) {
2-91
313 QSet<QAbstractAnimationJob*> anims;-
314 for (int i = 0; i < dataActions.size()
i < dataActions.size()Description
TRUEevaluated 91 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 91 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
; i++) {
91
315 QSmoothedAnimation *ease;-
316 bool isActive;-
317 if (!d->activeAnimations.contains(dataActions[i].property)
!d->activeAnim...s[i].property)Description
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 65 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
) {
26-65
318 ease = new QSmoothedAnimation(d);-
319 d->activeAnimations.insert(dataActions[i].property, ease);-
320 ease->target = dataActions[i].property;-
321 isActive = false;-
322 }
executed 26 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
else {
26
323 ease = d->activeAnimations.value(dataActions[i].property);-
324 isActive = true;-
325 }
executed 65 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
65
326 wrapperGroup->appendAnimation(initInstance(ease));-
327-
328 ease->to = dataActions[i].toValue.toReal();-
329-
330-
331 ease->maximumEasingTime = d->anim->maximumEasingTime;-
332 ease->reversingMode = d->anim->reversingMode;-
333 ease->velocity = d->anim->velocity;-
334 ease->userDuration = d->anim->userDuration;-
335-
336 ease->initialVelocity = ease->trackVelocity;-
337-
338 if (isActive
isActiveDescription
TRUEevaluated 65 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
)
26-65
339 ease->prepareForRestart();
executed 65 times by 3 tests: ease->prepareForRestart();
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
65
340 anims.insert(ease);-
341 }
executed 91 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
91
342-
343 const auto copy = d->activeAnimations;-
344 for (QSmoothedAnimation *ease : copy) {-
345 if (!anims.contains(ease)
!anims.contains(ease)Description
TRUEnever evaluated
FALSEevaluated 91 times by 3 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
) {
0-91
346 ease->clearTemplate();-
347 d->activeAnimations.remove(ease->target);-
348 }
never executed: end of block
0
349 }
executed 91 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
91
350 }
executed 91 times by 3 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
91
351 return
executed 93 times by 3 tests: return wrapperGroup;
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
wrapperGroup;
executed 93 times by 3 tests: return wrapperGroup;
Executed by:
  • tst_qquickbehaviors
  • tst_qquicklistview
  • tst_qquicksmoothedanimation
93
352}-
353QQuickSmoothedAnimation::ReversingMode QQuickSmoothedAnimation::reversingMode() const-
354{-
355 const QQuickSmoothedAnimationPrivate * const d = d_func();-
356 return
executed 6 times by 1 test: return (QQuickSmoothedAnimation::ReversingMode) d->anim->reversingMode;
Executed by:
  • tst_qquicksmoothedanimation
(QQuickSmoothedAnimation::ReversingMode) d->anim->reversingMode;
executed 6 times by 1 test: return (QQuickSmoothedAnimation::ReversingMode) d->anim->reversingMode;
Executed by:
  • tst_qquicksmoothedanimation
6
357}-
358-
359void QQuickSmoothedAnimation::setReversingMode(ReversingMode m)-
360{-
361 QQuickSmoothedAnimationPrivate * const d = d_func();-
362 if (d->anim->reversingMode == m
d->anim->reversingMode == mDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicksmoothedanimation
)
0-4
363 return;
never executed: return;
0
364-
365 d->anim->reversingMode = m;-
366 reversingModeChanged();-
367 d->updateRunningAnimations();-
368}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicksmoothedanimation
4
369int QQuickSmoothedAnimation::duration() const-
370{-
371 const QQuickSmoothedAnimationPrivate * const d = d_func();-
372 return
executed 6 times by 1 test: return d->anim->userDuration;
Executed by:
  • tst_qquicksmoothedanimation
d->anim->userDuration;
executed 6 times by 1 test: return d->anim->userDuration;
Executed by:
  • tst_qquicksmoothedanimation
6
373}-
374-
375void QQuickSmoothedAnimation::setDuration(int duration)-
376{-
377 QQuickSmoothedAnimationPrivate * const d = d_func();-
378 if (duration != -1
duration != -1Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
FALSEnever evaluated
)
0-10
379 QQuickNumberAnimation::setDuration(duration);
executed 10 times by 2 tests: QQuickNumberAnimation::setDuration(duration);
Executed by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
10
380 if(duration == d->anim->userDuration
duration == d-...->userDurationDescription
TRUEnever evaluated
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
)
0-10
381 return;
never executed: return;
0
382 d->anim->userDuration = duration;-
383 d->updateRunningAnimations();-
384}
executed 10 times by 2 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
10
385-
386qreal QQuickSmoothedAnimation::velocity() const-
387{-
388 const QQuickSmoothedAnimationPrivate * const d = d_func();-
389 return
executed 6 times by 1 test: return d->anim->velocity;
Executed by:
  • tst_qquicksmoothedanimation
d->anim->velocity;
executed 6 times by 1 test: return d->anim->velocity;
Executed by:
  • tst_qquicksmoothedanimation
6
390}-
391void QQuickSmoothedAnimation::setVelocity(qreal v)-
392{-
393 QQuickSmoothedAnimationPrivate * const d = d_func();-
394 if (d->anim->velocity == v
d->anim->velocity == vDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicklistview
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
)
6-18
395 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquicklistview
6
396-
397 d->anim->velocity = v;-
398 velocityChanged();-
399 d->updateRunningAnimations();-
400}
executed 18 times by 2 tests: end of block
Executed by:
  • tst_qquickbehaviors
  • tst_qquicksmoothedanimation
18
401int QQuickSmoothedAnimation::maximumEasingTime() const-
402{-
403 const QQuickSmoothedAnimationPrivate * const d = d_func();-
404 return
executed 6 times by 1 test: return d->anim->maximumEasingTime;
Executed by:
  • tst_qquicksmoothedanimation
d->anim->maximumEasingTime;
executed 6 times by 1 test: return d->anim->maximumEasingTime;
Executed by:
  • tst_qquicksmoothedanimation
6
405}-
406-
407void QQuickSmoothedAnimation::setMaximumEasingTime(int v)-
408{-
409 QQuickSmoothedAnimationPrivate * const d = d_func();-
410 if(v == d->anim->maximumEasingTime
v == d->anim->...imumEasingTimeDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicksmoothedanimation
)
0-2
411 return;
never executed: return;
0
412 d->anim->maximumEasingTime = v;-
413 maximumEasingTimeChanged();-
414 d->updateRunningAnimations();-
415}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicksmoothedanimation
2
416-
417-
418-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0