| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qeasingcurve.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||||||||
| 11 | static bool isConfigFunction(QEasingCurve::Type type) | - | ||||||||||||||||||||||||||||||||||||||||||
| 12 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 13 | return executed 1846 times by 43 tests: (type >= QEasingCurve::InElasticreturn (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;Executed by:
executed 1846 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;Executed by:
| 1846 | ||||||||||||||||||||||||||||||||||||||||||
| 14 | && type <= QEasingCurve::OutInBounce) || executed 1846 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;Executed by:
| 1846 | ||||||||||||||||||||||||||||||||||||||||||
| 15 | type == QEasingCurve::BezierSpline || executed 1846 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;Executed by:
| 1846 | ||||||||||||||||||||||||||||||||||||||||||
| 16 | type == QEasingCurve::TCBSpline; executed 1846 times by 43 tests: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;Executed by:
| 1846 | ||||||||||||||||||||||||||||||||||||||||||
| 17 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||||||||||||||||||||
| 19 | struct TCBPoint { | - | ||||||||||||||||||||||||||||||||||||||||||
| 20 | QPointF _point; | - | ||||||||||||||||||||||||||||||||||||||||||
| 21 | qreal _t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 22 | qreal _c; | - | ||||||||||||||||||||||||||||||||||||||||||
| 23 | qreal _b; | - | ||||||||||||||||||||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||||||||||||||||||||
| 25 | TCBPoint() {} | - | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 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 blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||||||||||||||||||||
| 28 | bool operator==(const TCBPoint &other) const | - | ||||||||||||||||||||||||||||||||||||||||||
| 29 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 30 | return never executed: _point == other._point &&return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 31 | qFuzzyCompare(_t, other._t) && never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 32 | qFuzzyCompare(_c, other._c) && never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 33 | qFuzzyCompare(_b, other._b); never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 35 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 36 | template<> class QTypeInfo<TCBPoint > { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_PRIMITIVE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(TCBPoint)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< TCBPoint >::value, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(TCBPoint) }; static inline const char *name() { return "TCBPoint"; } }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||||||||||||||||||||
| 39 | typedef QVector<TCBPoint> TCBPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||||||||||||||||||||
| 41 | class QEasingCurveFunction | - | ||||||||||||||||||||||||||||||||||||||||||
| 42 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 43 | public: | - | ||||||||||||||||||||||||||||||||||||||||||
| 44 | QEasingCurveFunction(QEasingCurve::Type type, qreal period = 0.3, qreal amplitude = 1.0, | - | ||||||||||||||||||||||||||||||||||||||||||
| 45 | qreal overshoot = 1.70158) | - | ||||||||||||||||||||||||||||||||||||||||||
| 46 | : _t(type), _p(period), _a(amplitude), _o(overshoot) | - | ||||||||||||||||||||||||||||||||||||||||||
| 47 | { } executed 122 times by 3 tests: end of blockExecuted by:
| 122 | ||||||||||||||||||||||||||||||||||||||||||
| 48 | virtual ~QEasingCurveFunction() {} | - | ||||||||||||||||||||||||||||||||||||||||||
| 49 | virtual qreal value(qreal t); | - | ||||||||||||||||||||||||||||||||||||||||||
| 50 | virtual QEasingCurveFunction *copy() const; | - | ||||||||||||||||||||||||||||||||||||||||||
| 51 | bool operator==(const QEasingCurveFunction &other) const; | - | ||||||||||||||||||||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||||||||||||||||||||
| 53 | QEasingCurve::Type _t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 54 | qreal _p; | - | ||||||||||||||||||||||||||||||||||||||||||
| 55 | qreal _a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 56 | qreal _o; | - | ||||||||||||||||||||||||||||||||||||||||||
| 57 | QVector<QPointF> _bezierCurves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 58 | TCBPoints _tcbPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||||||||||||||
| 60 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||||||||||||||
| 62 | static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve); | - | ||||||||||||||||||||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||||||||||||||||||||
| 64 | qreal QEasingCurveFunction::value(qreal t) | - | ||||||||||||||||||||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 66 | QEasingCurve::EasingFunction func = curveToFunc(_t); | - | ||||||||||||||||||||||||||||||||||||||||||
| 67 | return executed 2 times by 1 test: func(t);return func(t);Executed by:
executed 2 times by 1 test: return func(t);Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 68 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||||||||||||||||||||
| 70 | QEasingCurveFunction *QEasingCurveFunction::copy() const | - | ||||||||||||||||||||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 72 | QEasingCurveFunction *rv = new QEasingCurveFunction(_t, _p, _a, _o); | - | ||||||||||||||||||||||||||||||||||||||||||
| 73 | rv->_bezierCurves = _bezierCurves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 74 | rv->_tcbPoints = _tcbPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 75 | return never executed: rv;return rv;never executed: return rv; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 76 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||||||||||||||||||||
| 78 | bool QEasingCurveFunction::operator==(const QEasingCurveFunction &other) const | - | ||||||||||||||||||||||||||||||||||||||||||
| 79 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 80 | return executed 27 times by 3 tests: _t == other._t &&return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;Executed by:
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:
| 27 | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 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:
| 27 | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 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:
| 27 | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 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:
| 27 | ||||||||||||||||||||||||||||||||||||||||||
| 84 | _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:
| 27 | ||||||||||||||||||||||||||||||||||||||||||
| 85 | _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:
| 27 | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||||||||||||||||||||
| 91 | class QEasingCurvePrivate | - | ||||||||||||||||||||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 93 | public: | - | ||||||||||||||||||||||||||||||||||||||||||
| 94 | QEasingCurvePrivate() | - | ||||||||||||||||||||||||||||||||||||||||||
| 95 | : type(QEasingCurve::Linear), | - | ||||||||||||||||||||||||||||||||||||||||||
| 96 | config(0), | - | ||||||||||||||||||||||||||||||||||||||||||
| 97 | func(&easeNone) | - | ||||||||||||||||||||||||||||||||||||||||||
| 98 | { } executed 3877 times by 50 tests: end of blockExecuted by:
| 3877 | ||||||||||||||||||||||||||||||||||||||||||
| 99 | QEasingCurvePrivate(const QEasingCurvePrivate &other) | - | ||||||||||||||||||||||||||||||||||||||||||
| 100 | : type(other.type), | - | ||||||||||||||||||||||||||||||||||||||||||
| 101 | config(other.config ? other.config->copy() : 0), | - | ||||||||||||||||||||||||||||||||||||||||||
| 102 | func(other.func) | - | ||||||||||||||||||||||||||||||||||||||||||
| 103 | { } executed 1902 times by 41 tests: end of blockExecuted by:
| 1902 | ||||||||||||||||||||||||||||||||||||||||||
| 104 | ~QEasingCurvePrivate() { delete config; } executed 5665 times by 52 tests: end of blockExecuted by:
| 5665 | ||||||||||||||||||||||||||||||||||||||||||
| 105 | void setType_helper(QEasingCurve::Type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||||||||||||||||||||
| 107 | QEasingCurve::Type type; | - | ||||||||||||||||||||||||||||||||||||||||||
| 108 | QEasingCurveFunction *config; | - | ||||||||||||||||||||||||||||||||||||||||||
| 109 | QEasingCurve::EasingFunction func; | - | ||||||||||||||||||||||||||||||||||||||||||
| 110 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||||||||||||||||||||
| 112 | struct BezierEase : public QEasingCurveFunction | - | ||||||||||||||||||||||||||||||||||||||||||
| 113 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 114 | struct SingleCubicBezier { | - | ||||||||||||||||||||||||||||||||||||||||||
| 115 | qreal p0x, p0y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 116 | qreal p1x, p1y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 117 | qreal p2x, p2y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 118 | qreal p3x, p3y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 119 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||||||||||||||||||||
| 121 | QVector<SingleCubicBezier> _curves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 122 | QVector<qreal> _intervals; | - | ||||||||||||||||||||||||||||||||||||||||||
| 123 | int _curveCount; | - | ||||||||||||||||||||||||||||||||||||||||||
| 124 | bool _init; | - | ||||||||||||||||||||||||||||||||||||||||||
| 125 | bool _valid; | - | ||||||||||||||||||||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||||||||||||||||||||
| 127 | BezierEase(QEasingCurve::Type type = QEasingCurve::BezierSpline) | - | ||||||||||||||||||||||||||||||||||||||||||
| 128 | : QEasingCurveFunction(type), _curves(10), _intervals(10), _init(false), _valid(false) | - | ||||||||||||||||||||||||||||||||||||||||||
| 129 | { } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||||||||||||||||||||
| 131 | void init() | - | ||||||||||||||||||||||||||||||||||||||||||
| 132 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 133 | if (_bezierCurves.constLast() == QPointF(1.0, 1.0)
| 0-7 | ||||||||||||||||||||||||||||||||||||||||||
| 134 | _init = true; | - | ||||||||||||||||||||||||||||||||||||||||||
| 135 | _curveCount = _bezierCurves.count() / 3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||||||||||||||
| 137 | for (int i=0; i < _curveCount
| 7-19 | ||||||||||||||||||||||||||||||||||||||||||
| 138 | _intervals[i] = _bezierCurves.at(i * 3 + 2).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||||||||||||||||||||
| 140 | if (i == 0
| 7-12 | ||||||||||||||||||||||||||||||||||||||||||
| 141 | _curves[0].p0x = 0.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 142 | _curves[0].p0y = 0.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||||||||||||||||||||
| 144 | _curves[0].p1x = _bezierCurves.at(0).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 145 | _curves[0].p1y = _bezierCurves.at(0).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||||||||||||||
| 147 | _curves[0].p2x = _bezierCurves.at(1).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 148 | _curves[0].p2y = _bezierCurves.at(1).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||||||||||||||||||||
| 150 | _curves[0].p3x = _bezierCurves.at(2).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 151 | _curves[0].p3y = _bezierCurves.at(2).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||||||||||||||||||||
| 153 | } executed 7 times by 1 test: else if (i == (_curveCount - 1)end of blockExecuted by:
| 5-7 | ||||||||||||||||||||||||||||||||||||||||||
| 154 | _curves[i].p0x = _bezierCurves.at(_bezierCurves.count() - 4).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 155 | _curves[i].p0y = _bezierCurves.at(_bezierCurves.count() - 4).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||||||||||||||||||||
| 157 | _curves[i].p1x = _bezierCurves.at(_bezierCurves.count() - 3).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 158 | _curves[i].p1y = _bezierCurves.at(_bezierCurves.count() - 3).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||||||||||||||||||||
| 160 | _curves[i].p2x = _bezierCurves.at(_bezierCurves.count() - 2).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 161 | _curves[i].p2y = _bezierCurves.at(_bezierCurves.count() - 2).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||||||||||||||
| 163 | _curves[i].p3x = _bezierCurves.at(_bezierCurves.count() - 1).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 164 | _curves[i].p3y = _bezierCurves.at(_bezierCurves.count() - 1).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } executed 7 times by 1 test: else {end of blockExecuted by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||
| 166 | _curves[i].p0x = _bezierCurves.at(i * 3 - 1).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 167 | _curves[i].p0y = _bezierCurves.at(i * 3 - 1).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||||||||||||||||||||
| 169 | _curves[i].p1x = _bezierCurves.at(i * 3).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 170 | _curves[i].p1y = _bezierCurves.at(i * 3).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||||||||||||||
| 172 | _curves[i].p2x = _bezierCurves.at(i * 3 + 1).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 173 | _curves[i].p2y = _bezierCurves.at(i * 3 + 1).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||||||||||||||||||||
| 175 | _curves[i].p3x = _bezierCurves.at(i * 3 + 2).x(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 176 | _curves[i].p3y = _bezierCurves.at(i * 3 + 2).y(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 177 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||
| 178 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 179 | _valid = true; | - | ||||||||||||||||||||||||||||||||||||||||||
| 180 | } executed 7 times by 1 test: else {end of blockExecuted by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||
| 181 | _valid = false; | - | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 183 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||||||||||||||||||||
| 185 | QEasingCurveFunction *copy() const override | - | ||||||||||||||||||||||||||||||||||||||||||
| 186 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 187 | BezierEase *rv = new BezierEase(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 188 | rv->_t = _t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 189 | rv->_p = _p; | - | ||||||||||||||||||||||||||||||||||||||||||
| 190 | rv->_a = _a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 191 | rv->_o = _o; | - | ||||||||||||||||||||||||||||||||||||||||||
| 192 | rv->_bezierCurves = _bezierCurves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 193 | rv->_tcbPoints = _tcbPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 194 | return never executed: rv;return rv;never executed: return rv; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 195 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||||||||||||||||||||
| 197 | void getBezierSegment(SingleCubicBezier * &singleCubicBezier, qreal x) | - | ||||||||||||||||||||||||||||||||||||||||||
| 198 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||||||||||||||||||||
| 200 | int currentSegment = 0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||||||||||||||||||||
| 202 | while (currentSegment < _curveCount
| 0-88 | ||||||||||||||||||||||||||||||||||||||||||
| 203 | if (x <= _intervals.data()[currentSegment]
| 41-47 | ||||||||||||||||||||||||||||||||||||||||||
| 204 | break; executed 47 times by 1 test: break;Executed by:
| 47 | ||||||||||||||||||||||||||||||||||||||||||
| 205 | currentSegment++; | - | ||||||||||||||||||||||||||||||||||||||||||
| 206 | } executed 41 times by 1 test: end of blockExecuted by:
| 41 | ||||||||||||||||||||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||||||||||||||||||||
| 208 | singleCubicBezier = &_curves.data()[currentSegment]; | - | ||||||||||||||||||||||||||||||||||||||||||
| 209 | } executed 47 times by 1 test: end of blockExecuted by:
| 47 | ||||||||||||||||||||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||||||||||||||||||||
| 212 | qreal static inline newtonIteration(const SingleCubicBezier &singleCubicBezier, qreal t, qreal x) | - | ||||||||||||||||||||||||||||||||||||||||||
| 213 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 214 | qreal currentXValue = evaluateForX(singleCubicBezier, t); | - | ||||||||||||||||||||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||||||||||||||||||||
| 216 | const qreal newT = t - (currentXValue - x) / evaluateDerivateForX(singleCubicBezier, t); | - | ||||||||||||||||||||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||||||||||||||||||||
| 218 | return never executed: newT;return newT;never executed: return newT; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 219 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||||||||||||||
| 221 | qreal value(qreal x) override | - | ||||||||||||||||||||||||||||||||||||||||||
| 222 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 223 | ((!(_bezierCurves.count() % 3 == 0)) ? qt_assert("_bezierCurves.count() % 3 == 0",__FILE__,537) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||||||||||||||||||||
| 225 | if (_bezierCurves.isEmpty()
| 0-47 | ||||||||||||||||||||||||||||||||||||||||||
| 226 | return never executed: x;return x;never executed: return x; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 227 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||||||||||||||||||||
| 229 | if (!_init
| 7-40 | ||||||||||||||||||||||||||||||||||||||||||
| 230 | init(); executed 7 times by 1 test: init();Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||||||||||||||||||||
| 232 | if (!_valid
| 0-47 | ||||||||||||||||||||||||||||||||||||||||||
| 233 | QMessageLogger(__FILE__, 547, __PRETTY_FUNCTION__).warning("QEasingCurve: Invalid bezier curve"); | - | ||||||||||||||||||||||||||||||||||||||||||
| 234 | return never executed: x;return x;never executed: return x; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 236 | SingleCubicBezier *singleCubicBezier = 0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 237 | getBezierSegment(singleCubicBezier, x); | - | ||||||||||||||||||||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||||||||||||||||||||
| 239 | return executed 47 times by 1 test: evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));Executed by:
executed 47 times by 1 test: return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));Executed by:
| 47 | ||||||||||||||||||||||||||||||||||||||||||
| 240 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||||||||||||||||||||
| 242 | qreal static inline evaluateSegmentForY(const SingleCubicBezier &singleCubicBezier, qreal t) | - | ||||||||||||||||||||||||||||||||||||||||||
| 243 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 244 | const qreal p0 = singleCubicBezier.p0y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 245 | const qreal p1 = singleCubicBezier.p1y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 246 | const qreal p2 = singleCubicBezier.p2y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 247 | const qreal p3 = singleCubicBezier.p3y; | - | ||||||||||||||||||||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||||||||||||||||||||
| 249 | const qreal s = 1 - t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||||||||||||||||||||
| 251 | const qreal s_squared = s*s; | - | ||||||||||||||||||||||||||||||||||||||||||
| 252 | const qreal t_squared = t*t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||||||||||||||||||||
| 254 | const qreal s_cubic = s_squared * s; | - | ||||||||||||||||||||||||||||||||||||||||||
| 255 | const qreal t_cubic = t_squared * t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||||||||||||||||||||
| 257 | return executed 47 times by 1 test: s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;Executed by:
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:
| 47 | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||||||||||||||||||||
| 260 | qreal static inline evaluateForX(const SingleCubicBezier &singleCubicBezier, qreal t) | - | ||||||||||||||||||||||||||||||||||||||||||
| 261 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 262 | const qreal p0 = singleCubicBezier.p0x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 263 | const qreal p1 = singleCubicBezier.p1x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 264 | const qreal p2 = singleCubicBezier.p2x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 265 | const qreal p3 = singleCubicBezier.p3x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||||||||||||||||||||
| 267 | const qreal s = 1 - t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||||||||||||||||||||
| 269 | const qreal s_squared = s*s; | - | ||||||||||||||||||||||||||||||||||||||||||
| 270 | const qreal t_squared = t*t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||||||||||||||||||||
| 272 | const qreal s_cubic = s_squared * s; | - | ||||||||||||||||||||||||||||||||||||||||||
| 273 | const qreal t_cubic = t_squared * t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||||||||||||||||||||
| 275 | return never executed: s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;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 | ||||||||||||||||||||||||||||||||||||||||||
| 276 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||||||||||||||
| 278 | qreal static inline evaluateDerivateForX(const SingleCubicBezier &singleCubicBezier, qreal t) | - | ||||||||||||||||||||||||||||||||||||||||||
| 279 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 280 | const qreal p0 = singleCubicBezier.p0x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 281 | const qreal p1 = singleCubicBezier.p1x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 282 | const qreal p2 = singleCubicBezier.p2x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 283 | const qreal p3 = singleCubicBezier.p3x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||||||||||||||||||||
| 285 | const qreal t_squared = t*t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||||||||||||||||||||
| 287 | return never executed: -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;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 | ||||||||||||||||||||||||||||||||||||||||||
| 288 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||||||||||||||||||||
| 290 | qreal static inline _cbrt(qreal d) | - | ||||||||||||||||||||||||||||||||||||||||||
| 291 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 292 | qreal sign = 1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 293 | if (d < 0
| 10-14 | ||||||||||||||||||||||||||||||||||||||||||
| 294 | sign = -1; executed 14 times by 1 test: sign = -1;Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||||||||
| 295 | d = d * sign; | - | ||||||||||||||||||||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||||||||||||||||||||
| 297 | qreal t = _fast_cbrt(d); | - | ||||||||||||||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||||||||||||||||||||
| 300 | const qreal t_cubic = t * t * t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 301 | const qreal f = t_cubic + t_cubic + d; | - | ||||||||||||||||||||||||||||||||||||||||||
| 302 | if (f != qreal(0.0)
| 0-24 | ||||||||||||||||||||||||||||||||||||||||||
| 303 | t = t * (t_cubic + d + d) / f; executed 24 times by 1 test: t = t * (t_cubic + d + d) / f;Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||||||||||||||||||||
| 310 | return executed 24 times by 1 test: t * sign;return t * sign;Executed by:
executed 24 times by 1 test: return t * sign;Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||||||||
| 311 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||||||||||||||||||||
| 313 | float static inline _fast_cbrt(float x) | - | ||||||||||||||||||||||||||||||||||||||||||
| 314 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 315 | union { | - | ||||||||||||||||||||||||||||||||||||||||||
| 316 | float f; | - | ||||||||||||||||||||||||||||||||||||||||||
| 317 | quint32 i; | - | ||||||||||||||||||||||||||||||||||||||||||
| 318 | } ux; | - | ||||||||||||||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||||||||||||||
| 320 | const unsigned int B1 = 709921077; | - | ||||||||||||||||||||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||||||||||||||||||||
| 322 | ux.f = x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 323 | ux.i = (ux.i / 3 + B1); | - | ||||||||||||||||||||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||||||||||||||||||||
| 325 | return never executed: ux.f;return ux.f;never executed: return ux.f; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 326 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||||||||||||||
| 328 | double static inline _fast_cbrt(double d) | - | ||||||||||||||||||||||||||||||||||||||||||
| 329 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 330 | union { | - | ||||||||||||||||||||||||||||||||||||||||||
| 331 | double d; | - | ||||||||||||||||||||||||||||||||||||||||||
| 332 | quint32 pt[2]; | - | ||||||||||||||||||||||||||||||||||||||||||
| 333 | } ut, ux; | - | ||||||||||||||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||||||||||||||
| 335 | const unsigned int B1 = 715094163; | - | ||||||||||||||||||||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||||||||||||||
| 338 | const int h0 = 1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||||||||||||||||||||
| 342 | ut.d = 0.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 343 | ux.d = d; | - | ||||||||||||||||||||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||||||||||||||||||||
| 345 | quint32 hx = ux.pt[h0]; | - | ||||||||||||||||||||||||||||||||||||||||||
| 346 | ut.pt[h0] = hx / 3 + B1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||||||||||||||||||||
| 348 | return executed 24 times by 1 test: ut.d;return ut.d;Executed by:
executed 24 times by 1 test: return ut.d;Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||||||||
| 349 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||||||||||||||||||||
| 351 | qreal static inline _acos(qreal x) | - | ||||||||||||||||||||||||||||||||||||||||||
| 352 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 353 | return never executed: std::sqrt(1-x)*(1.5707963267948966192313216916398f + x*(-0.213300989f + x*(0.077980478f + x*-0.02164095f)));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 | ||||||||||||||||||||||||||||||||||||||||||
| 354 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||||||||||||||||||||
| 356 | qreal static inline _cos(qreal x) | - | ||||||||||||||||||||||||||||||||||||||||||
| 357 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 358 | const qreal pi_times2 = 2 * 3.14159265358979323846; | - | ||||||||||||||||||||||||||||||||||||||||||
| 359 | const qreal pi_neg = -1 * 3.14159265358979323846; | - | ||||||||||||||||||||||||||||||||||||||||||
| 360 | const qreal pi_by2 = 3.14159265358979323846 / 2.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||||||||||||||||||||
| 362 | x += pi_by2; | - | ||||||||||||||||||||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||||||||||||||||||||
| 364 | if (x < pi_neg
| 0 | ||||||||||||||||||||||||||||||||||||||||||
| 365 | x += pi_times2; never executed: x += pi_times2; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 366 | else if (x > 3.14159265358979323846
| 0 | ||||||||||||||||||||||||||||||||||||||||||
| 367 | x -= pi_times2; never executed: x -= pi_times2; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||||||||||||||||||||
| 369 | const qreal a = 0.405284735; | - | ||||||||||||||||||||||||||||||||||||||||||
| 370 | const qreal b = 1.27323954; | - | ||||||||||||||||||||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||||||||||||||||||||
| 372 | const qreal x_squared = x * x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||||||||||||||||||||
| 374 | if (x < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||
| 375 | qreal cos = b * x + a * x_squared; | - | ||||||||||||||||||||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||||||||||||||||||||
| 377 | if (cos < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||
| 378 | return never executed: 0.225 * (cos * -1 * cos - cos) + cos;return 0.225 * (cos * -1 * cos - cos) + cos;never executed: return 0.225 * (cos * -1 * cos - cos) + cos; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 379 | return never executed: 0.225 * (cos * cos - cos) + cos;return 0.225 * (cos * cos - cos) + cos;never executed: return 0.225 * (cos * cos - cos) + cos; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 380 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||||||||||||||||||||
| 382 | qreal cos = b * x - a * x_squared; | - | ||||||||||||||||||||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||||||||||||||||||||
| 384 | if (cos < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||
| 385 | return never executed: 0.225 * (cos * 1 *-cos - cos) + cos;return 0.225 * (cos * 1 *-cos - cos) + cos;never executed: return 0.225 * (cos * 1 *-cos - cos) + cos; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 386 | return never executed: 0.225 * (cos * cos - cos) + cos;return 0.225 * (cos * cos - cos) + cos;never executed: return 0.225 * (cos * cos - cos) + cos; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 387 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||||||||||||||||||||
| 389 | bool static inline inRange(qreal f) | - | ||||||||||||||||||||||||||||||||||||||||||
| 390 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 391 | return executed 40 times by 1 test: (f >= -0.01 && f <= 1.01);return (f >= -0.01 && f <= 1.01);Executed by:
executed 40 times by 1 test: return (f >= -0.01 && f <= 1.01);Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||||||||
| 392 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||||||||||||||||||||
| 394 | void static inline cosacos(qreal x, qreal &s1, qreal &s2, qreal &s3 ) | - | ||||||||||||||||||||||||||||||||||||||||||
| 395 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||||||||||||||
| 399 | const qreal x_squared = x * x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 400 | const qreal x_plus_one_sqrt = qSqrt(1.0 + x); | - | ||||||||||||||||||||||||||||||||||||||||||
| 401 | const qreal one_minus_x_sqrt = qSqrt(1.0 - x); | - | ||||||||||||||||||||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||||||||||||||
| 405 | s1 = 0.463614 - 0.0347815 * x + 0.00218245 * x_squared + 0.402421 * x_plus_one_sqrt; | - | ||||||||||||||||||||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||||||||||||||||||||
| 409 | s3 = 0.463614 + 0.402421 * one_minus_x_sqrt + 0.0347815 * x + 0.00218245 * x_squared; | - | ||||||||||||||||||||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||||||||||||||||||||
| 413 | s2 = -0.401644 * one_minus_x_sqrt - 0.0686804 * x + 0.401644 * x_plus_one_sqrt; | - | ||||||||||||||||||||||||||||||||||||||||||
| 414 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||||||||||||||||||||
| 416 | qreal static inline singleRealSolutionForCubic(qreal a, qreal b, qreal c) | - | ||||||||||||||||||||||||||||||||||||||||||
| 417 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||||||||||||||||||||
| 424 | if (c < 0.000001
| 7-29 | ||||||||||||||||||||||||||||||||||||||||||
| 425 | return executed 7 times by 1 test: 0;return 0;Executed by:
executed 7 times by 1 test: return 0;Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||||||||||||||||||||
| 427 | const qreal a_by3 = a / 3.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||||||||||||||||||||
| 429 | const qreal a_cubic = a * a * a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||||||||||||||
| 431 | const qreal p = b - a * a_by3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 432 | const qreal q = 2.0 * a_cubic / 27.0 - a * b / 3.0 + c; | - | ||||||||||||||||||||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||||||||||||||||||||
| 434 | const qreal q_squared = q * q; | - | ||||||||||||||||||||||||||||||||||||||||||
| 435 | const qreal p_cubic = p * p * p; | - | ||||||||||||||||||||||||||||||||||||||||||
| 436 | const qreal D = 0.25 * q_squared + p_cubic / 27.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||||||||||||||||||||
| 438 | if (D >= 0
| 12-28 | ||||||||||||||||||||||||||||||||||||||||||
| 439 | const qreal D_sqrt = qSqrt(D); | - | ||||||||||||||||||||||||||||||||||||||||||
| 440 | qreal u = _cbrt( -q * 0.5 + D_sqrt); | - | ||||||||||||||||||||||||||||||||||||||||||
| 441 | qreal v = _cbrt( -q * 0.5 - D_sqrt); | - | ||||||||||||||||||||||||||||||||||||||||||
| 442 | qreal z1 = u + v; | - | ||||||||||||||||||||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||||||||||||||||||||
| 444 | qreal t1 = z1 - a_by3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||||||||||||||||||||
| 446 | if (inRange(t1)
| 1-11 | ||||||||||||||||||||||||||||||||||||||||||
| 447 | return executed 11 times by 1 test: t1;return t1;Executed by:
executed 11 times by 1 test: return t1;Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 448 | qreal z2 = -1 *u; | - | ||||||||||||||||||||||||||||||||||||||||||
| 449 | qreal t2 = z2 - a_by3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 450 | return executed 1 time by 1 test: t2;return t2;Executed by:
executed 1 time by 1 test: return t2;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 451 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||||||||||||||||||||
| 454 | const qreal p_minus_sqrt = qSqrt(-p); | - | ||||||||||||||||||||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||||||||||||||||||||
| 457 | const qreal f = qSqrt(4.0 / 3.0) * p_minus_sqrt; | - | ||||||||||||||||||||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||||||||||||||||||||
| 459 | - | |||||||||||||||||||||||||||||||||||||||||||
| 460 | const qreal sqrtP = -3.0*qSqrt(3.0) / (p_minus_sqrt * p); | - | ||||||||||||||||||||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||||||||||||||||||||
| 463 | const qreal g = -q * 0.5 * sqrtP; | - | ||||||||||||||||||||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||||||||||||||||||||
| 465 | qreal s1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 466 | qreal s2; | - | ||||||||||||||||||||||||||||||||||||||||||
| 467 | qreal s3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||||||||||||||||||||
| 469 | cosacos(g, s1, s2, s3); | - | ||||||||||||||||||||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||||||||||||||||||||
| 471 | qreal z1 = -1* f * s2; | - | ||||||||||||||||||||||||||||||||||||||||||
| 472 | qreal t1 = z1 - a_by3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 473 | if (inRange(t1)
| 0-28 | ||||||||||||||||||||||||||||||||||||||||||
| 474 | return executed 28 times by 1 test: t1;return t1;Executed by:
executed 28 times by 1 test: return t1;Executed by:
| 28 | ||||||||||||||||||||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||||||||||||||||||||
| 476 | qreal z2 = f * s1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 477 | qreal t2 = z2 - a_by3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 478 | if (inRange(t2)
| 0 | ||||||||||||||||||||||||||||||||||||||||||
| 479 | return never executed: t2;return t2;never executed: return t2; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||||||||||||||||||||
| 481 | qreal z3 = -1 * f * s3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 482 | qreal t3 = z3 - a_by3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 483 | return never executed: t3;return t3;never executed: return t3; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 484 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||||||||||||||||||||
| 486 | qreal static inline findTForX(const SingleCubicBezier &singleCubicBezier, qreal x) | - | ||||||||||||||||||||||||||||||||||||||||||
| 487 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 488 | const qreal p0 = singleCubicBezier.p0x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 489 | const qreal p1 = singleCubicBezier.p1x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 490 | const qreal p2 = singleCubicBezier.p2x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 491 | const qreal p3 = singleCubicBezier.p3x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||||||||||||||||||||
| 493 | const qreal factorT3 = p3 - p0 + 3 * p1 - 3 * p2; | - | ||||||||||||||||||||||||||||||||||||||||||
| 494 | const qreal factorT2 = 3 * p0 - 6 * p1 + 3 * p2; | - | ||||||||||||||||||||||||||||||||||||||||||
| 495 | const qreal factorT1 = -3 * p0 + 3 * p1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 496 | const qreal factorT0 = p0 - x; | - | ||||||||||||||||||||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||||||||||||||||||||
| 498 | const qreal a = factorT2 / factorT3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 499 | const qreal b = factorT1 / factorT3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 500 | const qreal c = factorT0 / factorT3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||||||||||||||||||||
| 502 | return executed 47 times by 1 test: singleRealSolutionForCubic(a, b, c);return singleRealSolutionForCubic(a, b, c);Executed by:
executed 47 times by 1 test: return singleRealSolutionForCubic(a, b, c);Executed by:
| 47 | ||||||||||||||||||||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||||||||||||||||||||
| 506 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 507 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||||||||||||||||||||
| 509 | struct TCBEase : public BezierEase | - | ||||||||||||||||||||||||||||||||||||||||||
| 510 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 511 | TCBEase() | - | ||||||||||||||||||||||||||||||||||||||||||
| 512 | : BezierEase(QEasingCurve::TCBSpline) | - | ||||||||||||||||||||||||||||||||||||||||||
| 513 | { } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||||||||||||||||||||
| 515 | qreal value(qreal x) override | - | ||||||||||||||||||||||||||||||||||||||||||
| 516 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 517 | ((!(_bezierCurves.count() % 3 == 0)) ? qt_assert("_bezierCurves.count() % 3 == 0",__FILE__,831) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||||||||||||||||||||
| 519 | if (_bezierCurves.isEmpty()
| 0-28 | ||||||||||||||||||||||||||||||||||||||||||
| 520 | QMessageLogger(__FILE__, 834, __PRETTY_FUNCTION__).warning("QEasingCurve: Invalid tcb curve"); | - | ||||||||||||||||||||||||||||||||||||||||||
| 521 | return never executed: x;return x;never executed: return x; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 522 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||||||||||||||||||||
| 524 | return executed 28 times by 1 test: BezierEase::value(x);return BezierEase::value(x);Executed by:
executed 28 times by 1 test: return BezierEase::value(x);Executed by:
| 28 | ||||||||||||||||||||||||||||||||||||||||||
| 525 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||||||||||||||||||||
| 527 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||||||||||||||||||||
| 529 | struct ElasticEase : public QEasingCurveFunction | - | ||||||||||||||||||||||||||||||||||||||||||
| 530 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 531 | ElasticEase(QEasingCurve::Type type) | - | ||||||||||||||||||||||||||||||||||||||||||
| 532 | : QEasingCurveFunction(type, qreal(0.3), qreal(1.0)) | - | ||||||||||||||||||||||||||||||||||||||||||
| 533 | { } executed 39 times by 3 tests: end of blockExecuted by:
| 39 | ||||||||||||||||||||||||||||||||||||||||||
| 534 | - | |||||||||||||||||||||||||||||||||||||||||||
| 535 | QEasingCurveFunction *copy() const override | - | ||||||||||||||||||||||||||||||||||||||||||
| 536 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 537 | ElasticEase *rv = new ElasticEase(_t); | - | ||||||||||||||||||||||||||||||||||||||||||
| 538 | rv->_p = _p; | - | ||||||||||||||||||||||||||||||||||||||||||
| 539 | rv->_a = _a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 540 | rv->_bezierCurves = _bezierCurves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 541 | rv->_tcbPoints = _tcbPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 542 | return executed 4 times by 1 test: rv;return rv;Executed by:
executed 4 times by 1 test: return rv;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 543 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||||||||||||||
| 545 | qreal value(qreal t) override | - | ||||||||||||||||||||||||||||||||||||||||||
| 546 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 547 | qreal p = (
| 0-44 | ||||||||||||||||||||||||||||||||||||||||||
| 548 | qreal a = (
| 0-44 | ||||||||||||||||||||||||||||||||||||||||||
| 549 | switch(_t) { | - | ||||||||||||||||||||||||||||||||||||||||||
| 550 | case executed 11 times by 1 test: QEasingCurve::InElastic:case QEasingCurve::InElastic:Executed by:
executed 11 times by 1 test: case QEasingCurve::InElastic:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 551 | return executed 11 times by 1 test: easeInElastic(t, a, p);return easeInElastic(t, a, p);Executed by:
executed 11 times by 1 test: return easeInElastic(t, a, p);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 552 | case executed 11 times by 1 test: QEasingCurve::OutElastic:case QEasingCurve::OutElastic:Executed by:
executed 11 times by 1 test: case QEasingCurve::OutElastic:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 553 | return executed 11 times by 1 test: easeOutElastic(t, a, p);return easeOutElastic(t, a, p);Executed by:
executed 11 times by 1 test: return easeOutElastic(t, a, p);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 554 | case executed 11 times by 1 test: QEasingCurve::InOutElastic:case QEasingCurve::InOutElastic:Executed by:
executed 11 times by 1 test: case QEasingCurve::InOutElastic:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 555 | return executed 11 times by 1 test: easeInOutElastic(t, a, p);return easeInOutElastic(t, a, p);Executed by:
executed 11 times by 1 test: return easeInOutElastic(t, a, p);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 556 | case executed 11 times by 1 test: QEasingCurve::OutInElastic:case QEasingCurve::OutInElastic:Executed by:
executed 11 times by 1 test: case QEasingCurve::OutInElastic:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 557 | return executed 11 times by 1 test: easeOutInElastic(t, a, p);return easeOutInElastic(t, a, p);Executed by:
executed 11 times by 1 test: return easeOutInElastic(t, a, p);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 558 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 559 | return never executed: t;return t;never executed: return t; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 560 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 561 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 562 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||||||||||||||||||||
| 564 | struct BounceEase : public QEasingCurveFunction | - | ||||||||||||||||||||||||||||||||||||||||||
| 565 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 566 | BounceEase(QEasingCurve::Type type) | - | ||||||||||||||||||||||||||||||||||||||||||
| 567 | : QEasingCurveFunction(type, qreal(0.3), qreal(1.0)) | - | ||||||||||||||||||||||||||||||||||||||||||
| 568 | { } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||||||||||||||||||||
| 570 | QEasingCurveFunction *copy() const override | - | ||||||||||||||||||||||||||||||||||||||||||
| 571 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 572 | BounceEase *rv = new BounceEase(_t); | - | ||||||||||||||||||||||||||||||||||||||||||
| 573 | rv->_a = _a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 574 | rv->_bezierCurves = _bezierCurves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 575 | rv->_tcbPoints = _tcbPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 576 | return never executed: rv;return rv;never executed: return rv; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 577 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||||||||||||||||||||
| 579 | qreal value(qreal t) override | - | ||||||||||||||||||||||||||||||||||||||||||
| 580 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 581 | qreal a = (
| 0-44 | ||||||||||||||||||||||||||||||||||||||||||
| 582 | switch(_t) { | - | ||||||||||||||||||||||||||||||||||||||||||
| 583 | case executed 11 times by 1 test: QEasingCurve::InBounce:case QEasingCurve::InBounce:Executed by:
executed 11 times by 1 test: case QEasingCurve::InBounce:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 584 | return executed 11 times by 1 test: easeInBounce(t, a);return easeInBounce(t, a);Executed by:
executed 11 times by 1 test: return easeInBounce(t, a);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 585 | case executed 11 times by 1 test: QEasingCurve::OutBounce:case QEasingCurve::OutBounce:Executed by:
executed 11 times by 1 test: case QEasingCurve::OutBounce:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 586 | return executed 11 times by 1 test: easeOutBounce(t, a);return easeOutBounce(t, a);Executed by:
executed 11 times by 1 test: return easeOutBounce(t, a);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 587 | case executed 11 times by 1 test: QEasingCurve::InOutBounce:case QEasingCurve::InOutBounce:Executed by:
executed 11 times by 1 test: case QEasingCurve::InOutBounce:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 588 | return executed 11 times by 1 test: easeInOutBounce(t, a);return easeInOutBounce(t, a);Executed by:
executed 11 times by 1 test: return easeInOutBounce(t, a);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 589 | case executed 11 times by 1 test: QEasingCurve::OutInBounce:case QEasingCurve::OutInBounce:Executed by:
executed 11 times by 1 test: case QEasingCurve::OutInBounce:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 590 | return executed 11 times by 1 test: easeOutInBounce(t, a);return easeOutInBounce(t, a);Executed by:
executed 11 times by 1 test: return easeOutInBounce(t, a);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 591 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 592 | return never executed: t;return t;never executed: return t; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 593 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 594 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 595 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||||||||||||||||||||
| 597 | struct BackEase : public QEasingCurveFunction | - | ||||||||||||||||||||||||||||||||||||||||||
| 598 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 599 | BackEase(QEasingCurve::Type type) | - | ||||||||||||||||||||||||||||||||||||||||||
| 600 | : QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158)) | - | ||||||||||||||||||||||||||||||||||||||||||
| 601 | { } executed 61 times by 2 tests: end of blockExecuted by:
| 61 | ||||||||||||||||||||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||||||||||||||||||||
| 603 | QEasingCurveFunction *copy() const override | - | ||||||||||||||||||||||||||||||||||||||||||
| 604 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 605 | BackEase *rv = new BackEase(_t); | - | ||||||||||||||||||||||||||||||||||||||||||
| 606 | rv->_o = _o; | - | ||||||||||||||||||||||||||||||||||||||||||
| 607 | rv->_bezierCurves = _bezierCurves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 608 | rv->_tcbPoints = _tcbPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 609 | return executed 4 times by 1 test: rv;return rv;Executed by:
executed 4 times by 1 test: return rv;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 610 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||||||||||||||||||||
| 612 | qreal value(qreal t) override | - | ||||||||||||||||||||||||||||||||||||||||||
| 613 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 614 | qreal o = (
| 0-44 | ||||||||||||||||||||||||||||||||||||||||||
| 615 | switch(_t) { | - | ||||||||||||||||||||||||||||||||||||||||||
| 616 | case executed 11 times by 1 test: QEasingCurve::InBack:case QEasingCurve::InBack:Executed by:
executed 11 times by 1 test: case QEasingCurve::InBack:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 617 | return executed 11 times by 1 test: easeInBack(t, o);return easeInBack(t, o);Executed by:
executed 11 times by 1 test: return easeInBack(t, o);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 618 | case executed 11 times by 1 test: QEasingCurve::OutBack:case QEasingCurve::OutBack:Executed by:
executed 11 times by 1 test: case QEasingCurve::OutBack:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 619 | return executed 11 times by 1 test: easeOutBack(t, o);return easeOutBack(t, o);Executed by:
executed 11 times by 1 test: return easeOutBack(t, o);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 620 | case executed 11 times by 1 test: QEasingCurve::InOutBack:case QEasingCurve::InOutBack:Executed by:
executed 11 times by 1 test: case QEasingCurve::InOutBack:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 621 | return executed 11 times by 1 test: easeInOutBack(t, o);return easeInOutBack(t, o);Executed by:
executed 11 times by 1 test: return easeInOutBack(t, o);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 622 | case executed 11 times by 1 test: QEasingCurve::OutInBack:case QEasingCurve::OutInBack:Executed by:
executed 11 times by 1 test: case QEasingCurve::OutInBack:Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 623 | return executed 11 times by 1 test: easeOutInBack(t, o);return easeOutInBack(t, o);Executed by:
executed 11 times by 1 test: return easeOutInBack(t, o);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 624 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 625 | return never executed: t;return t;never executed: return t; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 626 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 627 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 628 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||||||||||||||||||||
| 630 | static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve) | - | ||||||||||||||||||||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 632 | switch(curve) { | - | ||||||||||||||||||||||||||||||||||||||||||
| 633 | case executed 2 times by 1 test: QEasingCurve::Linear:case QEasingCurve::Linear:Executed by:
executed 2 times by 1 test: case QEasingCurve::Linear:Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 634 | return executed 2 times by 1 test: &easeNone;return &easeNone;Executed by:
executed 2 times by 1 test: return &easeNone;Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 635 | case executed 4 times by 3 tests: QEasingCurve::InQuad:case QEasingCurve::InQuad:Executed by:
executed 4 times by 3 tests: case QEasingCurve::InQuad:Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 636 | return executed 4 times by 3 tests: &easeInQuad;return &easeInQuad;Executed by:
executed 4 times by 3 tests: return &easeInQuad;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 637 | case executed 13 times by 2 tests: QEasingCurve::OutQuad:case QEasingCurve::OutQuad:Executed by:
executed 13 times by 2 tests: case QEasingCurve::OutQuad:Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||||||||
| 638 | return executed 13 times by 2 tests: &easeOutQuad;return &easeOutQuad;Executed by:
executed 13 times by 2 tests: return &easeOutQuad;Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||||||||
| 639 | case executed 1610 times by 35 tests: QEasingCurve::InOutQuad:case QEasingCurve::InOutQuad:Executed by:
executed 1610 times by 35 tests: case QEasingCurve::InOutQuad:Executed by:
| 1610 | ||||||||||||||||||||||||||||||||||||||||||
| 640 | return executed 1610 times by 35 tests: &easeInOutQuad;return &easeInOutQuad;Executed by:
executed 1610 times by 35 tests: return &easeInOutQuad;Executed by:
| 1610 | ||||||||||||||||||||||||||||||||||||||||||
| 641 | case executed 1 time by 1 test: QEasingCurve::OutInQuad:case QEasingCurve::OutInQuad:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInQuad:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 642 | return executed 1 time by 1 test: &easeOutInQuad;return &easeOutInQuad;Executed by:
executed 1 time by 1 test: return &easeOutInQuad;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 643 | case executed 2 times by 1 test: QEasingCurve::InCubic:case QEasingCurve::InCubic:Executed by:
executed 2 times by 1 test: case QEasingCurve::InCubic:Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 644 | return executed 2 times by 1 test: &easeInCubic;return &easeInCubic;Executed by:
executed 2 times by 1 test: return &easeInCubic;Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 645 | case executed 19 times by 2 tests: QEasingCurve::OutCubic:case QEasingCurve::OutCubic:Executed by:
executed 19 times by 2 tests: case QEasingCurve::OutCubic:Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||
| 646 | return executed 19 times by 2 tests: &easeOutCubic;return &easeOutCubic;Executed by:
executed 19 times by 2 tests: return &easeOutCubic;Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||
| 647 | case executed 1 time by 1 test: QEasingCurve::InOutCubic:case QEasingCurve::InOutCubic:Executed by:
executed 1 time by 1 test: case QEasingCurve::InOutCubic:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 648 | return executed 1 time by 1 test: &easeInOutCubic;return &easeInOutCubic;Executed by:
executed 1 time by 1 test: return &easeInOutCubic;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 649 | case executed 1 time by 1 test: QEasingCurve::OutInCubic:case QEasingCurve::OutInCubic:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInCubic:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 650 | return executed 1 time by 1 test: &easeOutInCubic;return &easeOutInCubic;Executed by:
executed 1 time by 1 test: return &easeOutInCubic;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 651 | case executed 1 time by 1 test: QEasingCurve::InQuart:case QEasingCurve::InQuart:Executed by:
executed 1 time by 1 test: case QEasingCurve::InQuart:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 652 | return executed 1 time by 1 test: &easeInQuart;return &easeInQuart;Executed by:
executed 1 time by 1 test: return &easeInQuart;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 653 | case executed 2 times by 2 tests: QEasingCurve::OutQuart:case QEasingCurve::OutQuart:Executed by:
executed 2 times by 2 tests: case QEasingCurve::OutQuart:Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 654 | return executed 2 times by 2 tests: &easeOutQuart;return &easeOutQuart;Executed by:
executed 2 times by 2 tests: return &easeOutQuart;Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 655 | case executed 1 time by 1 test: QEasingCurve::InOutQuart:case QEasingCurve::InOutQuart:Executed by:
executed 1 time by 1 test: case QEasingCurve::InOutQuart:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 656 | return executed 1 time by 1 test: &easeInOutQuart;return &easeInOutQuart;Executed by:
executed 1 time by 1 test: return &easeInOutQuart;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 657 | case executed 1 time by 1 test: QEasingCurve::OutInQuart:case QEasingCurve::OutInQuart:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInQuart:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 658 | return executed 1 time by 1 test: &easeOutInQuart;return &easeOutInQuart;Executed by:
executed 1 time by 1 test: return &easeOutInQuart;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 659 | case executed 1 time by 1 test: QEasingCurve::InQuint:case QEasingCurve::InQuint:Executed by:
executed 1 time by 1 test: case QEasingCurve::InQuint:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 660 | return executed 1 time by 1 test: &easeInQuint;return &easeInQuint;Executed by:
executed 1 time by 1 test: return &easeInQuint;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 661 | case executed 1 time by 1 test: QEasingCurve::OutQuint:case QEasingCurve::OutQuint:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutQuint:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 662 | return executed 1 time by 1 test: &easeOutQuint;return &easeOutQuint;Executed by:
executed 1 time by 1 test: return &easeOutQuint;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 663 | case executed 1 time by 1 test: QEasingCurve::InOutQuint:case QEasingCurve::InOutQuint:Executed by:
executed 1 time by 1 test: case QEasingCurve::InOutQuint:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 664 | return executed 1 time by 1 test: &easeInOutQuint;return &easeInOutQuint;Executed by:
executed 1 time by 1 test: return &easeInOutQuint;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 665 | case executed 1 time by 1 test: QEasingCurve::OutInQuint:case QEasingCurve::OutInQuint:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInQuint:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 666 | return executed 1 time by 1 test: &easeOutInQuint;return &easeOutInQuint;Executed by:
executed 1 time by 1 test: return &easeOutInQuint;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 667 | case executed 1 time by 1 test: QEasingCurve::InSine:case QEasingCurve::InSine:Executed by:
executed 1 time by 1 test: case QEasingCurve::InSine:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 668 | return executed 1 time by 1 test: &easeInSine;return &easeInSine;Executed by:
executed 1 time by 1 test: return &easeInSine;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 669 | case executed 4 times by 1 test: QEasingCurve::OutSine:case QEasingCurve::OutSine:Executed by:
executed 4 times by 1 test: case QEasingCurve::OutSine:Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 670 | return executed 4 times by 1 test: &easeOutSine;return &easeOutSine;Executed by:
executed 4 times by 1 test: return &easeOutSine;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 671 | case executed 48 times by 5 tests: QEasingCurve::InOutSine:case QEasingCurve::InOutSine:Executed by:
executed 48 times by 5 tests: case QEasingCurve::InOutSine:Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||
| 672 | return executed 48 times by 5 tests: &easeInOutSine;return &easeInOutSine;Executed by:
executed 48 times by 5 tests: return &easeInOutSine;Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||
| 673 | case executed 1 time by 1 test: QEasingCurve::OutInSine:case QEasingCurve::OutInSine:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInSine:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 674 | return executed 1 time by 1 test: &easeOutInSine;return &easeOutInSine;Executed by:
executed 1 time by 1 test: return &easeOutInSine;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 675 | case executed 1 time by 1 test: QEasingCurve::InExpo:case QEasingCurve::InExpo:Executed by:
executed 1 time by 1 test: case QEasingCurve::InExpo:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 676 | return executed 1 time by 1 test: &easeInExpo;return &easeInExpo;Executed by:
executed 1 time by 1 test: return &easeInExpo;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 677 | case executed 1 time by 1 test: QEasingCurve::OutExpo:case QEasingCurve::OutExpo:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutExpo:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 678 | return executed 1 time by 1 test: &easeOutExpo;return &easeOutExpo;Executed by:
executed 1 time by 1 test: return &easeOutExpo;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 679 | case executed 1 time by 1 test: QEasingCurve::InOutExpo:case QEasingCurve::InOutExpo:Executed by:
executed 1 time by 1 test: case QEasingCurve::InOutExpo:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 680 | return executed 1 time by 1 test: &easeInOutExpo;return &easeInOutExpo;Executed by:
executed 1 time by 1 test: return &easeInOutExpo;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 681 | case executed 1 time by 1 test: QEasingCurve::OutInExpo:case QEasingCurve::OutInExpo:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInExpo:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 682 | return executed 1 time by 1 test: &easeOutInExpo;return &easeOutInExpo;Executed by:
executed 1 time by 1 test: return &easeOutInExpo;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 683 | case executed 1 time by 1 test: QEasingCurve::InCirc:case QEasingCurve::InCirc:Executed by:
executed 1 time by 1 test: case QEasingCurve::InCirc:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 684 | return executed 1 time by 1 test: &easeInCirc;return &easeInCirc;Executed by:
executed 1 time by 1 test: return &easeInCirc;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 685 | case executed 1 time by 1 test: QEasingCurve::OutCirc:case QEasingCurve::OutCirc:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutCirc:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 686 | return executed 1 time by 1 test: &easeOutCirc;return &easeOutCirc;Executed by:
executed 1 time by 1 test: return &easeOutCirc;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 687 | case executed 1 time by 1 test: QEasingCurve::InOutCirc:case QEasingCurve::InOutCirc:Executed by:
executed 1 time by 1 test: case QEasingCurve::InOutCirc:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 688 | return executed 1 time by 1 test: &easeInOutCirc;return &easeInOutCirc;Executed by:
executed 1 time by 1 test: return &easeInOutCirc;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 689 | case executed 1 time by 1 test: QEasingCurve::OutInCirc:case QEasingCurve::OutInCirc:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInCirc:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 690 | return executed 1 time by 1 test: &easeOutInCirc;return &easeOutInCirc;Executed by:
executed 1 time by 1 test: return &easeOutInCirc;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||||||||||||||||||||
| 692 | case executed 1 time by 1 test: QEasingCurve::InCurve:case QEasingCurve::InCurve:Executed by:
executed 1 time by 1 test: case QEasingCurve::InCurve:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 693 | return executed 1 time by 1 test: &easeInCurve;return &easeInCurve;Executed by:
executed 1 time by 1 test: return &easeInCurve;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 694 | case executed 19 times by 2 tests: QEasingCurve::OutCurve:case QEasingCurve::OutCurve:Executed by:
executed 19 times by 2 tests: case QEasingCurve::OutCurve:Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||
| 695 | return executed 19 times by 2 tests: &easeOutCurve;return &easeOutCurve;Executed by:
executed 19 times by 2 tests: return &easeOutCurve;Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||
| 696 | case executed 3 times by 2 tests: QEasingCurve::SineCurve:case QEasingCurve::SineCurve:Executed by:
executed 3 times by 2 tests: case QEasingCurve::SineCurve:Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 697 | return executed 3 times by 2 tests: &easeSineCurve;return &easeSineCurve;Executed by:
executed 3 times by 2 tests: return &easeSineCurve;Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 698 | case executed 3 times by 2 tests: QEasingCurve::CosineCurve:case QEasingCurve::CosineCurve:Executed by:
executed 3 times by 2 tests: case QEasingCurve::CosineCurve:Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 699 | return executed 3 times by 2 tests: &easeCosineCurve;return &easeCosineCurve;Executed by:
executed 3 times by 2 tests: return &easeCosineCurve;Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 700 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 701 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 702 | }; | - | ||||||||||||||||||||||||||||||||||||||||||
| 703 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 704 | - | |||||||||||||||||||||||||||||||||||||||||||
| 705 | static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type) | - | ||||||||||||||||||||||||||||||||||||||||||
| 706 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 707 | switch(type) { | - | ||||||||||||||||||||||||||||||||||||||||||
| 708 | case executed 6 times by 1 test: QEasingCurve::InElastic:case QEasingCurve::InElastic:Executed by:
executed 6 times by 1 test: case QEasingCurve::InElastic:Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||
| 709 | case executed 1 time by 1 test: QEasingCurve::OutElastic:case QEasingCurve::OutElastic:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutElastic:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 710 | case executed 27 times by 3 tests: QEasingCurve::InOutElastic:case QEasingCurve::InOutElastic:Executed by:
executed 27 times by 3 tests: case QEasingCurve::InOutElastic:Executed by:
| 27 | ||||||||||||||||||||||||||||||||||||||||||
| 711 | case executed 1 time by 1 test: QEasingCurve::OutInElastic:case QEasingCurve::OutInElastic:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInElastic:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 712 | return executed 35 times by 3 tests: new ElasticEase(type);return new ElasticEase(type);Executed by:
executed 35 times by 3 tests: return new ElasticEase(type);Executed by:
| 35 | ||||||||||||||||||||||||||||||||||||||||||
| 713 | case executed 1 time by 1 test: QEasingCurve::OutBounce:case QEasingCurve::OutBounce:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutBounce:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 714 | case executed 2 times by 1 test: QEasingCurve::InBounce:case QEasingCurve::InBounce:Executed by:
executed 2 times by 1 test: case QEasingCurve::InBounce:Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 715 | case executed 1 time by 1 test: QEasingCurve::OutInBounce:case QEasingCurve::OutInBounce:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutInBounce:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 716 | case executed 1 time by 1 test: QEasingCurve::InOutBounce:case QEasingCurve::InOutBounce:Executed by:
executed 1 time by 1 test: case QEasingCurve::InOutBounce:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 717 | return executed 5 times by 1 test: new BounceEase(type);return new BounceEase(type);Executed by:
executed 5 times by 1 test: return new BounceEase(type);Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||
| 718 | case executed 3 times by 1 test: QEasingCurve::InBack:case QEasingCurve::InBack:Executed by:
executed 3 times by 1 test: case QEasingCurve::InBack:Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 719 | case executed 1 time by 1 test: QEasingCurve::OutBack:case QEasingCurve::OutBack:Executed by:
executed 1 time by 1 test: case QEasingCurve::OutBack:Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 720 | case executed 28 times by 2 tests: QEasingCurve::InOutBack:case QEasingCurve::InOutBack:Executed by:
executed 28 times by 2 tests: case QEasingCurve::InOutBack:Executed by:
| 28 | ||||||||||||||||||||||||||||||||||||||||||
| 721 | case executed 25 times by 2 tests: QEasingCurve::OutInBack:case QEasingCurve::OutInBack:Executed by:
executed 25 times by 2 tests: case QEasingCurve::OutInBack:Executed by:
| 25 | ||||||||||||||||||||||||||||||||||||||||||
| 722 | return executed 57 times by 2 tests: new BackEase(type);return new BackEase(type);Executed by:
executed 57 times by 2 tests: return new BackEase(type);Executed by:
| 57 | ||||||||||||||||||||||||||||||||||||||||||
| 723 | case executed 3 times by 1 test: QEasingCurve::BezierSpline:case QEasingCurve::BezierSpline:Executed by:
executed 3 times by 1 test: case QEasingCurve::BezierSpline:Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 724 | return executed 3 times by 1 test: new BezierEase;return new BezierEase;Executed by:
executed 3 times by 1 test: return new BezierEase;Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 725 | case executed 4 times by 1 test: QEasingCurve::TCBSpline:case QEasingCurve::TCBSpline:Executed by:
executed 4 times by 1 test: case QEasingCurve::TCBSpline:Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 726 | return executed 4 times by 1 test: new TCBEase;return new TCBEase;Executed by:
executed 4 times by 1 test: return new TCBEase;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 727 | default executed 10 times by 1 test: :default:Executed by:
executed 10 times by 1 test: default:Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||
| 728 | return executed 10 times by 1 test: new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158));return new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158));Executed by:
executed 10 times by 1 test: return new QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158));Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||
| 729 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||||||||||||||
| 731 | return dead code: 0;return 0;dead code: return 0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 732 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 733 | QEasingCurve::QEasingCurve(Type type) | - | ||||||||||||||||||||||||||||||||||||||||||
| 734 | : d_ptr(new QEasingCurvePrivate) | - | ||||||||||||||||||||||||||||||||||||||||||
| 735 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 736 | setType(type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 737 | } executed 3877 times by 50 tests: end of blockExecuted by:
| 3877 | ||||||||||||||||||||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||||||||||||||||||||
| 739 | - | |||||||||||||||||||||||||||||||||||||||||||
| 740 | - | |||||||||||||||||||||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||||||||||||||||||||
| 742 | QEasingCurve::QEasingCurve(const QEasingCurve &other) | - | ||||||||||||||||||||||||||||||||||||||||||
| 743 | : d_ptr(new QEasingCurvePrivate(*other.d_ptr)) | - | ||||||||||||||||||||||||||||||||||||||||||
| 744 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||||||||||||||||||||
| 746 | } executed 1902 times by 41 tests: end of blockExecuted by:
| 1902 | ||||||||||||||||||||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||||||||||||||||||||
| 751 | - | |||||||||||||||||||||||||||||||||||||||||||
| 752 | QEasingCurve::~QEasingCurve() | - | ||||||||||||||||||||||||||||||||||||||||||
| 753 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 754 | delete d_ptr; | - | ||||||||||||||||||||||||||||||||||||||||||
| 755 | } executed 5666 times by 52 tests: end of blockExecuted by:
| 5666 | ||||||||||||||||||||||||||||||||||||||||||
| 756 | bool QEasingCurve::operator==(const QEasingCurve &other) const | - | ||||||||||||||||||||||||||||||||||||||||||
| 757 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 758 | bool res = d_ptr->func == other.d_ptr->func
| 0-71 | ||||||||||||||||||||||||||||||||||||||||||
| 759 | && d_ptr->type == other.d_ptr->type
| 1-70 | ||||||||||||||||||||||||||||||||||||||||||
| 760 | if (res
| 1-70 | ||||||||||||||||||||||||||||||||||||||||||
| 761 | if (d_ptr->config
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||||||||||||||||||||
| 763 | res = d_ptr->config->operator==(*(other.d_ptr->config)); | - | ||||||||||||||||||||||||||||||||||||||||||
| 764 | - | |||||||||||||||||||||||||||||||||||||||||||
| 765 | } executed 27 times by 3 tests: else if (d_ptr->configend of blockExecuted by:
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||||||||||||||||||||
| 767 | res = qFuzzyCompare(amplitude(), other.amplitude())
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 768 | qFuzzyCompare(period(), other.period())
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||
| 769 | qFuzzyCompare(overshoot(), other.overshoot())
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||
| 770 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 771 | } executed 70 times by 4 tests: end of blockExecuted by:
| 70 | ||||||||||||||||||||||||||||||||||||||||||
| 772 | return executed 71 times by 4 tests: res;return res;Executed by:
executed 71 times by 4 tests: return res;Executed by:
| 71 | ||||||||||||||||||||||||||||||||||||||||||
| 773 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 774 | qreal QEasingCurve::amplitude() const | - | ||||||||||||||||||||||||||||||||||||||||||
| 775 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 776 | return executed 19 times by 1 test: d_ptr->config ? d_ptr->config->_a : qreal(1.0);return d_ptr->config ? d_ptr->config->_a : qreal(1.0);Executed by:
executed 19 times by 1 test: return d_ptr->config ? d_ptr->config->_a : qreal(1.0);Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||
| 777 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 778 | void QEasingCurve::setAmplitude(qreal amplitude) | - | ||||||||||||||||||||||||||||||||||||||||||
| 779 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 780 | if (!d_ptr->config
| 2-15 | ||||||||||||||||||||||||||||||||||||||||||
| 781 | d_ptr->config = curveToFunctionObject(d_ptr->type); executed 2 times by 1 test: d_ptr->config = curveToFunctionObject(d_ptr->type);Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||
| 782 | d_ptr->config->_a = amplitude; | - | ||||||||||||||||||||||||||||||||||||||||||
| 783 | } executed 17 times by 2 tests: end of blockExecuted by:
| 17 | ||||||||||||||||||||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||||||||||||||||||||
| 786 | - | |||||||||||||||||||||||||||||||||||||||||||
| 787 | - | |||||||||||||||||||||||||||||||||||||||||||
| 788 | - | |||||||||||||||||||||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||||||||||||||||||||
| 790 | qreal QEasingCurve::period() const | - | ||||||||||||||||||||||||||||||||||||||||||
| 791 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 792 | return executed 16 times by 1 test: d_ptr->config ? d_ptr->config->_p : qreal(0.3);return d_ptr->config ? d_ptr->config->_p : qreal(0.3);Executed by:
executed 16 times by 1 test: return d_ptr->config ? d_ptr->config->_p : qreal(0.3);Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||
| 793 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 794 | void QEasingCurve::setPeriod(qreal period) | - | ||||||||||||||||||||||||||||||||||||||||||
| 795 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 796 | if (!d_ptr->config
| 3-13 | ||||||||||||||||||||||||||||||||||||||||||
| 797 | d_ptr->config = curveToFunctionObject(d_ptr->type); executed 3 times by 1 test: d_ptr->config = curveToFunctionObject(d_ptr->type);Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||
| 798 | d_ptr->config->_p = period; | - | ||||||||||||||||||||||||||||||||||||||||||
| 799 | } executed 16 times by 2 tests: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||
| 800 | - | |||||||||||||||||||||||||||||||||||||||||||
| 801 | - | |||||||||||||||||||||||||||||||||||||||||||
| 802 | - | |||||||||||||||||||||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||||||||||||||||||||
| 806 | qreal QEasingCurve::overshoot() const | - | ||||||||||||||||||||||||||||||||||||||||||
| 807 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 808 | return executed 17 times by 1 test: d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ;return d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ;Executed by:
executed 17 times by 1 test: return d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ;Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||||||||
| 809 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 810 | void QEasingCurve::setOvershoot(qreal overshoot) | - | ||||||||||||||||||||||||||||||||||||||||||
| 811 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 812 | if (!d_ptr->config
| 0-17 | ||||||||||||||||||||||||||||||||||||||||||
| 813 | d_ptr->config = curveToFunctionObject(d_ptr->type); never executed: d_ptr->config = curveToFunctionObject(d_ptr->type); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 814 | d_ptr->config->_o = overshoot; | - | ||||||||||||||||||||||||||||||||||||||||||
| 815 | } executed 17 times by 2 tests: end of blockExecuted by:
| 17 | ||||||||||||||||||||||||||||||||||||||||||
| 816 | void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint) | - | ||||||||||||||||||||||||||||||||||||||||||
| 817 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 818 | if (!d_ptr->config
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||
| 819 | d_ptr->config = curveToFunctionObject(d_ptr->type); never executed: d_ptr->config = curveToFunctionObject(d_ptr->type); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 820 | d_ptr->config->_bezierCurves << c1 << c2 << endPoint; | - | ||||||||||||||||||||||||||||||||||||||||||
| 821 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||||||||||||||||||||
| 823 | QVector<QPointF> static inline tcbToBezier(const TCBPoints &tcbPoints) | - | ||||||||||||||||||||||||||||||||||||||||||
| 824 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 825 | const int count = tcbPoints.count(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 826 | QVector<QPointF> bezierPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 827 | bezierPoints.reserve(3 * (count - 1)); | - | ||||||||||||||||||||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||||||||||||||||||||
| 829 | for (int i = 1; i < count
| 4-8 | ||||||||||||||||||||||||||||||||||||||||||
| 830 | const qreal t_0 = tcbPoints.at(i - 1)._t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 831 | const qreal c_0 = tcbPoints.at(i - 1)._c; | - | ||||||||||||||||||||||||||||||||||||||||||
| 832 | qreal b_0 = -1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 833 | - | |||||||||||||||||||||||||||||||||||||||||||
| 834 | qreal const t_1 = tcbPoints.at(i)._t; | - | ||||||||||||||||||||||||||||||||||||||||||
| 835 | qreal const c_1 = tcbPoints.at(i)._c; | - | ||||||||||||||||||||||||||||||||||||||||||
| 836 | qreal b_1 = 1; | - | ||||||||||||||||||||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||||||||||||||||||||
| 838 | QPointF c_minusOne; | - | ||||||||||||||||||||||||||||||||||||||||||
| 839 | const QPointF c0(tcbPoints.at(i - 1)._point); | - | ||||||||||||||||||||||||||||||||||||||||||
| 840 | const QPointF c3(tcbPoints.at(i)._point); | - | ||||||||||||||||||||||||||||||||||||||||||
| 841 | QPointF c4; | - | ||||||||||||||||||||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||||||||||||||||||||
| 843 | if (i > 1
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 844 | c_minusOne = tcbPoints.at(i - 2)._point; | - | ||||||||||||||||||||||||||||||||||||||||||
| 845 | b_0 = tcbPoints.at(i - 1)._b; | - | ||||||||||||||||||||||||||||||||||||||||||
| 846 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 847 | - | |||||||||||||||||||||||||||||||||||||||||||
| 848 | if (i < (count - 1)
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 849 | c4 = tcbPoints.at(i + 1)._point; | - | ||||||||||||||||||||||||||||||||||||||||||
| 850 | b_1 = tcbPoints.at(i)._b; | - | ||||||||||||||||||||||||||||||||||||||||||
| 851 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||||||||||||||||||||
| 853 | 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())); | - | ||||||||||||||||||||||||||||||||||||||||||
| 854 | 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())); | - | ||||||||||||||||||||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||||||||||||||||||||
| 856 | 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())); | - | ||||||||||||||||||||||||||||||||||||||||||
| 857 | 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())); | - | ||||||||||||||||||||||||||||||||||||||||||
| 858 | - | |||||||||||||||||||||||||||||||||||||||||||
| 859 | const QPointF d_0 = QPointF(dx_0, dy_0); | - | ||||||||||||||||||||||||||||||||||||||||||
| 860 | const QPointF d_1 = QPointF(dx_1, dy_1); | - | ||||||||||||||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||||||||||||||
| 862 | QPointF c1 = (3 * c0 + d_0) / 3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 863 | QPointF c2 = (3 * c3 - d_1) / 3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 864 | bezierPoints << c1 << c2 << c3; | - | ||||||||||||||||||||||||||||||||||||||||||
| 865 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||
| 866 | return executed 4 times by 1 test: bezierPoints;return bezierPoints;Executed by:
executed 4 times by 1 test: return bezierPoints;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 867 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 868 | void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b) | - | ||||||||||||||||||||||||||||||||||||||||||
| 869 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 870 | if (!d_ptr->config
| 0-12 | ||||||||||||||||||||||||||||||||||||||||||
| 871 | d_ptr->config = curveToFunctionObject(d_ptr->type); never executed: d_ptr->config = curveToFunctionObject(d_ptr->type); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||||||||||||||||||||
| 873 | d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c ,b)); | - | ||||||||||||||||||||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||||||||||||||||||||
| 875 | if (nextPoint == QPointF(1.0, 1.0)
| 4-8 | ||||||||||||||||||||||||||||||||||||||||||
| 876 | d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints); | - | ||||||||||||||||||||||||||||||||||||||||||
| 877 | d_ptr->config->_tcbPoints.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||
| 878 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||||||||||||||||||||
| 880 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||
| 881 | QVector<QPointF> QEasingCurve::toCubicSpline() const | - | ||||||||||||||||||||||||||||||||||||||||||
| 882 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 883 | return never executed: d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>();return d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>();never executed: return d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>(); | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 884 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||||||||||||||||||||
| 888 | - | |||||||||||||||||||||||||||||||||||||||||||
| 889 | QEasingCurve::Type QEasingCurve::type() const | - | ||||||||||||||||||||||||||||||||||||||||||
| 890 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 891 | return executed 42 times by 4 tests: d_ptr->type;return d_ptr->type;Executed by:
executed 42 times by 4 tests: return d_ptr->type;Executed by:
| 42 | ||||||||||||||||||||||||||||||||||||||||||
| 892 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 893 | - | |||||||||||||||||||||||||||||||||||||||||||
| 894 | void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) | - | ||||||||||||||||||||||||||||||||||||||||||
| 895 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 896 | qreal amp = -1.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 897 | qreal period = -1.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 898 | qreal overshoot = -1.0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 899 | QVector<QPointF> bezierCurves; | - | ||||||||||||||||||||||||||||||||||||||||||
| 900 | QVector<TCBPoint> tcbPoints; | - | ||||||||||||||||||||||||||||||||||||||||||
| 901 | - | |||||||||||||||||||||||||||||||||||||||||||
| 902 | if (config
| 10-1836 | ||||||||||||||||||||||||||||||||||||||||||
| 903 | amp = config->_a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 904 | period = config->_p; | - | ||||||||||||||||||||||||||||||||||||||||||
| 905 | overshoot = config->_o; | - | ||||||||||||||||||||||||||||||||||||||||||
| 906 | bezierCurves = std::move(config->_bezierCurves); | - | ||||||||||||||||||||||||||||||||||||||||||
| 907 | tcbPoints = std::move(config->_tcbPoints); | - | ||||||||||||||||||||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||||||||||||||||||||
| 909 | delete config; | - | ||||||||||||||||||||||||||||||||||||||||||
| 910 | config = 0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 911 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||||||||||||||||||||
| 913 | if (isConfigFunction(newType)
| 0-1760 | ||||||||||||||||||||||||||||||||||||||||||
| 914 | !bezierCurves.isEmpty()
| 0-1755 | ||||||||||||||||||||||||||||||||||||||||||
| 915 | config = curveToFunctionObject(newType); | - | ||||||||||||||||||||||||||||||||||||||||||
| 916 | if (amp != -1.0
| 10-81 | ||||||||||||||||||||||||||||||||||||||||||
| 917 | config->_a = amp; executed 10 times by 1 test: config->_a = amp;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||
| 918 | if (period != -1.0
| 10-81 | ||||||||||||||||||||||||||||||||||||||||||
| 919 | config->_p = period; executed 10 times by 1 test: config->_p = period;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||
| 920 | if (overshoot != -1.0
| 10-81 | ||||||||||||||||||||||||||||||||||||||||||
| 921 | config->_o = overshoot; executed 10 times by 1 test: config->_o = overshoot;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||
| 922 | config->_bezierCurves = std::move(bezierCurves); | - | ||||||||||||||||||||||||||||||||||||||||||
| 923 | config->_tcbPoints = std::move(tcbPoints); | - | ||||||||||||||||||||||||||||||||||||||||||
| 924 | func = 0; | - | ||||||||||||||||||||||||||||||||||||||||||
| 925 | } executed 91 times by 3 tests: else if (newType != QEasingCurve::Customend of blockExecuted by:
| 7-1748 | ||||||||||||||||||||||||||||||||||||||||||
| 926 | func = curveToFunc(newType); | - | ||||||||||||||||||||||||||||||||||||||||||
| 927 | } executed 1748 times by 41 tests: end of blockExecuted by:
| 1748 | ||||||||||||||||||||||||||||||||||||||||||
| 928 | ((!((func == 0) == (config != 0))) ? qt_assert("(func == 0) == (config != 0)",__FILE__,1358) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||||||||
| 929 | type = newType; | - | ||||||||||||||||||||||||||||||||||||||||||
| 930 | } executed 1846 times by 43 tests: end of blockExecuted by:
| 1846 | ||||||||||||||||||||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||||||||||||||||||||
| 935 | void QEasingCurve::setType(Type type) | - | ||||||||||||||||||||||||||||||||||||||||||
| 936 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 937 | if (d_ptr->type == type
| 1844-2202 | ||||||||||||||||||||||||||||||||||||||||||
| 938 | return; executed 2202 times by 48 tests: return;Executed by:
| 2202 | ||||||||||||||||||||||||||||||||||||||||||
| 939 | if (type < Linear
| 2-1842 | ||||||||||||||||||||||||||||||||||||||||||
| 940 | QMessageLogger(__FILE__, 1370, __PRETTY_FUNCTION__).warning("QEasingCurve: Invalid curve type %d", type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 941 | return; executed 5 times by 1 test: return;Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||
| 942 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 943 | - | |||||||||||||||||||||||||||||||||||||||||||
| 944 | d_ptr->setType_helper(type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 945 | } executed 1839 times by 42 tests: end of blockExecuted by:
| 1839 | ||||||||||||||||||||||||||||||||||||||||||
| 946 | void QEasingCurve::setCustomType(EasingFunction func) | - | ||||||||||||||||||||||||||||||||||||||||||
| 947 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 948 | if (!func
| 0-7 | ||||||||||||||||||||||||||||||||||||||||||
| 949 | QMessageLogger(__FILE__, 1391, __PRETTY_FUNCTION__).warning("Function pointer must not be null"); | - | ||||||||||||||||||||||||||||||||||||||||||
| 950 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 951 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 952 | d_ptr->func = func; | - | ||||||||||||||||||||||||||||||||||||||||||
| 953 | d_ptr->setType_helper(Custom); | - | ||||||||||||||||||||||||||||||||||||||||||
| 954 | } executed 7 times by 2 tests: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||||||||||||||||||||
| 961 | QEasingCurve::EasingFunction QEasingCurve::customType() const | - | ||||||||||||||||||||||||||||||||||||||||||
| 962 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 963 | return never executed: d_ptr->type == Custom ? d_ptr->func : 0;return d_ptr->type == Custom ? d_ptr->func : 0;never executed: return d_ptr->type == Custom ? d_ptr->func : 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 964 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||||||||||||||||||||
| 968 | - | |||||||||||||||||||||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||||||||||||||||||||
| 970 | - | |||||||||||||||||||||||||||||||||||||||||||
| 971 | - | |||||||||||||||||||||||||||||||||||||||||||
| 972 | qreal QEasingCurve::valueForProgress(qreal progress) const | - | ||||||||||||||||||||||||||||||||||||||||||
| 973 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 974 | progress = qBound<qreal>(0, progress, 1); | - | ||||||||||||||||||||||||||||||||||||||||||
| 975 | if (d_ptr->func
| 181-13079 | ||||||||||||||||||||||||||||||||||||||||||
| 976 | return executed 13079 times by 30 tests: d_ptr->func(progress);return d_ptr->func(progress);Executed by:
executed 13079 times by 30 tests: return d_ptr->func(progress);Executed by:
| 13079 | ||||||||||||||||||||||||||||||||||||||||||
| 977 | else if (d_ptr->config
| 0-181 | ||||||||||||||||||||||||||||||||||||||||||
| 978 | return executed 181 times by 1 test: d_ptr->config->value(progress);return d_ptr->config->value(progress);Executed by:
executed 181 times by 1 test: return d_ptr->config->value(progress);Executed by:
| 181 | ||||||||||||||||||||||||||||||||||||||||||
| 979 | else | - | ||||||||||||||||||||||||||||||||||||||||||
| 980 | return never executed: progress;return progress;never executed: return progress; | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 981 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||||||||||||||||||||
| 984 | QDebug operator<<(QDebug debug, const QEasingCurve &item) | - | ||||||||||||||||||||||||||||||||||||||||||
| 985 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 986 | QDebugStateSaver saver(debug); | - | ||||||||||||||||||||||||||||||||||||||||||
| 987 | debug << "type:" << item.d_ptr->type | - | ||||||||||||||||||||||||||||||||||||||||||
| 988 | << "func:" << item.d_ptr->func; | - | ||||||||||||||||||||||||||||||||||||||||||
| 989 | if (item.d_ptr->config
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||
| 990 | debug << QString::fromLatin1("period:%1").arg(item.d_ptr->config->_p, 0, 'f', 20) | - | ||||||||||||||||||||||||||||||||||||||||||
| 991 | << QString::fromLatin1("amp:%1").arg(item.d_ptr->config->_a, 0, 'f', 20) | - | ||||||||||||||||||||||||||||||||||||||||||
| 992 | << QString::fromLatin1("overshoot:%1").arg(item.d_ptr->config->_o, 0, 'f', 20); | - | ||||||||||||||||||||||||||||||||||||||||||
| 993 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||
| 994 | return executed 1 time by 1 test: debug;return debug;Executed by:
executed 1 time by 1 test: return debug;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||
| 995 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 996 | QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) | - | ||||||||||||||||||||||||||||||||||||||||||
| 997 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 998 | stream << quint8(easing.d_ptr->type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 999 | stream << quint64(quintptr(easing.d_ptr->func)); | - | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||||||||||||||||||||
| 1001 | bool hasConfig = easing.d_ptr->config; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | stream << hasConfig; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | if (hasConfig
| 18-31 | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | stream << easing.d_ptr->config->_p; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | stream << easing.d_ptr->config->_a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | stream << easing.d_ptr->config->_o; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | return executed 49 times by 2 tests: stream;return stream;Executed by:
executed 49 times by 2 tests: return stream;Executed by:
| 49 | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 1010 | QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) | - | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | { | - | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | QEasingCurve::Type type; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | quint8 int_type; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | stream >> int_type; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | type = static_cast<QEasingCurve::Type>(int_type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | easing.setType(type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | quint64 ptr_func; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | stream >> ptr_func; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | easing.d_ptr->func = QEasingCurve::EasingFunction(quintptr(ptr_func)); | - | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | bool hasConfig; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | stream >> hasConfig; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1024 | delete easing.d_ptr->config; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | easing.d_ptr->config = nullptr; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1026 | if (hasConfig
| 18-33 | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | QEasingCurveFunction *config = curveToFunctionObject(type); | - | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | stream >> config->_p; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1029 | stream >> config->_a; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | stream >> config->_o; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | easing.d_ptr->config = config; | - | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||||||||||||||||||||
| 1033 | return executed 51 times by 2 tests: stream;return stream;Executed by:
executed 51 times by 2 tests: return stream;Executed by:
| 51 | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | } | - | ||||||||||||||||||||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |