qeasingcurve.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qeasingcurve.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-
36| *property* | *Used for type* |-
37| period | QEasingCurve::{In,Out,InOut,OutIn}Elastic |-
38| amplitude | QEasingCurve::{In,Out,InOut,OutIn}Bounce, QEasingCurve::{In,Out,InOut,OutIn}Elastic |-
39| overshoot | QEasingCurve::{In,Out,InOut,OutIn}Back |-
40-
41*/-
42-
43-
44-
45-
46/*!-
47 \class QEasingCurve-
48 \inmodule QtCore-
49 \since 4.6-
50 \ingroup animation-
51 \brief The QEasingCurve class provides easing curves for controlling animation.-
52-
53 Easing curves describe a function that controls how the speed of the interpolation-
54 between 0 and 1 should be. Easing curves allow transitions from-
55 one value to another to appear more natural than a simple constant speed would allow.-
56 The QEasingCurve class is usually used in conjunction with the QVariantAnimation and-
57 QPropertyAnimation classes but can be used on its own. It is usually used to accelerate-
58 the interpolation from zero velocity (ease in) or decelerate to zero velocity (ease out).-
59 Ease in and ease out can also be combined in the same easing curve.-
60-
61 To calculate the speed of the interpolation, the easing curve provides the function-
62 valueForProgress(), where the \a progress argument specifies the progress of the-
63 interpolation: 0 is the start value of the interpolation, 1 is the end value of the-
64 interpolation. The returned value is the effective progress of the interpolation.-
65 If the returned value is the same as the input value for all input values the easing-
66 curve is a linear curve. This is the default behaviour.-
67-
68 For example,-
69 \code-
70 QEasingCurve easing(QEasingCurve::InOutQuad);-
71-
72 for(qreal t = 0.0; t < 1.0; t+=0.1)-
73 qWarning() << "Effective progress" << t << " is-
74 << easing.valueForProgress(t);-
75 \endcode-
76 will print the effective progress of the interpolation between 0 and 1.-
77-
78 When using a QPropertyAnimation, the associated easing curve will be used to control the-
79 progress of the interpolation between startValue and endValue:-
80 \code-
81 QPropertyAnimation animation;-
82 animation.setStartValue(0);-
83 animation.setEndValue(1000);-
84 animation.setDuration(1000);-
85 animation.setEasingCurve(QEasingCurve::InOutQuad);-
86 \endcode-
87-
88 The ability to set an amplitude, overshoot, or period depends on-
89 the QEasingCurve type. Amplitude access is available to curves-
90 that behave as springs such as elastic and bounce curves. Changing-
91 the amplitude changes the height of the curve. Period access is-
92 only available to elastic curves and setting a higher period slows-
93 the rate of bounce. Only curves that have "boomerang" behaviors-
94 such as the InBack, OutBack, InOutBack, and OutInBack have-
95 overshoot settings. These curves will interpolate beyond the end-
96 points and return to the end point, acting similar to a boomerang.-
97-
98 The \l{Easing Curves Example} contains samples of QEasingCurve-
99 types and lets you change the curve settings.-
100-
101 */-
102-
103/*!-
104 \enum QEasingCurve::Type-
105-
106 The type of easing curve.-
107-
108 \value Linear \image qeasingcurve-linear.png-
109 \caption Easing curve for a linear (t) function:-
110 velocity is constant.-
111 \value InQuad \image qeasingcurve-inquad.png-
112 \caption Easing curve for a quadratic (t^2) function:-
113 accelerating from zero velocity.-
114 \value OutQuad \image qeasingcurve-outquad.png-
115 \caption Easing curve for a quadratic (t^2) function:-
116 decelerating to zero velocity.-
117 \value InOutQuad \image qeasingcurve-inoutquad.png-
118 \caption Easing curve for a quadratic (t^2) function:-
119 acceleration until halfway, then deceleration.-
120 \value OutInQuad \image qeasingcurve-outinquad.png-
121 \caption Easing curve for a quadratic (t^2) function:-
122 deceleration until halfway, then acceleration.-
123 \value InCubic \image qeasingcurve-incubic.png-
124 \caption Easing curve for a cubic (t^3) function:-
125 accelerating from zero velocity.-
126 \value OutCubic \image qeasingcurve-outcubic.png-
127 \caption Easing curve for a cubic (t^3) function:-
128 decelerating to zero velocity.-
129 \value InOutCubic \image qeasingcurve-inoutcubic.png-
130 \caption Easing curve for a cubic (t^3) function:-
131 acceleration until halfway, then deceleration.-
132 \value OutInCubic \image qeasingcurve-outincubic.png-
133 \caption Easing curve for a cubic (t^3) function:-
134 deceleration until halfway, then acceleration.-
135 \value InQuart \image qeasingcurve-inquart.png-
136 \caption Easing curve for a quartic (t^4) function:-
137 accelerating from zero velocity.-
138 \value OutQuart \image qeasingcurve-outquart.png-
139 \caption-
140 Easing curve for a quartic (t^4) function:-
141 decelerating to zero velocity.-
142 \value InOutQuart \image qeasingcurve-inoutquart.png-
143 \caption-
144 Easing curve for a quartic (t^4) function:-
145 acceleration until halfway, then deceleration.-
146 \value OutInQuart \image qeasingcurve-outinquart.png-
147 \caption-
148 Easing curve for a quartic (t^4) function:-
149 deceleration until halfway, then acceleration.-
150 \value InQuint \image qeasingcurve-inquint.png-
151 \caption-
152 Easing curve for a quintic (t^5) easing-
153 in: accelerating from zero velocity.-
154 \value OutQuint \image qeasingcurve-outquint.png-
155 \caption-
156 Easing curve for a quintic (t^5) function:-
157 decelerating to zero velocity.-
158 \value InOutQuint \image qeasingcurve-inoutquint.png-
159 \caption-
160 Easing curve for a quintic (t^5) function:-
161 acceleration until halfway, then deceleration.-
162 \value OutInQuint \image qeasingcurve-outinquint.png-
163 \caption-
164 Easing curve for a quintic (t^5) function:-
165 deceleration until halfway, then acceleration.-
166 \value InSine \image qeasingcurve-insine.png-
167 \caption-
168 Easing curve for a sinusoidal (sin(t)) function:-
169 accelerating from zero velocity.-
170 \value OutSine \image qeasingcurve-outsine.png-
171 \caption-
172 Easing curve for a sinusoidal (sin(t)) function:-
173 decelerating to zero velocity.-
174 \value InOutSine \image qeasingcurve-inoutsine.png-
175 \caption-
176 Easing curve for a sinusoidal (sin(t)) function:-
177 acceleration until halfway, then deceleration.-
178 \value OutInSine \image qeasingcurve-outinsine.png-
179 \caption-
180 Easing curve for a sinusoidal (sin(t)) function:-
181 deceleration until halfway, then acceleration.-
182 \value InExpo \image qeasingcurve-inexpo.png-
183 \caption-
184 Easing curve for an exponential (2^t) function:-
185 accelerating from zero velocity.-
186 \value OutExpo \image qeasingcurve-outexpo.png-
187 \caption-
188 Easing curve for an exponential (2^t) function:-
189 decelerating to zero velocity.-
190 \value InOutExpo \image qeasingcurve-inoutexpo.png-
191 \caption-
192 Easing curve for an exponential (2^t) function:-
193 acceleration until halfway, then deceleration.-
194 \value OutInExpo \image qeasingcurve-outinexpo.png-
195 \caption-
196 Easing curve for an exponential (2^t) function:-
197 deceleration until halfway, then acceleration.-
198 \value InCirc \image qeasingcurve-incirc.png-
199 \caption-
200 Easing curve for a circular (sqrt(1-t^2)) function:-
201 accelerating from zero velocity.-
202 \value OutCirc \image qeasingcurve-outcirc.png-
203 \caption-
204 Easing curve for a circular (sqrt(1-t^2)) function:-
205 decelerating to zero velocity.-
206 \value InOutCirc \image qeasingcurve-inoutcirc.png-
207 \caption-
208 Easing curve for a circular (sqrt(1-t^2)) function:-
209 acceleration until halfway, then deceleration.-
210 \value OutInCirc \image qeasingcurve-outincirc.png-
211 \caption-
212 Easing curve for a circular (sqrt(1-t^2)) function:-
213 deceleration until halfway, then acceleration.-
214 \value InElastic \image qeasingcurve-inelastic.png-
215 \caption-
216 Easing curve for an elastic-
217 (exponentially decaying sine wave) function:-
218 accelerating from zero velocity. The peak amplitude-
219 can be set with the \e amplitude parameter, and the-
220 period of decay by the \e period parameter.-
221 \value OutElastic \image qeasingcurve-outelastic.png-
222 \caption-
223 Easing curve for an elastic-
224 (exponentially decaying sine wave) function:-
225 decelerating to zero velocity. The peak amplitude-
226 can be set with the \e amplitude parameter, and the-
227 period of decay by the \e period parameter.-
228 \value InOutElastic \image qeasingcurve-inoutelastic.png-
229 \caption-
230 Easing curve for an elastic-
231 (exponentially decaying sine wave) function:-
232 acceleration until halfway, then deceleration.-
233 \value OutInElastic \image qeasingcurve-outinelastic.png-
234 \caption-
235 Easing curve for an elastic-
236 (exponentially decaying sine wave) function:-
237 deceleration until halfway, then acceleration.-
238 \value InBack \image qeasingcurve-inback.png-
239 \caption-
240 Easing curve for a back (overshooting-
241 cubic function: (s+1)*t^3 - s*t^2) easing in:-
242 accelerating from zero velocity.-
243 \value OutBack \image qeasingcurve-outback.png-
244 \caption-
245 Easing curve for a back (overshooting-
246 cubic function: (s+1)*t^3 - s*t^2) easing out:-
247 decelerating to zero velocity.-
248 \value InOutBack \image qeasingcurve-inoutback.png-
249 \caption-
250 Easing curve for a back (overshooting-
251 cubic function: (s+1)*t^3 - s*t^2) easing in/out:-
252 acceleration until halfway, then deceleration.-
253 \value OutInBack \image qeasingcurve-outinback.png-
254 \caption-
255 Easing curve for a back (overshooting-
256 cubic easing: (s+1)*t^3 - s*t^2) easing out/in:-
257 deceleration until halfway, then acceleration.-
258 \value InBounce \image qeasingcurve-inbounce.png-
259 \caption-
260 Easing curve for a bounce (exponentially-
261 decaying parabolic bounce) function: accelerating-
262 from zero velocity.-
263 \value OutBounce \image qeasingcurve-outbounce.png-
264 \caption-
265 Easing curve for a bounce (exponentially-
266 decaying parabolic bounce) function: decelerating-
267 from zero velocity.-
268 \value InOutBounce \image qeasingcurve-inoutbounce.png-
269 \caption-
270 Easing curve for a bounce (exponentially-
271 decaying parabolic bounce) function easing in/out:-
272 acceleration until halfway, then deceleration.-
273 \value OutInBounce \image qeasingcurve-outinbounce.png-
274 \caption-
275 Easing curve for a bounce (exponentially-
276 decaying parabolic bounce) function easing out/in:-
277 deceleration until halfway, then acceleration.-
278 \omitvalue InCurve-
279 \omitvalue OutCurve-
280 \omitvalue SineCurve-
281 \omitvalue CosineCurve-
282 \value BezierSpline Allows defining a custom easing curve using a cubic bezier spline-
283 \sa addCubicBezierSegment()-
284 \value TCBSpline Allows defining a custom easing curve using a TCB spline-
285 \sa addTCBSegment()-
286 \value Custom This is returned if the user specified a custom curve type with-
287 setCustomType(). Note that you cannot call setType() with this value,-
288 but type() can return it.-
289 \omitvalue NCurveTypes-
290*/-
291-
292/*!-
293 \typedef QEasingCurve::EasingFunction-
294-
295 This is a typedef for a pointer to a function with the following-
296 signature:-
297-
298 \snippet code/src_corelib_tools_qeasingcurve.cpp 0-
299*/-
300-
301#include "qeasingcurve.h"-
302#include <cmath>-
303-
304#ifndef QT_NO_DEBUG_STREAM-
305#include <QtCore/qdebug.h>-
306#include <QtCore/qstring.h>-
307#endif-
308-
309#ifndef QT_NO_DATASTREAM-
310#include <QtCore/qdatastream.h>-
311#endif-
312-
313#include <QtCore/qpoint.h>-
314#include <QtCore/qvector.h>-
315-
316QT_BEGIN_NAMESPACE-
317-
318static bool isConfigFunction(QEasingCurve::Type type)-
319{-
320 return (type >= QEasingCurve::InElastic
executed 1844 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
type >= QEasin...rve::InElasticDescription
TRUEevaluated 119 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QPropertyAnimation
  • tst_QTimeLine
FALSEevaluated 1725 times by 41 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QScroller
  • ...
119-1844
321 && type <= QEasingCurve::OutInBounce) ||
executed 1844 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
type <= QEasin...e::OutInBounceDescription
TRUEevaluated 79 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEevaluated 40 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QPropertyAnimation
  • tst_QTimeLine
40-1844
322 type == QEasingCurve::BezierSpline ||
executed 1844 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
type == QEasin...::BezierSplineDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1762 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • ...
3-1844
323 type == QEasingCurve::TCBSpline;
executed 1844 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
type == QEasin...rve::TCBSplineDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1758 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • ...
4-1844
324}-
325-
326struct TCBPoint {-
327 QPointF _point;-
328 qreal _t;-
329 qreal _c;-
330 qreal _b;-
331-
332 TCBPoint() {}-
333 TCBPoint(QPointF point, qreal t, qreal c, qreal b) : _point(point), _t(t), _c(c), _b(b) {}
executed 12 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
12
334-
335 bool operator==(const TCBPoint &other) const-
336 {-
337 return _point == other._point &&
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
_point == other._pointDescription
TRUEnever evaluated
FALSEnever evaluated
0
338 qFuzzyCompare(_t, other._t) &&
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
qFuzzyCompare(_t, other._t)Description
TRUEnever evaluated
FALSEnever evaluated
0
339 qFuzzyCompare(_c, other._c) &&
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
qFuzzyCompare(_c, other._c)Description
TRUEnever evaluated
FALSEnever evaluated
0
340 qFuzzyCompare(_b, other._b);
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
qFuzzyCompare(_b, other._b)Description
TRUEnever evaluated
FALSEnever evaluated
0
341 }-
342};-
343Q_DECLARE_TYPEINFO(TCBPoint, Q_PRIMITIVE_TYPE);-
344-
345-
346typedef QVector<TCBPoint> TCBPoints;-
347-
348class QEasingCurveFunction-
349{-
350public:-
351 QEasingCurveFunction(QEasingCurve::Type type, qreal period = 0.3, qreal amplitude = 1.0,-
352 qreal overshoot = 1.70158)-
353 : _t(type), _p(period), _a(amplitude), _o(overshoot)-
354 { }
executed 122 times by 3 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
122
355 virtual ~QEasingCurveFunction() {}-
356 virtual qreal value(qreal t);-
357 virtual QEasingCurveFunction *copy() const;-
358 bool operator==(const QEasingCurveFunction &other) const;-
359-
360 QEasingCurve::Type _t;-
361 qreal _p;-
362 qreal _a;-
363 qreal _o;-
364 QVector<QPointF> _bezierCurves;-
365 TCBPoints _tcbPoints;-
366-
367};-
368-
369static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve);-
370-
371qreal QEasingCurveFunction::value(qreal t)-
372{-
373 QEasingCurve::EasingFunction func = curveToFunc(_t);-
374 return func(t);
executed 2 times by 1 test: return func(t);
Executed by:
  • tst_QEasingCurve
2
375}-
376-
377QEasingCurveFunction *QEasingCurveFunction::copy() const-
378{-
379 QEasingCurveFunction *rv = new QEasingCurveFunction(_t, _p, _a, _o);-
380 rv->_bezierCurves = _bezierCurves;-
381 rv->_tcbPoints = _tcbPoints;-
382 return rv;
never executed: return rv;
0
383}-
384-
385bool QEasingCurveFunction::operator==(const QEasingCurveFunction &other) const-
386{-
387 return _t == other._t &&
executed 27 times by 3 tests: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
_t == other._tDescription
TRUEevaluated 27 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEnever evaluated
0-27
388 qFuzzyCompare(_p, other._p) &&
executed 27 times by 3 tests: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
qFuzzyCompare(_p, other._p)Description
TRUEevaluated 27 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEnever evaluated
0-27
389 qFuzzyCompare(_a, other._a) &&
executed 27 times by 3 tests: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
qFuzzyCompare(_a, other._a)Description
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
1-27
390 qFuzzyCompare(_o, other._o) &&
executed 27 times by 3 tests: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
qFuzzyCompare(_o, other._o)Description
TRUEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
1-27
391 _bezierCurves == other._bezierCurves &&
executed 27 times by 3 tests: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
_bezierCurves ...._bezierCurvesDescription
TRUEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEnever evaluated
0-27
392 _tcbPoints == other._tcbPoints;
executed 27 times by 3 tests: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
_tcbPoints == other._tcbPointsDescription
TRUEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEnever evaluated
0-27
393}-
394-
395QT_BEGIN_INCLUDE_NAMESPACE-
396#include "../../3rdparty/easing/easing.cpp"-
397QT_END_INCLUDE_NAMESPACE-
398-
399class QEasingCurvePrivate-
400{-
401public:-
402 QEasingCurvePrivate()-
403 : type(QEasingCurve::Linear),-
404 config(0),-
405 func(&easeNone)-
406 { }
executed 3873 times by 50 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • ...
3873
407 QEasingCurvePrivate(const QEasingCurvePrivate &other)-
408 : type(other.type),-
409 config(other.config ? other.config->copy() : 0),-
410 func(other.func)-
411 { }
executed 1899 times by 41 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QScroller
  • tst_QShortcut
  • ...
1899
412 ~QEasingCurvePrivate() { delete config; }
executed 5658 times by 52 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • ...
5658
413 void setType_helper(QEasingCurve::Type);-
414-
415 QEasingCurve::Type type;-
416 QEasingCurveFunction *config;-
417 QEasingCurve::EasingFunction func;-
418};-
419-
420struct BezierEase : public QEasingCurveFunction-
421{-
422 struct SingleCubicBezier {-
423 qreal p0x, p0y;-
424 qreal p1x, p1y;-
425 qreal p2x, p2y;-
426 qreal p3x, p3y;-
427 };-
428-
429 QVector<SingleCubicBezier> _curves;-
430 QVector<qreal> _intervals;-
431 int _curveCount;-
432 bool _init;-
433 bool _valid;-
434-
435 BezierEase(QEasingCurve::Type type = QEasingCurve::BezierSpline)-
436 : QEasingCurveFunction(type), _curves(10), _intervals(10), _init(false), _valid(false)-
437 { }
executed 7 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
7
438-
439 void init()-
440 {-
441 if (_bezierCurves.last() == QPointF(1.0, 1.0)) {
_bezierCurves....intF(1.0, 1.0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-7
442 _init = true;-
443 _curveCount = _bezierCurves.count() / 3;-
444-
445 for (int i=0; i < _curveCount; i++) {
i < _curveCountDescription
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QEasingCurve
7-19
446 _intervals[i] = _bezierCurves.at(i * 3 + 2).x();-
447-
448 if (i == 0) {
i == 0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QEasingCurve
7-12
449 _curves[0].p0x = 0.0;-
450 _curves[0].p0y = 0.0;-
451-
452 _curves[0].p1x = _bezierCurves.at(0).x();-
453 _curves[0].p1y = _bezierCurves.at(0).y();-
454-
455 _curves[0].p2x = _bezierCurves.at(1).x();-
456 _curves[0].p2y = _bezierCurves.at(1).y();-
457-
458 _curves[0].p3x = _bezierCurves.at(2).x();-
459 _curves[0].p3y = _bezierCurves.at(2).y();-
460-
461 } else if (i == (_curveCount - 1)) {
executed 7 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
i == (_curveCount - 1)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QEasingCurve
5-7
462 _curves[i].p0x = _bezierCurves.at(_bezierCurves.count() - 4).x();-
463 _curves[i].p0y = _bezierCurves.at(_bezierCurves.count() - 4).y();-
464-
465 _curves[i].p1x = _bezierCurves.at(_bezierCurves.count() - 3).x();-
466 _curves[i].p1y = _bezierCurves.at(_bezierCurves.count() - 3).y();-
467-
468 _curves[i].p2x = _bezierCurves.at(_bezierCurves.count() - 2).x();-
469 _curves[i].p2y = _bezierCurves.at(_bezierCurves.count() - 2).y();-
470-
471 _curves[i].p3x = _bezierCurves.at(_bezierCurves.count() - 1).x();-
472 _curves[i].p3y = _bezierCurves.at(_bezierCurves.count() - 1).y();-
473 } else {
executed 7 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
7
474 _curves[i].p0x = _bezierCurves.at(i * 3 - 1).x();-
475 _curves[i].p0y = _bezierCurves.at(i * 3 - 1).y();-
476-
477 _curves[i].p1x = _bezierCurves.at(i * 3).x();-
478 _curves[i].p1y = _bezierCurves.at(i * 3).y();-
479-
480 _curves[i].p2x = _bezierCurves.at(i * 3 + 1).x();-
481 _curves[i].p2y = _bezierCurves.at(i * 3 + 1).y();-
482-
483 _curves[i].p3x = _bezierCurves.at(i * 3 + 2).x();-
484 _curves[i].p3y = _bezierCurves.at(i * 3 + 2).y();-
485 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
5
486 }-
487 _valid = true;-
488 } else {
executed 7 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
7
489 _valid = false;-
490 }
never executed: end of block
0
491 }-
492-
493 QEasingCurveFunction *copy() const Q_DECL_OVERRIDE-
494 {-
495 BezierEase *rv = new BezierEase();-
496 rv->_t = _t;-
497 rv->_p = _p;-
498 rv->_a = _a;-
499 rv->_o = _o;-
500 rv->_bezierCurves = _bezierCurves;-
501 rv->_tcbPoints = _tcbPoints;-
502 return rv;
never executed: return rv;
0
503 }-
504-
505 void getBezierSegment(SingleCubicBezier * &singleCubicBezier, qreal x)-
506 {-
507-
508 int currentSegment = 0;-
509-
510 while (currentSegment < _curveCount) {
currentSegment < _curveCountDescription
TRUEevaluated 88 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-88
511 if (x <= _intervals.data()[currentSegment])
x <= _interval...urrentSegment]Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 41 times by 1 test
Evaluated by:
  • tst_QEasingCurve
41-47
512 break;
executed 47 times by 1 test: break;
Executed by:
  • tst_QEasingCurve
47
513 currentSegment++;-
514 }
executed 41 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
41
515-
516 singleCubicBezier = &_curves.data()[currentSegment];-
517 }
executed 47 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
47
518-
519-
520 qreal static inline newtonIteration(const SingleCubicBezier &singleCubicBezier, qreal t, qreal x)-
521 {-
522 qreal currentXValue = evaluateForX(singleCubicBezier, t);-
523-
524 const qreal newT = t - (currentXValue - x) / evaluateDerivateForX(singleCubicBezier, t);-
525-
526 return newT;
never executed: return newT;
0
527 }-
528-
529 qreal value(qreal x) Q_DECL_OVERRIDE-
530 {-
531 Q_ASSERT(_bezierCurves.count() % 3 == 0);-
532-
533 if (_bezierCurves.isEmpty()) {
_bezierCurves.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-47
534 return x;
never executed: return x;
0
535 }-
536-
537 if (!_init)
!_initDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_QEasingCurve
7-40
538 init();
executed 7 times by 1 test: init();
Executed by:
  • tst_QEasingCurve
7
539-
540 if (!_valid) {
!_validDescription
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-47
541 qWarning("QEasingCurve: Invalid bezier curve");-
542 return x;
never executed: return x;
0
543 }-
544 SingleCubicBezier *singleCubicBezier = 0;-
545 getBezierSegment(singleCubicBezier, x);-
546-
547 return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));
executed 47 times by 1 test: return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));
Executed by:
  • tst_QEasingCurve
47
548 }-
549-
550 qreal static inline evaluateSegmentForY(const SingleCubicBezier &singleCubicBezier, qreal t)-
551 {-
552 const qreal p0 = singleCubicBezier.p0y;-
553 const qreal p1 = singleCubicBezier.p1y;-
554 const qreal p2 = singleCubicBezier.p2y;-
555 const qreal p3 = singleCubicBezier.p3y;-
556-
557 const qreal s = 1 - t;-
558-
559 const qreal s_squared = s*s;-
560 const qreal t_squared = t*t;-
561-
562 const qreal s_cubic = s_squared * s;-
563 const qreal t_cubic = t_squared * t;-
564-
565 return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
executed 47 times by 1 test: return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
Executed by:
  • tst_QEasingCurve
47
566 }-
567-
568 qreal static inline evaluateForX(const SingleCubicBezier &singleCubicBezier, qreal t)-
569 {-
570 const qreal p0 = singleCubicBezier.p0x;-
571 const qreal p1 = singleCubicBezier.p1x;-
572 const qreal p2 = singleCubicBezier.p2x;-
573 const qreal p3 = singleCubicBezier.p3x;-
574-
575 const qreal s = 1 - t;-
576-
577 const qreal s_squared = s*s;-
578 const qreal t_squared = t*t;-
579-
580 const qreal s_cubic = s_squared * s;-
581 const qreal t_cubic = t_squared * t;-
582-
583 return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
never executed: return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
0
584 }-
585-
586 qreal static inline evaluateDerivateForX(const SingleCubicBezier &singleCubicBezier, qreal t)-
587 {-
588 const qreal p0 = singleCubicBezier.p0x;-
589 const qreal p1 = singleCubicBezier.p1x;-
590 const qreal p2 = singleCubicBezier.p2x;-
591 const qreal p3 = singleCubicBezier.p3x;-
592-
593 const qreal t_squared = t*t;-
594-
595 return -3*p0 + 3*p1 + 6*p0*t - 12*p1*t + 6*p2*t + 3*p3*t_squared - 3*p0*t_squared + 9*p1*t_squared - 9*p2*t_squared;
never executed: return -3*p0 + 3*p1 + 6*p0*t - 12*p1*t + 6*p2*t + 3*p3*t_squared - 3*p0*t_squared + 9*p1*t_squared - 9*p2*t_squared;
0
596 }-
597-
598 qreal static inline _cbrt(qreal d)-
599 {-
600 qreal sign = 1;-
601 if (d < 0)
d < 0Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QEasingCurve
10-14
602 sign = -1;
executed 14 times by 1 test: sign = -1;
Executed by:
  • tst_QEasingCurve
14
603 d = d * sign;-
604-
605 qreal t = _fast_cbrt(d);-
606-
607 //one step of Halley's Method to get a better approximation-
608 const qreal t_cubic = t * t * t;-
609 const qreal f = t_cubic + t_cubic + d;-
610 if (f != qreal(0.0))
f != qreal(0.0)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-24
611 t = t * (t_cubic + d + d) / f;
executed 24 times by 1 test: t = t * (t_cubic + d + d) / f;
Executed by:
  • tst_QEasingCurve
24
612-
613 //another step-
614 /*qreal t_i = t;-
615 t_i_cubic = pow(t_i, 3);-
616 t = t_i * (t_i_cubic + d + d) / (t_i_cubic + t_i_cubic + d);*/-
617-
618 return t * sign;
executed 24 times by 1 test: return t * sign;
Executed by:
  • tst_QEasingCurve
24
619 }-
620-
621 float static inline _fast_cbrt(float x)-
622 {-
623 union {-
624 float f;-
625 quint32 i;-
626 } ux;-
627-
628 const unsigned int B1 = 709921077;-
629-
630 ux.f = x;-
631 ux.i = (ux.i / 3 + B1);-
632-
633 return ux.f;
never executed: return ux.f;
0
634 }-
635-
636 double static inline _fast_cbrt(double d)-
637 {-
638 union {-
639 double d;-
640 quint32 pt[2];-
641 } ut, ux;-
642-
643 const unsigned int B1 = 715094163;-
644-
645#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN-
646 const int h0 = 1;-
647#else-
648 const int h0 = 0;-
649#endif-
650 ut.d = 0.0;-
651 ux.d = d;-
652-
653 quint32 hx = ux.pt[h0]; //high word of d-
654 ut.pt[h0] = hx / 3 + B1;-
655-
656 return ut.d;
executed 24 times by 1 test: return ut.d;
Executed by:
  • tst_QEasingCurve
24
657 }-
658-
659 qreal static inline _acos(qreal x)-
660 {-
661 return std::sqrt(1-x)*(1.5707963267948966192313216916398f + x*(-0.213300989f + x*(0.077980478f + x*-0.02164095f)));
never executed: return std::sqrt(1-x)*(1.5707963267948966192313216916398f + x*(-0.213300989f + x*(0.077980478f + x*-0.02164095f)));
0
662 }-
663-
664 qreal static inline _cos(qreal x) //super fast _cos-
665 {-
666 const qreal pi_times2 = 2 * M_PI;-
667 const qreal pi_neg = -1 * M_PI;-
668 const qreal pi_by2 = M_PI / 2.0;-
669-
670 x += pi_by2; //the polynom is for sin-
671-
672 if (x < pi_neg)
x < pi_negDescription
TRUEnever evaluated
FALSEnever evaluated
0
673 x += pi_times2;
never executed: x += pi_times2;
0
674 else if (x > M_PI)
x > 3.14159265358979323846Description
TRUEnever evaluated
FALSEnever evaluated
0
675 x -= pi_times2;
never executed: x -= pi_times2;
0
676-
677 const qreal a = 0.405284735;-
678 const qreal b = 1.27323954;-
679-
680 const qreal x_squared = x * x;-
681-
682 if (x < 0) {
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
683 qreal cos = b * x + a * x_squared;-
684-
685 if (cos < 0)
cos < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
686 return 0.225 * (cos * -1 * cos - cos) + cos;
never executed: return 0.225 * (cos * -1 * cos - cos) + cos;
0
687 return 0.225 * (cos * cos - cos) + cos;
never executed: return 0.225 * (cos * cos - cos) + cos;
0
688 } //else-
689-
690 qreal cos = b * x - a * x_squared;-
691-
692 if (cos < 0)
cos < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
693 return 0.225 * (cos * 1 *-cos - cos) + cos;
never executed: return 0.225 * (cos * 1 *-cos - cos) + cos;
0
694 return 0.225 * (cos * cos - cos) + cos;
never executed: return 0.225 * (cos * cos - cos) + cos;
0
695 }-
696-
697 bool static inline inRange(qreal f)-
698 {-
699 return (f >= -0.01 && f <= 1.01);
executed 40 times by 1 test: return (f >= -0.01 && f <= 1.01);
Executed by:
  • tst_QEasingCurve
f >= -0.01Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
f <= 1.01Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-40
700 }-
701-
702 void static inline cosacos(qreal x, qreal &s1, qreal &s2, qreal &s3 )-
703 {-
704 //This function has no proper algebraic representation in real numbers.-
705 //We use approximations instead-
706-
707 const qreal x_squared = x * x;-
708 const qreal x_plus_one_sqrt = qSqrt(1.0 + x);-
709 const qreal one_minus_x_sqrt = qSqrt(1.0 - x);-
710-
711 //cos(acos(x) / 3)-
712 //s1 = _cos(_acos(x) / 3);-
713 s1 = 0.463614 - 0.0347815 * x + 0.00218245 * x_squared + 0.402421 * x_plus_one_sqrt;-
714-
715 //cos(acos((x) - M_PI) / 3)-
716 //s3 = _cos((_acos(x) - M_PI) / 3);-
717 s3 = 0.463614 + 0.402421 * one_minus_x_sqrt + 0.0347815 * x + 0.00218245 * x_squared;-
718-
719 //cos((acos(x) + M_PI) / 3)-
720 //s2 = _cos((_acos(x) + M_PI) / 3);-
721 s2 = -0.401644 * one_minus_x_sqrt - 0.0686804 * x + 0.401644 * x_plus_one_sqrt;-
722 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
28
723-
724 qreal static inline singleRealSolutionForCubic(qreal a, qreal b, qreal c)-
725 {-
726 //returns the real solutiuon in [0..1]-
727 //We use the Cardano formula-
728-
729 //substituiton: x = z - a/3-
730 // z^3+pz+q=0-
731-
732 if (c < 0.000001 && c > -0.000001)
c < 0.000001Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 29 times by 1 test
Evaluated by:
  • tst_QEasingCurve
c > -0.000001Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QEasingCurve
7-29
733 return 0;
executed 7 times by 1 test: return 0;
Executed by:
  • tst_QEasingCurve
7
734-
735 const qreal a_by3 = a / 3.0;-
736-
737 const qreal a_cubic = a * a * a;-
738-
739 const qreal p = b - a * a_by3;-
740 const qreal q = 2.0 * a_cubic / 27.0 - a * b / 3.0 + c;-
741-
742 const qreal q_squared = q * q;-
743 const qreal p_cubic = p * p * p;-
744 const qreal D = 0.25 * q_squared + p_cubic / 27.0;-
745-
746 if (D >= 0) {
D >= 0Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QEasingCurve
12-28
747 const qreal D_sqrt = qSqrt(D);-
748 qreal u = _cbrt( -q * 0.5 + D_sqrt);-
749 qreal v = _cbrt( -q * 0.5 - D_sqrt);-
750 qreal z1 = u + v;-
751-
752 qreal t1 = z1 - a_by3;-
753-
754 if (inRange(t1))
inRange(t1)Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
1-11
755 return t1;
executed 11 times by 1 test: return t1;
Executed by:
  • tst_QEasingCurve
11
756 qreal z2 = -1 *u;-
757 qreal t2 = z2 - a_by3;-
758 return t2;
executed 1 time by 1 test: return t2;
Executed by:
  • tst_QEasingCurve
1
759 }-
760-
761 //casus irreducibilis-
762 const qreal p_minus_sqrt = qSqrt(-p);-
763-
764 //const qreal f = sqrt(4.0 / 3.0 * -p);-
765 const qreal f = qSqrt(4.0 / 3.0) * p_minus_sqrt;-
766-
767 //const qreal sqrtP = sqrt(27.0 / -p_cubic);-
768 const qreal sqrtP = -3.0*qSqrt(3.0) / (p_minus_sqrt * p);-
769-
770-
771 const qreal g = -q * 0.5 * sqrtP;-
772-
773 qreal s1;-
774 qreal s2;-
775 qreal s3;-
776-
777 cosacos(g, s1, s2, s3);-
778-
779 qreal z1 = -1* f * s2;-
780 qreal t1 = z1 - a_by3;-
781 if (inRange(t1))
inRange(t1)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-28
782 return t1;
executed 28 times by 1 test: return t1;
Executed by:
  • tst_QEasingCurve
28
783-
784 qreal z2 = f * s1;-
785 qreal t2 = z2 - a_by3;-
786 if (inRange(t2))
inRange(t2)Description
TRUEnever evaluated
FALSEnever evaluated
0
787 return t2;
never executed: return t2;
0
788-
789 qreal z3 = -1 * f * s3;-
790 qreal t3 = z3 - a_by3;-
791 return t3;
never executed: return t3;
0
792 }-
793-
794 qreal static inline findTForX(const SingleCubicBezier &singleCubicBezier, qreal x)-
795 {-
796 const qreal p0 = singleCubicBezier.p0x;-
797 const qreal p1 = singleCubicBezier.p1x;-
798 const qreal p2 = singleCubicBezier.p2x;-
799 const qreal p3 = singleCubicBezier.p3x;-
800-
801 const qreal factorT3 = p3 - p0 + 3 * p1 - 3 * p2;-
802 const qreal factorT2 = 3 * p0 - 6 * p1 + 3 * p2;-
803 const qreal factorT1 = -3 * p0 + 3 * p1;-
804 const qreal factorT0 = p0 - x;-
805-
806 const qreal a = factorT2 / factorT3;-
807 const qreal b = factorT1 / factorT3;-
808 const qreal c = factorT0 / factorT3;-
809-
810 return singleRealSolutionForCubic(a, b, c);
executed 47 times by 1 test: return singleRealSolutionForCubic(a, b, c);
Executed by:
  • tst_QEasingCurve
47
811-
812 //one new iteration to increase numeric stability-
813 //return newtonIteration(singleCubicBezier, t, x);-
814 }-
815};-
816-
817struct TCBEase : public BezierEase-
818{-
819 TCBEase()-
820 : BezierEase(QEasingCurve::TCBSpline)-
821 { }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
4
822-
823 qreal value(qreal x) Q_DECL_OVERRIDE-
824 {-
825 Q_ASSERT(_bezierCurves.count() % 3 == 0);-
826-
827 if (_bezierCurves.isEmpty()) {
_bezierCurves.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-28
828 qWarning("QEasingCurve: Invalid tcb curve");-
829 return x;
never executed: return x;
0
830 }-
831-
832 return BezierEase::value(x);
executed 28 times by 1 test: return BezierEase::value(x);
Executed by:
  • tst_QEasingCurve
28
833 }-
834-
835};-
836-
837struct ElasticEase : public QEasingCurveFunction-
838{-
839 ElasticEase(QEasingCurve::Type type)-
840 : QEasingCurveFunction(type, qreal(0.3), qreal(1.0))-
841 { }
executed 39 times by 3 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
39
842-
843 QEasingCurveFunction *copy() const Q_DECL_OVERRIDE-
844 {-
845 ElasticEase *rv = new ElasticEase(_t);-
846 rv->_p = _p;-
847 rv->_a = _a;-
848 rv->_bezierCurves = _bezierCurves;-
849 rv->_tcbPoints = _tcbPoints;-
850 return rv;
executed 4 times by 1 test: return rv;
Executed by:
  • tst_QMetaType
4
851 }-
852-
853 qreal value(qreal t) Q_DECL_OVERRIDE-
854 {-
855 qreal p = (_p < 0) ? qreal(0.3) : _p;
(_p < 0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-44
856 qreal a = (_a < 0) ? qreal(1.0) : _a;
(_a < 0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-44
857 switch(_t) {-
858 case QEasingCurve::InElastic:
executed 11 times by 1 test: case QEasingCurve::InElastic:
Executed by:
  • tst_QEasingCurve
11
859 return easeInElastic(t, a, p);
executed 11 times by 1 test: return easeInElastic(t, a, p);
Executed by:
  • tst_QEasingCurve
11
860 case QEasingCurve::OutElastic:
executed 11 times by 1 test: case QEasingCurve::OutElastic:
Executed by:
  • tst_QEasingCurve
11
861 return easeOutElastic(t, a, p);
executed 11 times by 1 test: return easeOutElastic(t, a, p);
Executed by:
  • tst_QEasingCurve
11
862 case QEasingCurve::InOutElastic:
executed 11 times by 1 test: case QEasingCurve::InOutElastic:
Executed by:
  • tst_QEasingCurve
11
863 return easeInOutElastic(t, a, p);
executed 11 times by 1 test: return easeInOutElastic(t, a, p);
Executed by:
  • tst_QEasingCurve
11
864 case QEasingCurve::OutInElastic:
executed 11 times by 1 test: case QEasingCurve::OutInElastic:
Executed by:
  • tst_QEasingCurve
11
865 return easeOutInElastic(t, a, p);
executed 11 times by 1 test: return easeOutInElastic(t, a, p);
Executed by:
  • tst_QEasingCurve
11
866 default:
never executed: default:
0
867 return t;
never executed: return t;
0
868 }-
869 }-
870};-
871-
872struct BounceEase : public QEasingCurveFunction-
873{-
874 BounceEase(QEasingCurve::Type type)-
875 : QEasingCurveFunction(type, qreal(0.3), qreal(1.0))-
876 { }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
5
877-
878 QEasingCurveFunction *copy() const Q_DECL_OVERRIDE-
879 {-
880 BounceEase *rv = new BounceEase(_t);-
881 rv->_a = _a;-
882 rv->_bezierCurves = _bezierCurves;-
883 rv->_tcbPoints = _tcbPoints;-
884 return rv;
never executed: return rv;
0
885 }-
886-
887 qreal value(qreal t) Q_DECL_OVERRIDE-
888 {-
889 qreal a = (_a < 0) ? qreal(1.0) : _a;
(_a < 0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-44
890 switch(_t) {-
891 case QEasingCurve::InBounce:
executed 11 times by 1 test: case QEasingCurve::InBounce:
Executed by:
  • tst_QEasingCurve
11
892 return easeInBounce(t, a);
executed 11 times by 1 test: return easeInBounce(t, a);
Executed by:
  • tst_QEasingCurve
11
893 case QEasingCurve::OutBounce:
executed 11 times by 1 test: case QEasingCurve::OutBounce:
Executed by:
  • tst_QEasingCurve
11
894 return easeOutBounce(t, a);
executed 11 times by 1 test: return easeOutBounce(t, a);
Executed by:
  • tst_QEasingCurve
11
895 case QEasingCurve::InOutBounce:
executed 11 times by 1 test: case QEasingCurve::InOutBounce:
Executed by:
  • tst_QEasingCurve
11
896 return easeInOutBounce(t, a);
executed 11 times by 1 test: return easeInOutBounce(t, a);
Executed by:
  • tst_QEasingCurve
11
897 case QEasingCurve::OutInBounce:
executed 11 times by 1 test: case QEasingCurve::OutInBounce:
Executed by:
  • tst_QEasingCurve
11
898 return easeOutInBounce(t, a);
executed 11 times by 1 test: return easeOutInBounce(t, a);
Executed by:
  • tst_QEasingCurve
11
899 default:
never executed: default:
0
900 return t;
never executed: return t;
0
901 }-
902 }-
903};-
904-
905struct BackEase : public QEasingCurveFunction-
906{-
907 BackEase(QEasingCurve::Type type)-
908 : QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158))-
909 { }
executed 61 times by 2 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
61
910-
911 QEasingCurveFunction *copy() const Q_DECL_OVERRIDE-
912 {-
913 BackEase *rv = new BackEase(_t);-
914 rv->_o = _o;-
915 rv->_bezierCurves = _bezierCurves;-
916 rv->_tcbPoints = _tcbPoints;-
917 return rv;
executed 4 times by 1 test: return rv;
Executed by:
  • tst_QEasingCurve
4
918 }-
919-
920 qreal value(qreal t) Q_DECL_OVERRIDE-
921 {-
922 qreal o = (_o < 0) ? qreal(1.70158) : _o;
(_o < 0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-44
923 switch(_t) {-
924 case QEasingCurve::InBack:
executed 11 times by 1 test: case QEasingCurve::InBack:
Executed by:
  • tst_QEasingCurve
11
925 return easeInBack(t, o);
executed 11 times by 1 test: return easeInBack(t, o);
Executed by:
  • tst_QEasingCurve
11
926 case QEasingCurve::OutBack:
executed 11 times by 1 test: case QEasingCurve::OutBack:
Executed by:
  • tst_QEasingCurve
11
927 return easeOutBack(t, o);
executed 11 times by 1 test: return easeOutBack(t, o);
Executed by:
  • tst_QEasingCurve
11
928 case QEasingCurve::InOutBack:
executed 11 times by 1 test: case QEasingCurve::InOutBack:
Executed by:
  • tst_QEasingCurve
11
929 return easeInOutBack(t, o);
executed 11 times by 1 test: return easeInOutBack(t, o);
Executed by:
  • tst_QEasingCurve
11
930 case QEasingCurve::OutInBack:
executed 11 times by 1 test: case QEasingCurve::OutInBack:
Executed by:
  • tst_QEasingCurve
11
931 return easeOutInBack(t, o);
executed 11 times by 1 test: return easeOutInBack(t, o);
Executed by:
  • tst_QEasingCurve
11
932 default:
never executed: default:
0
933 return t;
never executed: return t;
0
934 }-
935 }-
936};-
937-
938static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve)-
939{-
940 switch(curve) {-
941 case QEasingCurve::Linear:
executed 2 times by 1 test: case QEasingCurve::Linear:
Executed by:
  • tst_QEasingCurve
2
942 return &easeNone;
executed 2 times by 1 test: return &easeNone;
Executed by:
  • tst_QEasingCurve
2
943 case QEasingCurve::InQuad:
executed 5 times by 3 tests: case QEasingCurve::InQuad:
Executed by:
  • tst_QEasingCurve
  • tst_QScroller
  • tst_QVariantAnimation
5
944 return &easeInQuad;
executed 5 times by 3 tests: return &easeInQuad;
Executed by:
  • tst_QEasingCurve
  • tst_QScroller
  • tst_QVariantAnimation
5
945 case QEasingCurve::OutQuad:
executed 13 times by 2 tests: case QEasingCurve::OutQuad:
Executed by:
  • tst_QEasingCurve
  • tst_QScroller
13
946 return &easeOutQuad;
executed 13 times by 2 tests: return &easeOutQuad;
Executed by:
  • tst_QEasingCurve
  • tst_QScroller
13
947 case QEasingCurve::InOutQuad:
executed 1607 times by 35 tests: case QEasingCurve::InOutQuad:
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QShortcut
  • tst_QSortFilterProxyModel
  • tst_QSplitter
  • tst_QStandardItemModel
  • ...
1607
948 return &easeInOutQuad;
executed 1607 times by 35 tests: return &easeInOutQuad;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QShortcut
  • tst_QSortFilterProxyModel
  • tst_QSplitter
  • tst_QStandardItemModel
  • ...
1607
949 case QEasingCurve::OutInQuad:
executed 1 time by 1 test: case QEasingCurve::OutInQuad:
Executed by:
  • tst_QEasingCurve
1
950 return &easeOutInQuad;
executed 1 time by 1 test: return &easeOutInQuad;
Executed by:
  • tst_QEasingCurve
1
951 case QEasingCurve::InCubic:
executed 2 times by 1 test: case QEasingCurve::InCubic:
Executed by:
  • tst_QEasingCurve
2
952 return &easeInCubic;
executed 2 times by 1 test: return &easeInCubic;
Executed by:
  • tst_QEasingCurve
2
953 case QEasingCurve::OutCubic:
executed 19 times by 2 tests: case QEasingCurve::OutCubic:
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
19
954 return &easeOutCubic;
executed 19 times by 2 tests: return &easeOutCubic;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
19
955 case QEasingCurve::InOutCubic:
executed 1 time by 1 test: case QEasingCurve::InOutCubic:
Executed by:
  • tst_QEasingCurve
1
956 return &easeInOutCubic;
executed 1 time by 1 test: return &easeInOutCubic;
Executed by:
  • tst_QEasingCurve
1
957 case QEasingCurve::OutInCubic:
executed 1 time by 1 test: case QEasingCurve::OutInCubic:
Executed by:
  • tst_QEasingCurve
1
958 return &easeOutInCubic;
executed 1 time by 1 test: return &easeOutInCubic;
Executed by:
  • tst_QEasingCurve
1
959 case QEasingCurve::InQuart:
executed 1 time by 1 test: case QEasingCurve::InQuart:
Executed by:
  • tst_QEasingCurve
1
960 return &easeInQuart;
executed 1 time by 1 test: return &easeInQuart;
Executed by:
  • tst_QEasingCurve
1
961 case QEasingCurve::OutQuart:
executed 2 times by 2 tests: case QEasingCurve::OutQuart:
Executed by:
  • tst_QEasingCurve
  • tst_QScroller
2
962 return &easeOutQuart;
executed 2 times by 2 tests: return &easeOutQuart;
Executed by:
  • tst_QEasingCurve
  • tst_QScroller
2
963 case QEasingCurve::InOutQuart:
executed 1 time by 1 test: case QEasingCurve::InOutQuart:
Executed by:
  • tst_QEasingCurve
1
964 return &easeInOutQuart;
executed 1 time by 1 test: return &easeInOutQuart;
Executed by:
  • tst_QEasingCurve
1
965 case QEasingCurve::OutInQuart:
executed 1 time by 1 test: case QEasingCurve::OutInQuart:
Executed by:
  • tst_QEasingCurve
1
966 return &easeOutInQuart;
executed 1 time by 1 test: return &easeOutInQuart;
Executed by:
  • tst_QEasingCurve
1
967 case QEasingCurve::InQuint:
executed 1 time by 1 test: case QEasingCurve::InQuint:
Executed by:
  • tst_QEasingCurve
1
968 return &easeInQuint;
executed 1 time by 1 test: return &easeInQuint;
Executed by:
  • tst_QEasingCurve
1
969 case QEasingCurve::OutQuint:
executed 1 time by 1 test: case QEasingCurve::OutQuint:
Executed by:
  • tst_QEasingCurve
1
970 return &easeOutQuint;
executed 1 time by 1 test: return &easeOutQuint;
Executed by:
  • tst_QEasingCurve
1
971 case QEasingCurve::InOutQuint:
executed 1 time by 1 test: case QEasingCurve::InOutQuint:
Executed by:
  • tst_QEasingCurve
1
972 return &easeInOutQuint;
executed 1 time by 1 test: return &easeInOutQuint;
Executed by:
  • tst_QEasingCurve
1
973 case QEasingCurve::OutInQuint:
executed 1 time by 1 test: case QEasingCurve::OutInQuint:
Executed by:
  • tst_QEasingCurve
1
974 return &easeOutInQuint;
executed 1 time by 1 test: return &easeOutInQuint;
Executed by:
  • tst_QEasingCurve
1
975 case QEasingCurve::InSine:
executed 1 time by 1 test: case QEasingCurve::InSine:
Executed by:
  • tst_QEasingCurve
1
976 return &easeInSine;
executed 1 time by 1 test: return &easeInSine;
Executed by:
  • tst_QEasingCurve
1
977 case QEasingCurve::OutSine:
executed 4 times by 1 test: case QEasingCurve::OutSine:
Executed by:
  • tst_QEasingCurve
4
978 return &easeOutSine;
executed 4 times by 1 test: return &easeOutSine;
Executed by:
  • tst_QEasingCurve
4
979 case QEasingCurve::InOutSine:
executed 48 times by 5 tests: case QEasingCurve::InOutSine:
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
48
980 return &easeInOutSine;
executed 48 times by 5 tests: return &easeInOutSine;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QTimeLine
48
981 case QEasingCurve::OutInSine:
executed 1 time by 1 test: case QEasingCurve::OutInSine:
Executed by:
  • tst_QEasingCurve
1
982 return &easeOutInSine;
executed 1 time by 1 test: return &easeOutInSine;
Executed by:
  • tst_QEasingCurve
1
983 case QEasingCurve::InExpo:
executed 1 time by 1 test: case QEasingCurve::InExpo:
Executed by:
  • tst_QEasingCurve
1
984 return &easeInExpo;
executed 1 time by 1 test: return &easeInExpo;
Executed by:
  • tst_QEasingCurve
1
985 case QEasingCurve::OutExpo:
executed 1 time by 1 test: case QEasingCurve::OutExpo:
Executed by:
  • tst_QEasingCurve
1
986 return &easeOutExpo;
executed 1 time by 1 test: return &easeOutExpo;
Executed by:
  • tst_QEasingCurve
1
987 case QEasingCurve::InOutExpo:
executed 1 time by 1 test: case QEasingCurve::InOutExpo:
Executed by:
  • tst_QEasingCurve
1
988 return &easeInOutExpo;
executed 1 time by 1 test: return &easeInOutExpo;
Executed by:
  • tst_QEasingCurve
1
989 case QEasingCurve::OutInExpo:
executed 1 time by 1 test: case QEasingCurve::OutInExpo:
Executed by:
  • tst_QEasingCurve
1
990 return &easeOutInExpo;
executed 1 time by 1 test: return &easeOutInExpo;
Executed by:
  • tst_QEasingCurve
1
991 case QEasingCurve::InCirc:
executed 1 time by 1 test: case QEasingCurve::InCirc:
Executed by:
  • tst_QEasingCurve
1
992 return &easeInCirc;
executed 1 time by 1 test: return &easeInCirc;
Executed by:
  • tst_QEasingCurve
1
993 case QEasingCurve::OutCirc:
executed 1 time by 1 test: case QEasingCurve::OutCirc:
Executed by:
  • tst_QEasingCurve
1
994 return &easeOutCirc;
executed 1 time by 1 test: return &easeOutCirc;
Executed by:
  • tst_QEasingCurve
1
995 case QEasingCurve::InOutCirc:
executed 1 time by 1 test: case QEasingCurve::InOutCirc:
Executed by:
  • tst_QEasingCurve
1
996 return &easeInOutCirc;
executed 1 time by 1 test: return &easeInOutCirc;
Executed by:
  • tst_QEasingCurve
1
997 case QEasingCurve::OutInCirc:
executed 1 time by 1 test: case QEasingCurve::OutInCirc:
Executed by:
  • tst_QEasingCurve
1
998 return &easeOutInCirc;
executed 1 time by 1 test: return &easeOutInCirc;
Executed by:
  • tst_QEasingCurve
1
999 // Internal for, compatibility with QTimeLine only ??-
1000 case QEasingCurve::InCurve:
executed 1 time by 1 test: case QEasingCurve::InCurve:
Executed by:
  • tst_QEasingCurve
1
1001 return &easeInCurve;
executed 1 time by 1 test: return &easeInCurve;
Executed by:
  • tst_QEasingCurve
1
1002 case QEasingCurve::OutCurve:
executed 19 times by 2 tests: case QEasingCurve::OutCurve:
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
19
1003 return &easeOutCurve;
executed 19 times by 2 tests: return &easeOutCurve;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
19
1004 case QEasingCurve::SineCurve:
executed 3 times by 2 tests: case QEasingCurve::SineCurve:
Executed by:
  • tst_QEasingCurve
  • tst_QTimeLine
3
1005 return &easeSineCurve;
executed 3 times by 2 tests: return &easeSineCurve;
Executed by:
  • tst_QEasingCurve
  • tst_QTimeLine
3
1006 case QEasingCurve::CosineCurve:
executed 3 times by 2 tests: case QEasingCurve::CosineCurve:
Executed by:
  • tst_QEasingCurve
  • tst_QTimeLine
3
1007 return &easeCosineCurve;
executed 3 times by 2 tests: return &easeCosineCurve;
Executed by:
  • tst_QEasingCurve
  • tst_QTimeLine
3
1008 default:
never executed: default:
0
1009 return 0;
never executed: return 0;
0
1010 };-
1011}-
1012-
1013static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type)-
1014{-
1015 switch(type) {-
1016 case QEasingCurve::InElastic:
executed 6 times by 1 test: case QEasingCurve::InElastic:
Executed by:
  • tst_QEasingCurve
6
1017 case QEasingCurve::OutElastic:
executed 1 time by 1 test: case QEasingCurve::OutElastic:
Executed by:
  • tst_QEasingCurve
1
1018 case QEasingCurve::InOutElastic:
executed 27 times by 3 tests: case QEasingCurve::InOutElastic:
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
27
1019 case QEasingCurve::OutInElastic:
executed 1 time by 1 test: case QEasingCurve::OutInElastic:
Executed by:
  • tst_QEasingCurve
1
1020 return new ElasticEase(type);
executed 35 times by 3 tests: return new ElasticEase(type);
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
35
1021 case QEasingCurve::OutBounce:
executed 1 time by 1 test: case QEasingCurve::OutBounce:
Executed by:
  • tst_QEasingCurve
1
1022 case QEasingCurve::InBounce:
executed 2 times by 1 test: case QEasingCurve::InBounce:
Executed by:
  • tst_QEasingCurve
2
1023 case QEasingCurve::OutInBounce:
executed 1 time by 1 test: case QEasingCurve::OutInBounce:
Executed by:
  • tst_QEasingCurve
1
1024 case QEasingCurve::InOutBounce:
executed 1 time by 1 test: case QEasingCurve::InOutBounce:
Executed by:
  • tst_QEasingCurve
1
1025 return new BounceEase(type);
executed 5 times by 1 test: return new BounceEase(type);
Executed by:
  • tst_QEasingCurve
5
1026 case QEasingCurve::InBack:
executed 3 times by 1 test: case QEasingCurve::InBack:
Executed by:
  • tst_QEasingCurve
3
1027 case QEasingCurve::OutBack:
executed 1 time by 1 test: case QEasingCurve::OutBack:
Executed by:
  • tst_QEasingCurve
1
1028 case QEasingCurve::InOutBack:
executed 28 times by 2 tests: case QEasingCurve::InOutBack:
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
28
1029 case QEasingCurve::OutInBack:
executed 25 times by 2 tests: case QEasingCurve::OutInBack:
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
25
1030 return new BackEase(type);
executed 57 times by 2 tests: return new BackEase(type);
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
57
1031 case QEasingCurve::BezierSpline:
executed 3 times by 1 test: case QEasingCurve::BezierSpline:
Executed by:
  • tst_QEasingCurve
3
1032 return new BezierEase;
executed 3 times by 1 test: return new BezierEase;
Executed by:
  • tst_QEasingCurve
3
1033 case QEasingCurve::TCBSpline:
executed 4 times by 1 test: case QEasingCurve::TCBSpline:
Executed by:
  • tst_QEasingCurve
4
1034 return new TCBEase;
executed 4 times by 1 test: return new TCBEase;
Executed by:
  • tst_QEasingCurve
4
1035 default:
executed 10 times by 1 test: default:
Executed by:
  • tst_QEasingCurve
10
1036 return new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158));
executed 10 times by 1 test: return new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158));
Executed by:
  • tst_QEasingCurve
10
1037 }-
1038-
1039 return 0;
dead code: return 0;
-
1040}-
1041-
1042/*!-
1043 \fn QEasingCurve::QEasingCurve(QEasingCurve &&other)-
1044-
1045 Move-constructs a QEasingCurve instance, making it point at the same-
1046 object that \a other was pointing to.-
1047-
1048 \since 5.2-
1049*/-
1050-
1051/*!-
1052 Constructs an easing curve of the given \a type.-
1053 */-
1054QEasingCurve::QEasingCurve(Type type)-
1055 : d_ptr(new QEasingCurvePrivate)-
1056{-
1057 setType(type);-
1058}
executed 3873 times by 50 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • ...
3873
1059-
1060/*!-
1061 Construct a copy of \a other.-
1062 */-
1063QEasingCurve::QEasingCurve(const QEasingCurve &other)-
1064 : d_ptr(new QEasingCurvePrivate(*other.d_ptr))-
1065{-
1066 // ### non-atomic, requires malloc on shallow copy-
1067}
executed 1899 times by 41 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QScroller
  • tst_QShortcut
  • ...
1899
1068-
1069/*!-
1070 Destructor.-
1071 */-
1072-
1073QEasingCurve::~QEasingCurve()-
1074{-
1075 delete d_ptr;-
1076}
executed 5659 times by 52 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • ...
5659
1077-
1078/*!-
1079 \fn QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other)-
1080 Copy \a other.-
1081 */-
1082-
1083/*!-
1084 \fn QEasingCurve &QEasingCurve::operator=(QEasingCurve &&other)-
1085-
1086 Move-assigns \a other to this QEasingCurve instance.-
1087-
1088 \since 5.2-
1089*/-
1090-
1091/*!-
1092 \fn void QEasingCurve::swap(QEasingCurve &other)-
1093 \since 5.0-
1094-
1095 Swaps curve \a other with this curve. This operation is very-
1096 fast and never fails.-
1097*/-
1098-
1099/*!-
1100 Compare this easing curve with \a other and returns \c true if they are-
1101 equal. It will also compare the properties of a curve.-
1102 */-
1103bool QEasingCurve::operator==(const QEasingCurve &other) const-
1104{-
1105 bool res = d_ptr->func == other.d_ptr->func
d_ptr->func ==...er.d_ptr->funcDescription
TRUEevaluated 73 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
FALSEnever evaluated
0-73
1106 && d_ptr->type == other.d_ptr->type;
d_ptr->type ==...er.d_ptr->typeDescription
TRUEevaluated 72 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
1-72
1107 if (res) {
resDescription
TRUEevaluated 72 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
1-72
1108 if (d_ptr->config && other.d_ptr->config) {
d_ptr->configDescription
TRUEevaluated 27 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEevaluated 45 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
other.d_ptr->configDescription
TRUEevaluated 27 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEnever evaluated
0-45
1109 // catch the config content-
1110 res = d_ptr->config->operator==(*(other.d_ptr->config));-
1111-
1112 } else if (d_ptr->config || other.d_ptr->config) {
executed 27 times by 3 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
d_ptr->configDescription
TRUEnever evaluated
FALSEevaluated 45 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
other.d_ptr->configDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 43 times by 4 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
0-45
1113 // one one has a config object, which could contain default values-
1114 res = qFuzzyCompare(amplitude(), other.amplitude()) &&
qFuzzyCompare(...r.amplitude())Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
1
1115 qFuzzyCompare(period(), other.period()) &&
qFuzzyCompare(...ther.period())Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-1
1116 qFuzzyCompare(overshoot(), other.overshoot());
qFuzzyCompare(...r.overshoot())Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-1
1117 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
2
1118 }
executed 72 times by 5 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
72
1119 return res;
executed 73 times by 5 tests: return res;
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
  • tst_QScroller
  • tst_QVariantAnimation
73
1120}-
1121-
1122/*!-
1123 \fn bool QEasingCurve::operator!=(const QEasingCurve &other) const-
1124 Compare this easing curve with \a other and returns \c true if they are not equal.-
1125 It will also compare the properties of a curve.-
1126-
1127 \sa operator==()-
1128*/-
1129-
1130/*!-
1131 Returns the amplitude. This is not applicable for all curve types.-
1132 It is only applicable for bounce and elastic curves (curves of type()-
1133 QEasingCurve::InBounce, QEasingCurve::OutBounce, QEasingCurve::InOutBounce,-
1134 QEasingCurve::OutInBounce, QEasingCurve::InElastic, QEasingCurve::OutElastic,-
1135 QEasingCurve::InOutElastic or QEasingCurve::OutInElastic).-
1136 */-
1137qreal QEasingCurve::amplitude() const-
1138{-
1139 return d_ptr->config ? d_ptr->config->_a : qreal(1.0);
executed 19 times by 1 test: return d_ptr->config ? d_ptr->config->_a : qreal(1.0);
Executed by:
  • tst_QEasingCurve
d_ptr->configDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QEasingCurve
6-19
1140}-
1141-
1142/*!-
1143 Sets the amplitude to \a amplitude.-
1144-
1145 This will set the amplitude of the bounce or the amplitude of the-
1146 elastic "spring" effect. The higher the number, the higher the amplitude.-
1147 \sa amplitude()-
1148*/-
1149void QEasingCurve::setAmplitude(qreal amplitude)-
1150{-
1151 if (!d_ptr->config)
!d_ptr->configDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
2-15
1152 d_ptr->config = curveToFunctionObject(d_ptr->type);
executed 2 times by 1 test: d_ptr->config = curveToFunctionObject(d_ptr->type);
Executed by:
  • tst_QEasingCurve
2
1153 d_ptr->config->_a = amplitude;-
1154}
executed 17 times by 2 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
17
1155-
1156/*!-
1157 Returns the period. This is not applicable for all curve types.-
1158 It is only applicable if type() is QEasingCurve::InElastic, QEasingCurve::OutElastic,-
1159 QEasingCurve::InOutElastic or QEasingCurve::OutInElastic.-
1160 */-
1161qreal QEasingCurve::period() const-
1162{-
1163 return d_ptr->config ? d_ptr->config->_p : qreal(0.3);
executed 16 times by 1 test: return d_ptr->config ? d_ptr->config->_p : qreal(0.3);
Executed by:
  • tst_QEasingCurve
d_ptr->configDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
4-16
1164}-
1165-
1166/*!-
1167 Sets the period to \a period.-
1168 Setting a small period value will give a high frequency of the curve. A-
1169 large period will give it a small frequency.-
1170-
1171 \sa period()-
1172*/-
1173void QEasingCurve::setPeriod(qreal period)-
1174{-
1175 if (!d_ptr->config)
!d_ptr->configDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
3-13
1176 d_ptr->config = curveToFunctionObject(d_ptr->type);
executed 3 times by 1 test: d_ptr->config = curveToFunctionObject(d_ptr->type);
Executed by:
  • tst_QEasingCurve
3
1177 d_ptr->config->_p = period;-
1178}
executed 16 times by 2 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
16
1179-
1180/*!-
1181 Returns the overshoot. This is not applicable for all curve types.-
1182 It is only applicable if type() is QEasingCurve::InBack, QEasingCurve::OutBack,-
1183 QEasingCurve::InOutBack or QEasingCurve::OutInBack.-
1184 */-
1185qreal QEasingCurve::overshoot() const-
1186{-
1187 return d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ;
executed 17 times by 1 test: return d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ;
Executed by:
  • tst_QEasingCurve
d_ptr->configDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QEasingCurve
3-17
1188}-
1189-
1190/*!-
1191 Sets the overshoot to \a overshoot.-
1192-
1193 0 produces no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent.-
1194-
1195 \sa overshoot()-
1196*/-
1197void QEasingCurve::setOvershoot(qreal overshoot)-
1198{-
1199 if (!d_ptr->config)
!d_ptr->configDescription
TRUEnever evaluated
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
0-17
1200 d_ptr->config = curveToFunctionObject(d_ptr->type);
never executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
0
1201 d_ptr->config->_o = overshoot;-
1202}
executed 17 times by 2 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
17
1203-
1204/*!-
1205 Adds a segment of a cubic bezier spline to define a custom easing curve.-
1206 It is only applicable if type() is QEasingCurve::BezierSpline.-
1207 Note that the spline implicitly starts at (0.0, 0.0) and has to end at (1.0, 1.0) to-
1208 be a valid easing curve.-
1209 \a c1 and \a c2 are the control points used for drawing the curve.-
1210 \a endPoint is the endpoint of the curve.-
1211 */-
1212void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint)-
1213{-
1214 if (!d_ptr->config)
!d_ptr->configDescription
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-11
1215 d_ptr->config = curveToFunctionObject(d_ptr->type);
never executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
0
1216 d_ptr->config->_bezierCurves << c1 << c2 << endPoint;-
1217}
executed 11 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
11
1218-
1219QVector<QPointF> static inline tcbToBezier(const TCBPoints &tcbPoints)-
1220{-
1221 const int count = tcbPoints.count();-
1222 QVector<QPointF> bezierPoints;-
1223 bezierPoints.reserve(3 * (count - 1));-
1224-
1225 for (int i = 1; i < count; i++) {
i < countDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
4-8
1226 const qreal t_0 = tcbPoints.at(i - 1)._t;-
1227 const qreal c_0 = tcbPoints.at(i - 1)._c;-
1228 qreal b_0 = -1;-
1229-
1230 qreal const t_1 = tcbPoints.at(i)._t;-
1231 qreal const c_1 = tcbPoints.at(i)._c;-
1232 qreal b_1 = 1;-
1233-
1234 QPointF c_minusOne; //P1 last segment - not available for the first point-
1235 const QPointF c0(tcbPoints.at(i - 1)._point); //P0 Hermite/TBC-
1236 const QPointF c3(tcbPoints.at(i)._point); //P1 Hermite/TBC-
1237 QPointF c4; //P0 next segment - not available for the last point-
1238-
1239 if (i > 1) { //first point no left tangent
i > 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
4
1240 c_minusOne = tcbPoints.at(i - 2)._point;-
1241 b_0 = tcbPoints.at(i - 1)._b;-
1242 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
4
1243-
1244 if (i < (count - 1)) { //last point no right tangent
i < (count - 1)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
4
1245 c4 = tcbPoints.at(i + 1)._point;-
1246 b_1 = tcbPoints.at(i)._b;-
1247 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
4
1248-
1249 const qreal dx_0 = 0.5 * (1-t_0) * ((1 + b_0) * (1 + c_0) * (c0.x() - c_minusOne.x()) + (1- b_0) * (1 - c_0) * (c3.x() - c0.x()));-
1250 const qreal dy_0 = 0.5 * (1-t_0) * ((1 + b_0) * (1 + c_0) * (c0.y() - c_minusOne.y()) + (1- b_0) * (1 - c_0) * (c3.y() - c0.y()));-
1251-
1252 const qreal dx_1 = 0.5 * (1-t_1) * ((1 + b_1) * (1 - c_1) * (c3.x() - c0.x()) + (1 - b_1) * (1 + c_1) * (c4.x() - c3.x()));-
1253 const qreal dy_1 = 0.5 * (1-t_1) * ((1 + b_1) * (1 - c_1) * (c3.y() - c0.y()) + (1 - b_1) * (1 + c_1) * (c4.y() - c3.y()));-
1254-
1255 const QPointF d_0 = QPointF(dx_0, dy_0);-
1256 const QPointF d_1 = QPointF(dx_1, dy_1);-
1257-
1258 QPointF c1 = (3 * c0 + d_0) / 3;-
1259 QPointF c2 = (3 * c3 - d_1) / 3;-
1260 bezierPoints << c1 << c2 << c3;-
1261 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
8
1262 return bezierPoints;
executed 4 times by 1 test: return bezierPoints;
Executed by:
  • tst_QEasingCurve
4
1263}-
1264-
1265/*!-
1266 Adds a segment of a TCB bezier spline to define a custom easing curve.-
1267 It is only applicable if type() is QEasingCurve::TCBSpline.-
1268 The spline has to start explitly at (0.0, 0.0) and has to end at (1.0, 1.0) to-
1269 be a valid easing curve.-
1270 The tension \a t changes the length of the tangent vector.-
1271 The continuity \a c changes the sharpness in change between the tangents.-
1272 The bias \a b changes the direction of the tangent vector.-
1273 \a nextPoint is the sample position.-
1274 All three parameters are valid between -1 and 1 and define the-
1275 tangent of the control point.-
1276 If all three parameters are 0 the resulting spline is a Catmull-Rom spline.-
1277 The begin and endpoint always have a bias of -1 and 1, since the outer tangent is not defined.-
1278 */-
1279void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b)-
1280{-
1281 if (!d_ptr->config)
!d_ptr->configDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QEasingCurve
0-12
1282 d_ptr->config = curveToFunctionObject(d_ptr->type);
never executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
0
1283-
1284 d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c ,b));-
1285-
1286 if (nextPoint == QPointF(1.0, 1.0)) {
nextPoint == QPointF(1.0, 1.0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QEasingCurve
4-8
1287 d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints);-
1288 d_ptr->config->_tcbPoints.clear();-
1289 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
4
1290-
1291}
executed 12 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
12
1292-
1293/*!-
1294 \fn QList<QPointF> QEasingCurve::cubicBezierSpline() const-
1295 \obsolete Use toCubicSpline() instead.-
1296 */-
1297-
1298/*!-
1299 \since 5.0-
1300-
1301 Returns the cubicBezierSpline that defines a custom easing curve.-
1302 If the easing curve does not have a custom bezier easing curve the list-
1303 is empty.-
1304*/-
1305QVector<QPointF> QEasingCurve::toCubicSpline() const-
1306{-
1307 return d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>();
never executed: return d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>();
d_ptr->configDescription
TRUEnever evaluated
FALSEnever evaluated
0
1308}-
1309-
1310/*!-
1311 Returns the type of the easing curve.-
1312*/-
1313QEasingCurve::Type QEasingCurve::type() const-
1314{-
1315 return d_ptr->type;
executed 40 times by 3 tests: return d_ptr->type;
Executed by:
  • tst_QEasingCurve
  • tst_QScroller
  • tst_QTimeLine
40
1316}-
1317-
1318void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType)-
1319{-
1320 qreal amp = -1.0;-
1321 qreal period = -1.0;-
1322 qreal overshoot = -1.0;-
1323 QVector<QPointF> bezierCurves;-
1324 QVector<TCBPoint> tcbPoints;-
1325-
1326 if (config) {
configDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1834 times by 43 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
10-1834
1327 amp = config->_a;-
1328 period = config->_p;-
1329 overshoot = config->_o;-
1330 bezierCurves = config->_bezierCurves;-
1331 tcbPoints = config->_tcbPoints;-
1332-
1333 delete config;-
1334 config = 0;-
1335 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QEasingCurve
10
1336-
1337 if (isConfigFunction(newType) || (amp != -1.0) || (period != -1.0) || (overshoot != -1.0) ||
isConfigFunction(newType)Description
TRUEevaluated 86 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
FALSEevaluated 1758 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • ...
(amp != -1.0)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1753 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • ...
(period != -1.0)Description
TRUEnever evaluated
FALSEevaluated 1753 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • ...
(overshoot != -1.0)Description
TRUEnever evaluated
FALSEevaluated 1753 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • ...
0-1758
1338 !bezierCurves.isEmpty()) {
!bezierCurves.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1753 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • ...
0-1753
1339 config = curveToFunctionObject(newType);-
1340 if (amp != -1.0)
amp != -1.0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
10-81
1341 config->_a = amp;
executed 10 times by 1 test: config->_a = amp;
Executed by:
  • tst_QEasingCurve
10
1342 if (period != -1.0)
period != -1.0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
10-81
1343 config->_p = period;
executed 10 times by 1 test: config->_p = period;
Executed by:
  • tst_QEasingCurve
10
1344 if (overshoot != -1.0)
overshoot != -1.0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
10-81
1345 config->_o = overshoot;
executed 10 times by 1 test: config->_o = overshoot;
Executed by:
  • tst_QEasingCurve
10
1346 config->_bezierCurves = bezierCurves;-
1347 config->_tcbPoints = tcbPoints;-
1348 func = 0;-
1349 } else if (newType != QEasingCurve::Custom) {
executed 91 times by 3 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QEasingCurve
  • tst_QMetaType
newType != QEa...gCurve::CustomDescription
TRUEevaluated 1746 times by 41 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QScroller
  • ...
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QEasingCurve
  • tst_QPropertyAnimation
7-1746
1350 func = curveToFunc(newType);-
1351 }
executed 1746 times by 41 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QScroller
  • ...
1746
1352 Q_ASSERT((func == 0) == (config != 0));-
1353 type = newType;-
1354}
executed 1844 times by 43 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
1844
1355-
1356/*!-
1357 Sets the type of the easing curve to \a type.-
1358*/-
1359void QEasingCurve::setType(Type type)-
1360{-
1361 if (d_ptr->type == type)
d_ptr->type == typeDescription
TRUEevaluated 2200 times by 48 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QParallelAnimationGroup
  • ...
FALSEevaluated 1842 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
1842-2200
1362 return;
executed 2200 times by 48 tests: return;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QParallelAnimationGroup
  • ...
2200
1363 if (type < Linear || type >= NCurveTypes - 1) {
type < LinearDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1840 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
type >= NCurveTypes - 1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEevaluated 1837 times by 42 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
2-1840
1364 qWarning("QEasingCurve: Invalid curve type %d", type);-
1365 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QEasingCurve
5
1366 }-
1367-
1368 d_ptr->setType_helper(type);-
1369}
executed 1837 times by 42 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataStream
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItemAnimation
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMetaType
  • tst_QPrinter
  • ...
1837
1370-
1371/*!-
1372 Sets a custom easing curve that is defined by the user in the function \a func.-
1373 The signature of the function is qreal myEasingFunction(qreal progress),-
1374 where \e progress and the return value are considered to be normalized between 0 and 1.-
1375 (In some cases the return value can be outside that range)-
1376 After calling this function type() will return QEasingCurve::Custom.-
1377 \a func cannot be zero.-
1378-
1379 \sa customType()-
1380 \sa valueForProgress()-
1381*/-
1382void QEasingCurve::setCustomType(EasingFunction func)-
1383{-
1384 if (!func) {
!funcDescription
TRUEnever evaluated
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QEasingCurve
  • tst_QPropertyAnimation
0-7
1385 qWarning("Function pointer must not be null");-
1386 return;
never executed: return;
0
1387 }-
1388 d_ptr->func = func;-
1389 d_ptr->setType_helper(Custom);-
1390}
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QEasingCurve
  • tst_QPropertyAnimation
7
1391-
1392/*!-
1393 Returns the function pointer to the custom easing curve.-
1394 If type() does not return QEasingCurve::Custom, this function-
1395 will return 0.-
1396*/-
1397QEasingCurve::EasingFunction QEasingCurve::customType() const-
1398{-
1399 return d_ptr->type == Custom ? d_ptr->func : 0;
never executed: return d_ptr->type == Custom ? d_ptr->func : 0;
d_ptr->type == CustomDescription
TRUEnever evaluated
FALSEnever evaluated
0
1400}-
1401-
1402/*!-
1403 Return the effective progress for the easing curve at \a progress.-
1404 Whereas \a progress must be between 0 and 1, the returned effective progress-
1405 can be outside those bounds. For example, QEasingCurve::InBack will-
1406 return negative values in the beginning of the function.-
1407 */-
1408qreal QEasingCurve::valueForProgress(qreal progress) const-
1409{-
1410 progress = qBound<qreal>(0, progress, 1);-
1411 if (d_ptr->func)
d_ptr->funcDescription
TRUEevaluated 13107 times by 30 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QScroller
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QTimeLine
  • tst_QToolBar
  • tst_QTreeView
  • ...
FALSEevaluated 181 times by 1 test
Evaluated by:
  • tst_QEasingCurve
181-13107
1412 return d_ptr->func(progress);
executed 13107 times by 30 tests: return d_ptr->func(progress);
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QEasingCurve
  • tst_QGraphicsLayout
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QScroller
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QTimeLine
  • tst_QToolBar
  • tst_QTreeView
  • ...
13107
1413 else if (d_ptr->config)
d_ptr->configDescription
TRUEevaluated 181 times by 1 test
Evaluated by:
  • tst_QEasingCurve
FALSEnever evaluated
0-181
1414 return d_ptr->config->value(progress);
executed 181 times by 1 test: return d_ptr->config->value(progress);
Executed by:
  • tst_QEasingCurve
181
1415 else-
1416 return progress;
never executed: return progress;
0
1417}-
1418-
1419#ifndef QT_NO_DEBUG_STREAM-
1420QDebug operator<<(QDebug debug, const QEasingCurve &item)-
1421{-
1422 QDebugStateSaver saver(debug);-
1423 debug << "type:" << item.d_ptr->type-
1424 << "func:" << item.d_ptr->func;-
1425 if (item.d_ptr->config) {
item.d_ptr->configDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QVariant
0-1
1426 debug << QString::fromLatin1("period:%1").arg(item.d_ptr->config->_p, 0, 'f', 20)-
1427 << QString::fromLatin1("amp:%1").arg(item.d_ptr->config->_a, 0, 'f', 20)-
1428 << QString::fromLatin1("overshoot:%1").arg(item.d_ptr->config->_o, 0, 'f', 20);-
1429 }
never executed: end of block
0
1430 return debug;
executed 1 time by 1 test: return debug;
Executed by:
  • tst_QVariant
1
1431}-
1432#endif // QT_NO_DEBUG_STREAM-
1433-
1434#ifndef QT_NO_DATASTREAM-
1435/*!-
1436 \fn QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing)-
1437 \relates QEasingCurve-
1438-
1439 Writes the given \a easing curve to the given \a stream and returns a-
1440 reference to the stream.-
1441-
1442 \sa {Serializing Qt Data Types}-
1443*/-
1444-
1445QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing)-
1446{-
1447 stream << quint8(easing.d_ptr->type);-
1448 stream << quint64(quintptr(easing.d_ptr->func));-
1449-
1450 bool hasConfig = easing.d_ptr->config;-
1451 stream << hasConfig;-
1452 if (hasConfig) {
hasConfigDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 31 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
18-31
1453 stream << easing.d_ptr->config->_p;-
1454 stream << easing.d_ptr->config->_a;-
1455 stream << easing.d_ptr->config->_o;-
1456 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_QDataStream
18
1457 return stream;
executed 49 times by 2 tests: return stream;
Executed by:
  • tst_QDataStream
  • tst_QMetaType
49
1458}-
1459-
1460/*!-
1461 \fn QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)-
1462 \relates QEasingCurve-
1463-
1464 Reads an easing curve from the given \a stream into the given \a-
1465 easing curve and returns a reference to the stream.-
1466-
1467 \sa {Serializing Qt Data Types}-
1468*/-
1469-
1470QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)-
1471{-
1472 QEasingCurve::Type type;-
1473 quint8 int_type;-
1474 stream >> int_type;-
1475 type = static_cast<QEasingCurve::Type>(int_type);-
1476 easing.setType(type);-
1477-
1478 quint64 ptr_func;-
1479 stream >> ptr_func;-
1480 easing.d_ptr->func = QEasingCurve::EasingFunction(quintptr(ptr_func));-
1481-
1482 bool hasConfig;-
1483 stream >> hasConfig;-
1484 delete easing.d_ptr->config;-
1485 easing.d_ptr->config = Q_NULLPTR;-
1486 if (hasConfig) {
hasConfigDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaType
18-33
1487 QEasingCurveFunction *config = curveToFunctionObject(type);-
1488 stream >> config->_p;-
1489 stream >> config->_a;-
1490 stream >> config->_o;-
1491 easing.d_ptr->config = config;-
1492 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_QDataStream
18
1493 return stream;
executed 51 times by 2 tests: return stream;
Executed by:
  • tst_QDataStream
  • tst_QMetaType
51
1494}-
1495#endif // QT_NO_DATASTREAM-
1496-
1497QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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