| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickpath.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | QQuickPath::QQuickPath(QObject *parent) | - | ||||||||||||||||||
| 6 | : QObject(*(new QQuickPathPrivate), parent) | - | ||||||||||||||||||
| 7 | { | - | ||||||||||||||||||
| 8 | } executed 330 times by 5 tests: end of blockExecuted by:
| 330 | ||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | QQuickPath::QQuickPath(QQuickPathPrivate &dd, QObject *parent) | - | ||||||||||||||||||
| 11 | : QObject(dd, parent) | - | ||||||||||||||||||
| 12 | { | - | ||||||||||||||||||
| 13 | } executed 1072 times by 2 tests: end of blockExecuted by:
| 1072 | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | QQuickPath::~QQuickPath() | - | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | } | - | ||||||||||||||||||
| 18 | - | |||||||||||||||||||
| 19 | - | |||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | - | |||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | qreal QQuickPath::startX() const | - | ||||||||||||||||||
| 25 | { | - | ||||||||||||||||||
| 26 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 27 | return executed 20 times by 3 tests: d->startX.isNull ? 0 : d->startX.value;return d->startX.isNull ? 0 : d->startX.value;Executed by:
executed 20 times by 3 tests: return d->startX.isNull ? 0 : d->startX.value;Executed by:
| 20 | ||||||||||||||||||
| 28 | } | - | ||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | void QQuickPath::setStartX(qreal x) | - | ||||||||||||||||||
| 31 | { | - | ||||||||||||||||||
| 32 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 33 | if (d->startX.isValid()
| 2-408 | ||||||||||||||||||
| 34 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||
| 35 | d->startX = x; | - | ||||||||||||||||||
| 36 | startXChanged(); | - | ||||||||||||||||||
| 37 | processPath(); | - | ||||||||||||||||||
| 38 | } executed 426 times by 6 tests: end of blockExecuted by:
| 426 | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | bool QQuickPath::hasStartX() const | - | ||||||||||||||||||
| 41 | { | - | ||||||||||||||||||
| 42 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 43 | return executed 24 times by 2 tests: d->startX.isValid();return d->startX.isValid();Executed by:
executed 24 times by 2 tests: return d->startX.isValid();Executed by:
| 24 | ||||||||||||||||||
| 44 | } | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | qreal QQuickPath::startY() const | - | ||||||||||||||||||
| 47 | { | - | ||||||||||||||||||
| 48 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 49 | return executed 18 times by 2 tests: d->startY.isNull ? 0 : d->startY.value;return d->startY.isNull ? 0 : d->startY.value;Executed by:
executed 18 times by 2 tests: return d->startY.isNull ? 0 : d->startY.value;Executed by:
| 18 | ||||||||||||||||||
| 50 | } | - | ||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | void QQuickPath::setStartY(qreal y) | - | ||||||||||||||||||
| 53 | { | - | ||||||||||||||||||
| 54 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 55 | if (d->startY.isValid()
| 2-408 | ||||||||||||||||||
| 56 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||
| 57 | d->startY = y; | - | ||||||||||||||||||
| 58 | startYChanged(); | - | ||||||||||||||||||
| 59 | processPath(); | - | ||||||||||||||||||
| 60 | } executed 422 times by 6 tests: end of blockExecuted by:
| 422 | ||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | bool QQuickPath::hasStartY() const | - | ||||||||||||||||||
| 63 | { | - | ||||||||||||||||||
| 64 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 65 | return executed 14 times by 2 tests: d->startY.isValid();return d->startY.isValid();Executed by:
executed 14 times by 2 tests: return d->startY.isValid();Executed by:
| 14 | ||||||||||||||||||
| 66 | } | - | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | bool QQuickPath::isClosed() const | - | ||||||||||||||||||
| 73 | { | - | ||||||||||||||||||
| 74 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 75 | return executed 6 times by 2 tests: d->closed;return d->closed;Executed by:
executed 6 times by 2 tests: return d->closed;Executed by:
| 6 | ||||||||||||||||||
| 76 | } | - | ||||||||||||||||||
| 77 | QQmlListProperty<QQuickPathElement> QQuickPath::pathElements() | - | ||||||||||||||||||
| 78 | { | - | ||||||||||||||||||
| 79 | return executed 1448 times by 6 tests: QQmlListProperty<QQuickPathElement>(this,return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);Executed by:
executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);Executed by:
| 1448 | ||||||||||||||||||
| 80 | nullptr, executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);Executed by:
| 1448 | ||||||||||||||||||
| 81 | pathElements_append, executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);Executed by:
| 1448 | ||||||||||||||||||
| 82 | pathElements_count, executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);Executed by:
| 1448 | ||||||||||||||||||
| 83 | pathElements_at, executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);Executed by:
| 1448 | ||||||||||||||||||
| 84 | pathElements_clear); executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);Executed by:
| 1448 | ||||||||||||||||||
| 85 | } | - | ||||||||||||||||||
| 86 | - | |||||||||||||||||||
| 87 | static QQuickPathPrivate *privatePath(QObject *object) | - | ||||||||||||||||||
| 88 | { | - | ||||||||||||||||||
| 89 | QQuickPath *path = static_cast<QQuickPath*>(object); | - | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | return executed 10752 times by 6 tests: QQuickPathPrivate::get(path);return QQuickPathPrivate::get(path);Executed by:
executed 10752 times by 6 tests: return QQuickPathPrivate::get(path);Executed by:
| 10752 | ||||||||||||||||||
| 92 | } | - | ||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty<QQuickPathElement> *property, int index) | - | ||||||||||||||||||
| 95 | { | - | ||||||||||||||||||
| 96 | QQuickPathPrivate *d = privatePath(property->object); | - | ||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | return executed 44 times by 3 tests: d->_pathElements.at(index);return d->_pathElements.at(index);Executed by:
executed 44 times by 3 tests: return d->_pathElements.at(index);Executed by:
| 44 | ||||||||||||||||||
| 99 | } | - | ||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | void QQuickPath::pathElements_append(QQmlListProperty<QQuickPathElement> *property, QQuickPathElement *pathElement) | - | ||||||||||||||||||
| 102 | { | - | ||||||||||||||||||
| 103 | QQuickPathPrivate *d = privatePath(property->object); | - | ||||||||||||||||||
| 104 | QQuickPath *path = static_cast<QQuickPath*>(property->object); | - | ||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | d->_pathElements.append(pathElement); | - | ||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | if (d->componentComplete
| 16-10642 | ||||||||||||||||||
| 109 | QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement); | - | ||||||||||||||||||
| 110 | if (curve
| 4-12 | ||||||||||||||||||
| 111 | d->_pathCurves.append(curve); executed 4 times by 1 test: d->_pathCurves.append(curve);Executed by:
| 4 | ||||||||||||||||||
| 112 | else { | - | ||||||||||||||||||
| 113 | QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement); | - | ||||||||||||||||||
| 114 | if (attribute
| 0-12 | ||||||||||||||||||
| 115 | d->_attributes.append(attribute->name()); executed 2 times by 1 test: d->_attributes.append(attribute->name());Executed by:
| 2 | ||||||||||||||||||
| 116 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | path->processPath(); | - | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | connect(pathElement, qFlagLocation("2""changed()" "\0" __FILE__ ":" "299"), path, qFlagLocation("1""processPath()" "\0" __FILE__ ":" "299")); | - | ||||||||||||||||||
| 121 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 122 | } executed 10658 times by 6 tests: end of blockExecuted by:
| 10658 | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | int QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *property) | - | ||||||||||||||||||
| 125 | { | - | ||||||||||||||||||
| 126 | QQuickPathPrivate *d = privatePath(property->object); | - | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | return executed 48 times by 3 tests: d->_pathElements.count();return d->_pathElements.count();Executed by:
executed 48 times by 3 tests: return d->_pathElements.count();Executed by:
| 48 | ||||||||||||||||||
| 129 | } | - | ||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | void QQuickPath::pathElements_clear(QQmlListProperty<QQuickPathElement> *property) | - | ||||||||||||||||||
| 132 | { | - | ||||||||||||||||||
| 133 | QQuickPathPrivate *d = privatePath(property->object); | - | ||||||||||||||||||
| 134 | QQuickPath *path = static_cast<QQuickPath*>(property->object); | - | ||||||||||||||||||
| 135 | - | |||||||||||||||||||
| 136 | path->disconnectPathElements(); | - | ||||||||||||||||||
| 137 | d->_pathElements.clear(); | - | ||||||||||||||||||
| 138 | d->_pathCurves.clear(); | - | ||||||||||||||||||
| 139 | d->_pointCache.clear(); | - | ||||||||||||||||||
| 140 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | void QQuickPath::interpolate(int idx, const QString &name, qreal value) | - | ||||||||||||||||||
| 143 | { | - | ||||||||||||||||||
| 144 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 145 | interpolate(d->_attributePoints, idx, name, value); | - | ||||||||||||||||||
| 146 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | void QQuickPath::interpolate(QList<AttributePoint> &attributePoints, int idx, const QString &name, qreal value) | - | ||||||||||||||||||
| 149 | { | - | ||||||||||||||||||
| 150 | if (!idx
| 216-392 | ||||||||||||||||||
| 151 | return; executed 216 times by 2 tests: return;Executed by:
| 216 | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | qreal lastValue = 0; | - | ||||||||||||||||||
| 154 | qreal lastPercent = 0; | - | ||||||||||||||||||
| 155 | int search = idx - 1; | - | ||||||||||||||||||
| 156 | while(search >= 0
| 4-394 | ||||||||||||||||||
| 157 | const AttributePoint &point = attributePoints.at(search); | - | ||||||||||||||||||
| 158 | if (point.values.contains(name)
| 6-388 | ||||||||||||||||||
| 159 | lastValue = point.values.value(name); | - | ||||||||||||||||||
| 160 | lastPercent = point.origpercent; | - | ||||||||||||||||||
| 161 | break; executed 388 times by 2 tests: break;Executed by:
| 388 | ||||||||||||||||||
| 162 | } | - | ||||||||||||||||||
| 163 | --search; | - | ||||||||||||||||||
| 164 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | ++search; | - | ||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | const AttributePoint &curPoint = attributePoints.at(idx); | - | ||||||||||||||||||
| 169 | - | |||||||||||||||||||
| 170 | for (int ii = search; ii < idx
| 6-392 | ||||||||||||||||||
| 171 | AttributePoint &point = attributePoints[ii]; | - | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | qreal val = lastValue + (value - lastValue) * (point.origpercent - lastPercent) / (curPoint.origpercent - lastPercent); | - | ||||||||||||||||||
| 174 | point.values.insert(name, val); | - | ||||||||||||||||||
| 175 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 176 | } executed 392 times by 2 tests: end of blockExecuted by:
| 392 | ||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | void QQuickPath::endpoint(const QString &name) | - | ||||||||||||||||||
| 179 | { | - | ||||||||||||||||||
| 180 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 181 | const AttributePoint &first = d->_attributePoints.first(); | - | ||||||||||||||||||
| 182 | qreal val = first.values.value(name); | - | ||||||||||||||||||
| 183 | for (int ii = d->_attributePoints.count() - 1; ii >= 0
| 0 | ||||||||||||||||||
| 184 | const AttributePoint &point = d->_attributePoints.at(ii); | - | ||||||||||||||||||
| 185 | if (point.values.contains(name)
| 0 | ||||||||||||||||||
| 186 | for (int jj = ii + 1; jj < d->_attributePoints.count()
| 0 | ||||||||||||||||||
| 187 | AttributePoint &setPoint = d->_attributePoints[jj]; | - | ||||||||||||||||||
| 188 | setPoint.values.insert(name, val); | - | ||||||||||||||||||
| 189 | } never executed: end of block | 0 | ||||||||||||||||||
| 190 | return; never executed: return; | 0 | ||||||||||||||||||
| 191 | } | - | ||||||||||||||||||
| 192 | } never executed: end of block | 0 | ||||||||||||||||||
| 193 | } never executed: end of block | 0 | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | void QQuickPath::endpoint(QList<AttributePoint> &attributePoints, const QString &name) | - | ||||||||||||||||||
| 196 | { | - | ||||||||||||||||||
| 197 | const AttributePoint &first = attributePoints.first(); | - | ||||||||||||||||||
| 198 | qreal val = first.values.value(name); | - | ||||||||||||||||||
| 199 | for (int ii = attributePoints.count() - 1; ii >= 0
| 0-80 | ||||||||||||||||||
| 200 | const AttributePoint &point = attributePoints.at(ii); | - | ||||||||||||||||||
| 201 | if (point.values.contains(name)
| 38-42 | ||||||||||||||||||
| 202 | for (int jj = ii + 1; jj < attributePoints.count()
| 38-42 | ||||||||||||||||||
| 203 | AttributePoint &setPoint = attributePoints[jj]; | - | ||||||||||||||||||
| 204 | setPoint.values.insert(name, val); | - | ||||||||||||||||||
| 205 | } executed 42 times by 2 tests: end of blockExecuted by:
| 42 | ||||||||||||||||||
| 206 | return; executed 38 times by 2 tests: return;Executed by:
| 38 | ||||||||||||||||||
| 207 | } | - | ||||||||||||||||||
| 208 | } executed 42 times by 2 tests: end of blockExecuted by:
| 42 | ||||||||||||||||||
| 209 | } never executed: end of block | 0 | ||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | void QQuickPath::processPath() | - | ||||||||||||||||||
| 212 | { | - | ||||||||||||||||||
| 213 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | if (!d->componentComplete
| 816-1528 | ||||||||||||||||||
| 216 | return; executed 816 times by 6 tests: return;Executed by:
| 816 | ||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | d->_pointCache.clear(); | - | ||||||||||||||||||
| 219 | d->prevBez.isValid = false; | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | if (d->isShapePath
| 370-1158 | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | d->_path = createShapePath(QPointF(), QPointF(), d->pathLength, &d->closed); | - | ||||||||||||||||||
| 224 | } executed 1158 times by 2 tests: else {end of blockExecuted by:
| 1158 | ||||||||||||||||||
| 225 | d->_path = createPath(QPointF(), QPointF(), d->_attributes, d->pathLength, d->_attributePoints, &d->closed); | - | ||||||||||||||||||
| 226 | } executed 370 times by 5 tests: end of blockExecuted by:
| 370 | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | changed(); | - | ||||||||||||||||||
| 229 | } executed 1528 times by 6 tests: end of blockExecuted by:
| 1528 | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | QPainterPath QQuickPath::createPath(const QPointF &startPoint, const QPointF &endPoint, const QStringList &attributes, qreal &pathLength, QList<AttributePoint> &attributePoints, bool *closed) | - | ||||||||||||||||||
| 232 | { | - | ||||||||||||||||||
| 233 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | pathLength = 0; | - | ||||||||||||||||||
| 236 | attributePoints.clear(); | - | ||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | if (!d->componentComplete
| 0-380 | ||||||||||||||||||
| 239 | return never executed: QPainterPath();return QPainterPath();never executed: return QPainterPath(); | 0 | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | QPainterPath path; | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | AttributePoint first; | - | ||||||||||||||||||
| 244 | for (int ii = 0; ii < attributes.count()
| 216-380 | ||||||||||||||||||
| 245 | first.values[attributes.at(ii)] = 0; executed 216 times by 2 tests: first.values[attributes.at(ii)] = 0;Executed by:
| 216 | ||||||||||||||||||
| 246 | attributePoints << first; | - | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 | qreal startX = d->startX.isValid()
| 24-356 | ||||||||||||||||||
| 249 | qreal startY = d->startY.isValid()
| 24-356 | ||||||||||||||||||
| 250 | path.moveTo(startX, startY); | - | ||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | const QString percentString = ([]() noexcept -> QString { enum { Size = sizeof(u"" "_qfx_percent")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "_qfx_percent" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()); | - | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | bool usesPercent = false; | - | ||||||||||||||||||
| 255 | int index = 0; | - | ||||||||||||||||||
| 256 | for (QQuickPathElement *pathElement : qAsConst(d->_pathElements)) { | - | ||||||||||||||||||
| 257 | if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement)
| 604-784 | ||||||||||||||||||
| 258 | QQuickPathData data; | - | ||||||||||||||||||
| 259 | data.index = index; | - | ||||||||||||||||||
| 260 | data.endPoint = endPoint; | - | ||||||||||||||||||
| 261 | data.curves = d->_pathCurves; | - | ||||||||||||||||||
| 262 | curve->addToPath(path, data); | - | ||||||||||||||||||
| 263 | AttributePoint p; | - | ||||||||||||||||||
| 264 | p.origpercent = path.length(); | - | ||||||||||||||||||
| 265 | attributePoints << p; | - | ||||||||||||||||||
| 266 | ++index; | - | ||||||||||||||||||
| 267 | } executed 784 times by 5 tests: else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement)end of blockExecuted by:
| 4-784 | ||||||||||||||||||
| 268 | AttributePoint &point = attributePoints.last(); | - | ||||||||||||||||||
| 269 | point.values[attribute->name()] = attribute->value(); | - | ||||||||||||||||||
| 270 | interpolate(attributePoints, attributePoints.count() - 1, attribute->name(), attribute->value()); | - | ||||||||||||||||||
| 271 | } executed 600 times by 2 tests: else if (QQuickPathPercent *percent = qobject_cast<QQuickPathPercent *>(pathElement)end of blockExecuted by:
| 0-600 | ||||||||||||||||||
| 272 | AttributePoint &point = attributePoints.last(); | - | ||||||||||||||||||
| 273 | point.values[percentString] = percent->value(); | - | ||||||||||||||||||
| 274 | interpolate(attributePoints, attributePoints.count() - 1, percentString, percent->value()); | - | ||||||||||||||||||
| 275 | usesPercent = true; | - | ||||||||||||||||||
| 276 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 277 | } executed 1388 times by 5 tests: end of blockExecuted by:
| 1388 | ||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | const AttributePoint &last = attributePoints.constLast(); | - | ||||||||||||||||||
| 281 | for (int ii = 0; ii < attributes.count()
| 216-380 | ||||||||||||||||||
| 282 | if (!last.values.contains(attributes.at(ii))
| 38-178 | ||||||||||||||||||
| 283 | endpoint(attributePoints, attributes.at(ii)); executed 38 times by 2 tests: endpoint(attributePoints, attributes.at(ii));Executed by:
| 38 | ||||||||||||||||||
| 284 | } executed 216 times by 2 tests: end of blockExecuted by:
| 216 | ||||||||||||||||||
| 285 | if (usesPercent
| 0-376 | ||||||||||||||||||
| 286 | d->_attributePoints.last().values[percentString] = 1; | - | ||||||||||||||||||
| 287 | interpolate(d->_attributePoints.count() - 1, percentString, 1); | - | ||||||||||||||||||
| 288 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | - | |||||||||||||||||||
| 292 | qreal length = path.length(); | - | ||||||||||||||||||
| 293 | qreal prevpercent = 0; | - | ||||||||||||||||||
| 294 | qreal prevorigpercent = 0; | - | ||||||||||||||||||
| 295 | for (int ii = 0; ii < attributePoints.count()
| 380-1164 | ||||||||||||||||||
| 296 | const AttributePoint &point = attributePoints.at(ii); | - | ||||||||||||||||||
| 297 | if (point.values.contains(percentString)
| 14-1150 | ||||||||||||||||||
| 298 | if ( ii > 0
| 4-10 | ||||||||||||||||||
| 299 | qreal scale = (attributePoints[ii].origpercent/length - prevorigpercent) / | - | ||||||||||||||||||
| 300 | (point.values.value(percentString)-prevpercent); | - | ||||||||||||||||||
| 301 | attributePoints[ii].scale = scale; | - | ||||||||||||||||||
| 302 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 303 | attributePoints[ii].origpercent /= length; | - | ||||||||||||||||||
| 304 | attributePoints[ii].percent = point.values.value(percentString); | - | ||||||||||||||||||
| 305 | prevorigpercent = attributePoints.at(ii).origpercent; | - | ||||||||||||||||||
| 306 | prevpercent = attributePoints.at(ii).percent; | - | ||||||||||||||||||
| 307 | } executed 14 times by 1 test: else {end of blockExecuted by:
| 14 | ||||||||||||||||||
| 308 | attributePoints[ii].origpercent /= length; | - | ||||||||||||||||||
| 309 | attributePoints[ii].percent = attributePoints.at(ii).origpercent; | - | ||||||||||||||||||
| 310 | } executed 1150 times by 5 tests: end of blockExecuted by:
| 1150 | ||||||||||||||||||
| 311 | } | - | ||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | if (closed
| 10-370 | ||||||||||||||||||
| 314 | QPointF end = path.currentPosition(); | - | ||||||||||||||||||
| 315 | *closed = length > 0
| 18-352 | ||||||||||||||||||
| 316 | } executed 370 times by 5 tests: end of blockExecuted by:
| 370 | ||||||||||||||||||
| 317 | pathLength = length; | - | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | return executed 380 times by 5 tests: path;return path;Executed by:
executed 380 times by 5 tests: return path;Executed by:
| 380 | ||||||||||||||||||
| 320 | } | - | ||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | QPainterPath QQuickPath::createShapePath(const QPointF &startPoint, const QPointF &endPoint, qreal &pathLength, bool *closed) | - | ||||||||||||||||||
| 323 | { | - | ||||||||||||||||||
| 324 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 325 | - | |||||||||||||||||||
| 326 | if (!d->componentComplete
| 0-1158 | ||||||||||||||||||
| 327 | return never executed: QPainterPath();return QPainterPath();never executed: return QPainterPath(); | 0 | ||||||||||||||||||
| 328 | - | |||||||||||||||||||
| 329 | QPainterPath path; | - | ||||||||||||||||||
| 330 | - | |||||||||||||||||||
| 331 | qreal startX = d->startX.isValid()
| 176-982 | ||||||||||||||||||
| 332 | qreal startY = d->startY.isValid()
| 176-982 | ||||||||||||||||||
| 333 | path.moveTo(startX, startY); | - | ||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | int index = 0; | - | ||||||||||||||||||
| 336 | for (QQuickCurve *curve : qAsConst(d->_pathCurves)) { | - | ||||||||||||||||||
| 337 | QQuickPathData data; | - | ||||||||||||||||||
| 338 | data.index = index; | - | ||||||||||||||||||
| 339 | data.endPoint = endPoint; | - | ||||||||||||||||||
| 340 | data.curves = d->_pathCurves; | - | ||||||||||||||||||
| 341 | curve->addToPath(path, data); | - | ||||||||||||||||||
| 342 | ++index; | - | ||||||||||||||||||
| 343 | } executed 9580 times by 2 tests: end of blockExecuted by:
| 9580 | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | if (closed
| 0-1158 | ||||||||||||||||||
| 346 | QPointF end = path.currentPosition(); | - | ||||||||||||||||||
| 347 | *closed = startX == end.x()
| 8-1092 | ||||||||||||||||||
| 348 | } executed 1158 times by 2 tests: end of blockExecuted by:
| 1158 | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | - | |||||||||||||||||||
| 351 | - | |||||||||||||||||||
| 352 | - | |||||||||||||||||||
| 353 | pathLength = 0; | - | ||||||||||||||||||
| 354 | - | |||||||||||||||||||
| 355 | return executed 1158 times by 2 tests: path;return path;Executed by:
executed 1158 times by 2 tests: return path;Executed by:
| 1158 | ||||||||||||||||||
| 356 | } | - | ||||||||||||||||||
| 357 | - | |||||||||||||||||||
| 358 | void QQuickPath::classBegin() | - | ||||||||||||||||||
| 359 | { | - | ||||||||||||||||||
| 360 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 361 | d->componentComplete = false; | - | ||||||||||||||||||
| 362 | } executed 1402 times by 6 tests: end of blockExecuted by:
| 1402 | ||||||||||||||||||
| 363 | - | |||||||||||||||||||
| 364 | void QQuickPath::disconnectPathElements() | - | ||||||||||||||||||
| 365 | { | - | ||||||||||||||||||
| 366 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | for (QQuickPathElement *pathElement : d->_pathElements) | - | ||||||||||||||||||
| 369 | disconnect(pathElement, qFlagLocation("2""changed()" "\0" __FILE__ ":" "548"), this, qFlagLocation("1""processPath()" "\0" __FILE__ ":" "548")); executed 10 times by 1 test: disconnect(pathElement, qFlagLocation("2""changed()" "\0" __FILE__ ":" "548"), this, qFlagLocation("1""processPath()" "\0" __FILE__ ":" "548"));Executed by:
| 10 | ||||||||||||||||||
| 370 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 371 | - | |||||||||||||||||||
| 372 | void QQuickPath::connectPathElements() | - | ||||||||||||||||||
| 373 | { | - | ||||||||||||||||||
| 374 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | for (QQuickPathElement *pathElement : d->_pathElements) | - | ||||||||||||||||||
| 377 | connect(pathElement, qFlagLocation("2""changed()" "\0" __FILE__ ":" "556"), this, qFlagLocation("1""processPath()" "\0" __FILE__ ":" "556")); executed 10642 times by 6 tests: connect(pathElement, qFlagLocation("2""changed()" "\0" __FILE__ ":" "556"), this, qFlagLocation("1""processPath()" "\0" __FILE__ ":" "556"));Executed by:
| 10642 | ||||||||||||||||||
| 378 | } executed 1402 times by 6 tests: end of blockExecuted by:
| 1402 | ||||||||||||||||||
| 379 | - | |||||||||||||||||||
| 380 | void QQuickPath::gatherAttributes() | - | ||||||||||||||||||
| 381 | { | - | ||||||||||||||||||
| 382 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 383 | - | |||||||||||||||||||
| 384 | QSet<QString> attributes; | - | ||||||||||||||||||
| 385 | - | |||||||||||||||||||
| 386 | - | |||||||||||||||||||
| 387 | for (QQuickPathElement *pathElement : qAsConst(d->_pathElements)) { | - | ||||||||||||||||||
| 388 | if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement)
| 542-10100 | ||||||||||||||||||
| 389 | d->_pathCurves.append(curve); executed 10100 times by 6 tests: d->_pathCurves.append(curve);Executed by:
| 10100 | ||||||||||||||||||
| 390 | else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement)
| 4-538 | ||||||||||||||||||
| 391 | attributes.insert(attribute->name()); executed 538 times by 2 tests: attributes.insert(attribute->name());Executed by:
| 538 | ||||||||||||||||||
| 392 | } executed 10642 times by 6 tests: end of blockExecuted by:
| 10642 | ||||||||||||||||||
| 393 | - | |||||||||||||||||||
| 394 | d->_attributes = attributes.toList(); | - | ||||||||||||||||||
| 395 | } executed 1402 times by 6 tests: end of blockExecuted by:
| 1402 | ||||||||||||||||||
| 396 | - | |||||||||||||||||||
| 397 | void QQuickPath::componentComplete() | - | ||||||||||||||||||
| 398 | { | - | ||||||||||||||||||
| 399 | QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 400 | d->componentComplete = true; | - | ||||||||||||||||||
| 401 | - | |||||||||||||||||||
| 402 | gatherAttributes(); | - | ||||||||||||||||||
| 403 | - | |||||||||||||||||||
| 404 | processPath(); | - | ||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | connectPathElements(); | - | ||||||||||||||||||
| 407 | } executed 1402 times by 6 tests: end of blockExecuted by:
| 1402 | ||||||||||||||||||
| 408 | - | |||||||||||||||||||
| 409 | QPainterPath QQuickPath::path() const | - | ||||||||||||||||||
| 410 | { | - | ||||||||||||||||||
| 411 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 412 | return executed 1239 times by 4 tests: d->_path;return d->_path;Executed by:
executed 1239 times by 4 tests: return d->_path;Executed by:
| 1239 | ||||||||||||||||||
| 413 | } | - | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | QStringList QQuickPath::attributes() const | - | ||||||||||||||||||
| 416 | { | - | ||||||||||||||||||
| 417 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 418 | if (!d->componentComplete
| 0-44259 | ||||||||||||||||||
| 419 | QSet<QString> attrs; | - | ||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | - | |||||||||||||||||||
| 422 | for (QQuickPathElement *pathElement : d->_pathElements) { | - | ||||||||||||||||||
| 423 | if (QQuickPathAttribute *attribute =
| 0 | ||||||||||||||||||
| 424 | qobject_cast<QQuickPathAttribute *>(pathElement)
| 0 | ||||||||||||||||||
| 425 | attrs.insert(attribute->name()); never executed: attrs.insert(attribute->name()); | 0 | ||||||||||||||||||
| 426 | } never executed: end of block | 0 | ||||||||||||||||||
| 427 | return never executed: attrs.toList();return attrs.toList();never executed: return attrs.toList(); | 0 | ||||||||||||||||||
| 428 | } | - | ||||||||||||||||||
| 429 | return executed 44259 times by 3 tests: d->_attributes;return d->_attributes;Executed by:
executed 44259 times by 3 tests: return d->_attributes;Executed by:
| 44259 | ||||||||||||||||||
| 430 | } | - | ||||||||||||||||||
| 431 | - | |||||||||||||||||||
| 432 | static inline QBezier nextBezier(const QPainterPath &path, int *current, qreal *bezLength, bool reverse = false) | - | ||||||||||||||||||
| 433 | { | - | ||||||||||||||||||
| 434 | const int lastElement = reverse
| 18-708 | ||||||||||||||||||
| 435 | const int start = reverse
| 18-708 | ||||||||||||||||||
| 436 | for (int i=start; reverse
| 0-1554 | ||||||||||||||||||
| 437 | const QPainterPath::Element &e = path.elementAt(i); | - | ||||||||||||||||||
| 438 | - | |||||||||||||||||||
| 439 | switch (e.type) { | - | ||||||||||||||||||
| 440 | case executed 332 times by 5 tests: QPainterPath::MoveToElement:case QPainterPath::MoveToElement:Executed by:
executed 332 times by 5 tests: case QPainterPath::MoveToElement:Executed by:
| 332 | ||||||||||||||||||
| 441 | break; executed 332 times by 5 tests: break;Executed by:
| 332 | ||||||||||||||||||
| 442 | case executed 234 times by 5 tests: QPainterPath::LineToElement:case QPainterPath::LineToElement:Executed by:
executed 234 times by 5 tests: case QPainterPath::LineToElement:Executed by:
| 234 | ||||||||||||||||||
| 443 | { | - | ||||||||||||||||||
| 444 | QLineF line(path.elementAt(i-1), e); | - | ||||||||||||||||||
| 445 | *bezLength = line.length(); | - | ||||||||||||||||||
| 446 | QPointF a = path.elementAt(i-1); | - | ||||||||||||||||||
| 447 | QPointF delta = e - a; | - | ||||||||||||||||||
| 448 | *current = i; | - | ||||||||||||||||||
| 449 | return executed 234 times by 5 tests: QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);Executed by:
executed 234 times by 5 tests: return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);Executed by:
| 234 | ||||||||||||||||||
| 450 | } | - | ||||||||||||||||||
| 451 | case executed 492 times by 4 tests: QPainterPath::CurveToElement:case QPainterPath::CurveToElement:Executed by:
executed 492 times by 4 tests: case QPainterPath::CurveToElement:Executed by:
| 492 | ||||||||||||||||||
| 452 | { | - | ||||||||||||||||||
| 453 | QBezier b = QBezier::fromPoints(path.elementAt(i-1), | - | ||||||||||||||||||
| 454 | e, | - | ||||||||||||||||||
| 455 | path.elementAt(i+1), | - | ||||||||||||||||||
| 456 | path.elementAt(i+2)); | - | ||||||||||||||||||
| 457 | *bezLength = b.length(); | - | ||||||||||||||||||
| 458 | *current = i; | - | ||||||||||||||||||
| 459 | return executed 492 times by 4 tests: b;return b;Executed by:
executed 492 times by 4 tests: return b;Executed by:
| 492 | ||||||||||||||||||
| 460 | } | - | ||||||||||||||||||
| 461 | default executed 496 times by 4 tests: :default:Executed by:
executed 496 times by 4 tests: default:Executed by:
| 496 | ||||||||||||||||||
| 462 | break; executed 496 times by 4 tests: break;Executed by:
| 496 | ||||||||||||||||||
| 463 | } | - | ||||||||||||||||||
| 464 | } | - | ||||||||||||||||||
| 465 | *current = lastElement; | - | ||||||||||||||||||
| 466 | *bezLength = 0; | - | ||||||||||||||||||
| 467 | return never executed: QBezier();return QBezier();never executed: return QBezier(); | 0 | ||||||||||||||||||
| 468 | } | - | ||||||||||||||||||
| 469 | - | |||||||||||||||||||
| 470 | static inline int segmentCount(const QPainterPath &path, qreal pathLength) | - | ||||||||||||||||||
| 471 | { | - | ||||||||||||||||||
| 472 | - | |||||||||||||||||||
| 473 | - | |||||||||||||||||||
| 474 | if (path.elementCount() == 2
| 68-236 | ||||||||||||||||||
| 475 | && path.elementAt(0).type == QPainterPath::MoveToElement
| 0-68 | ||||||||||||||||||
| 476 | && path.elementAt(1).type == QPainterPath::LineToElement
| 0-68 | ||||||||||||||||||
| 477 | return executed 68 times by 4 tests: 1;return 1;Executed by:
executed 68 times by 4 tests: return 1;Executed by:
| 68 | ||||||||||||||||||
| 478 | } | - | ||||||||||||||||||
| 479 | - | |||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | return executed 236 times by 3 tests: qCeil(pathLength*5);return qCeil(pathLength*5);Executed by:
executed 236 times by 3 tests: return qCeil(pathLength*5);Executed by:
| 236 | ||||||||||||||||||
| 482 | } | - | ||||||||||||||||||
| 483 | - | |||||||||||||||||||
| 484 | - | |||||||||||||||||||
| 485 | static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d) | - | ||||||||||||||||||
| 486 | { | - | ||||||||||||||||||
| 487 | return executed 76 times by 2 tests: 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a);return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a);Executed by:
executed 76 times by 2 tests: return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a);Executed by:
| 76 | ||||||||||||||||||
| 488 | } | - | ||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | void QQuickPath::createPointCache() const | - | ||||||||||||||||||
| 491 | { | - | ||||||||||||||||||
| 492 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 493 | qreal pathLength = d->pathLength; | - | ||||||||||||||||||
| 494 | if (pathLength <= 0
| 0-304 | ||||||||||||||||||
| 495 | return; executed 40 times by 1 test: return;Executed by:
| 40 | ||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | const int segments = segmentCount(d->_path, pathLength); | - | ||||||||||||||||||
| 498 | const int lastElement = d->_path.elementCount() - 1; | - | ||||||||||||||||||
| 499 | d->_pointCache.resize(segments+1); | - | ||||||||||||||||||
| 500 | - | |||||||||||||||||||
| 501 | int currElement = -1; | - | ||||||||||||||||||
| 502 | qreal bezLength = 0; | - | ||||||||||||||||||
| 503 | QBezier currBez = nextBezier(d->_path, &currElement, &bezLength); | - | ||||||||||||||||||
| 504 | qreal currLength = bezLength; | - | ||||||||||||||||||
| 505 | qreal epc = currLength / pathLength; | - | ||||||||||||||||||
| 506 | - | |||||||||||||||||||
| 507 | for (int i = 0; i < d->_pointCache.size()
| 304-824862 | ||||||||||||||||||
| 508 | - | |||||||||||||||||||
| 509 | qreal prevPercent = 0; | - | ||||||||||||||||||
| 510 | qreal prevOrigPercent = 0; | - | ||||||||||||||||||
| 511 | for (int ii = 0; ii < d->_attributePoints.count()
| 0-2264210 | ||||||||||||||||||
| 512 | qreal percent = qreal(i)/segments; | - | ||||||||||||||||||
| 513 | const AttributePoint &point = d->_attributePoints.at(ii); | - | ||||||||||||||||||
| 514 | if (percent < point.percent
| 304-1439652 | ||||||||||||||||||
| 515 | qreal elementPercent = (percent - prevPercent); | - | ||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | qreal spc = prevOrigPercent + elementPercent * point.scale; | - | ||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | while (spc > epc
| 358-824862 | ||||||||||||||||||
| 520 | if (currElement > lastElement
| 0-358 | ||||||||||||||||||
| 521 | break; never executed: break; | 0 | ||||||||||||||||||
| 522 | currBez = nextBezier(d->_path, &currElement, &bezLength); | - | ||||||||||||||||||
| 523 | if (bezLength == 0.0
| 0-358 | ||||||||||||||||||
| 524 | currLength = pathLength; | - | ||||||||||||||||||
| 525 | epc = 1.0; | - | ||||||||||||||||||
| 526 | break; never executed: break; | 0 | ||||||||||||||||||
| 527 | } | - | ||||||||||||||||||
| 528 | currLength += bezLength; | - | ||||||||||||||||||
| 529 | epc = currLength / pathLength; | - | ||||||||||||||||||
| 530 | } executed 358 times by 3 tests: end of blockExecuted by:
| 358 | ||||||||||||||||||
| 531 | qreal realT = (pathLength * spc - (currLength - bezLength)) / bezLength; | - | ||||||||||||||||||
| 532 | d->_pointCache[i] = currBez.pointAt(qBound(qreal(0), realT, qreal(1))); | - | ||||||||||||||||||
| 533 | break; executed 824862 times by 4 tests: break;Executed by:
| 824862 | ||||||||||||||||||
| 534 | } | - | ||||||||||||||||||
| 535 | prevOrigPercent = point.origpercent; | - | ||||||||||||||||||
| 536 | prevPercent = point.percent; | - | ||||||||||||||||||
| 537 | } executed 1439348 times by 4 tests: end of blockExecuted by:
| 1439348 | ||||||||||||||||||
| 538 | } executed 824862 times by 4 tests: end of blockExecuted by:
| 824862 | ||||||||||||||||||
| 539 | } executed 304 times by 4 tests: end of blockExecuted by:
| 304 | ||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | void QQuickPath::invalidateSequentialHistory() const | - | ||||||||||||||||||
| 542 | { | - | ||||||||||||||||||
| 543 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 544 | d->prevBez.isValid = false; | - | ||||||||||||||||||
| 545 | } executed 24 times by 2 tests: end of blockExecuted by:
| 24 | ||||||||||||||||||
| 546 | - | |||||||||||||||||||
| 547 | QPointF QQuickPath::sequentialPointAt(qreal p, qreal *angle) const | - | ||||||||||||||||||
| 548 | { | - | ||||||||||||||||||
| 549 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 550 | return executed 186 times by 2 tests: sequentialPointAt(d->_path, d->pathLength, d->_attributePoints, d->prevBez, p, angle);return sequentialPointAt(d->_path, d->pathLength, d->_attributePoints, d->prevBez, p, angle);Executed by:
executed 186 times by 2 tests: return sequentialPointAt(d->_path, d->pathLength, d->_attributePoints, d->prevBez, p, angle);Executed by:
| 186 | ||||||||||||||||||
| 551 | } | - | ||||||||||||||||||
| 552 | - | |||||||||||||||||||
| 553 | QPointF QQuickPath::sequentialPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle) | - | ||||||||||||||||||
| 554 | { | - | ||||||||||||||||||
| 555 | ((p >= 0.0 && p <= 1.0) ? static_cast<void>(0) : qt_assert("p >= 0.0 && p <= 1.0", __FILE__, 734)); | - | ||||||||||||||||||
| 556 | - | |||||||||||||||||||
| 557 | if (!prevBez.isValid
| 32-281 | ||||||||||||||||||
| 558 | return executed 32 times by 2 tests: p > .5 ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) :return p > .5 ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);Executed by:
executed 32 times by 2 tests: return p > .5 ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);Executed by:
| 32 | ||||||||||||||||||
| 559 | forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle); executed 32 times by 2 tests: return p > .5 ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);Executed by:
| 32 | ||||||||||||||||||
| 560 | - | |||||||||||||||||||
| 561 | return executed 281 times by 1 test: p < prevBez.p ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) :return p < prevBez.p ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);Executed by:
executed 281 times by 1 test: return p < prevBez.p ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);Executed by:
| 281 | ||||||||||||||||||
| 562 | forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle); executed 281 times by 1 test: return p < prevBez.p ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);Executed by:
| 281 | ||||||||||||||||||
| 563 | } | - | ||||||||||||||||||
| 564 | - | |||||||||||||||||||
| 565 | QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle) | - | ||||||||||||||||||
| 566 | { | - | ||||||||||||||||||
| 567 | if (pathLength <= 0
| 0-265 | ||||||||||||||||||
| 568 | return executed 2 times by 1 test: path.pointAtPercent(0);return path.pointAtPercent(0);Executed by:
executed 2 times by 1 test: return path.pointAtPercent(0);Executed by:
| 2 | ||||||||||||||||||
| 569 | - | |||||||||||||||||||
| 570 | const int lastElement = path.elementCount() - 1; | - | ||||||||||||||||||
| 571 | bool haveCachedBez = prevBez.isValid; | - | ||||||||||||||||||
| 572 | int currElement = haveCachedBez
| 28-237 | ||||||||||||||||||
| 573 | qreal bezLength = haveCachedBez
| 28-237 | ||||||||||||||||||
| 574 | QBezier currBez = haveCachedBez
| 28-237 | ||||||||||||||||||
| 575 | qreal currLength = haveCachedBez
| 28-237 | ||||||||||||||||||
| 576 | qreal epc = currLength / pathLength; | - | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | - | |||||||||||||||||||
| 579 | qreal prevPercent = 0; | - | ||||||||||||||||||
| 580 | qreal prevOrigPercent = 0; | - | ||||||||||||||||||
| 581 | for (int ii = 0; ii < attributePoints.count()
| 0-696 | ||||||||||||||||||
| 582 | qreal percent = p; | - | ||||||||||||||||||
| 583 | const AttributePoint &point = attributePoints.at(ii); | - | ||||||||||||||||||
| 584 | if (percent < point.percent
| 30-461 | ||||||||||||||||||
| 585 | qreal elementPercent = (percent - prevPercent); | - | ||||||||||||||||||
| 586 | - | |||||||||||||||||||
| 587 | qreal spc = prevOrigPercent + elementPercent * point.scale; | - | ||||||||||||||||||
| 588 | - | |||||||||||||||||||
| 589 | while (spc > epc
| 18-265 | ||||||||||||||||||
| 590 | ((!(currElement > lastElement)) ? static_cast<void>(0) : qt_assert("!(currElement > lastElement)", __FILE__, 769)); | - | ||||||||||||||||||
| 591 | (void)lastElement;; | - | ||||||||||||||||||
| 592 | currBez = nextBezier(path, &currElement, &bezLength); | - | ||||||||||||||||||
| 593 | currLength += bezLength; | - | ||||||||||||||||||
| 594 | epc = currLength / pathLength; | - | ||||||||||||||||||
| 595 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||
| 596 | prevBez.element = currElement; | - | ||||||||||||||||||
| 597 | prevBez.bezLength = bezLength; | - | ||||||||||||||||||
| 598 | prevBez.currLength = currLength; | - | ||||||||||||||||||
| 599 | prevBez.bezier = currBez; | - | ||||||||||||||||||
| 600 | prevBez.p = p; | - | ||||||||||||||||||
| 601 | prevBez.isValid = true; | - | ||||||||||||||||||
| 602 | - | |||||||||||||||||||
| 603 | qreal realT = (pathLength * spc - (currLength - bezLength)) / bezLength; | - | ||||||||||||||||||
| 604 | - | |||||||||||||||||||
| 605 | if (angle
| 32-233 | ||||||||||||||||||
| 606 | qreal m1 = slopeAt(realT, currBez.x1, currBez.x2, currBez.x3, currBez.x4); | - | ||||||||||||||||||
| 607 | qreal m2 = slopeAt(realT, currBez.y1, currBez.y2, currBez.y3, currBez.y4); | - | ||||||||||||||||||
| 608 | *angle = QLineF(0, 0, m1, m2).angle(); | - | ||||||||||||||||||
| 609 | } executed 32 times by 2 tests: end of blockExecuted by:
| 32 | ||||||||||||||||||
| 610 | - | |||||||||||||||||||
| 611 | return executed 265 times by 2 tests: currBez.pointAt(qBound(qreal(0), realT, qreal(1)));return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));Executed by:
executed 265 times by 2 tests: return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));Executed by:
| 265 | ||||||||||||||||||
| 612 | } | - | ||||||||||||||||||
| 613 | prevOrigPercent = point.origpercent; | - | ||||||||||||||||||
| 614 | prevPercent = point.percent; | - | ||||||||||||||||||
| 615 | } executed 431 times by 2 tests: end of blockExecuted by:
| 431 | ||||||||||||||||||
| 616 | - | |||||||||||||||||||
| 617 | return never executed: QPointF(0,0);return QPointF(0,0);never executed: return QPointF(0,0); | 0 | ||||||||||||||||||
| 618 | } | - | ||||||||||||||||||
| 619 | - | |||||||||||||||||||
| 620 | - | |||||||||||||||||||
| 621 | QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle) | - | ||||||||||||||||||
| 622 | { | - | ||||||||||||||||||
| 623 | if (pathLength <= 0
| 0-46 | ||||||||||||||||||
| 624 | return never executed: path.pointAtPercent(0);return path.pointAtPercent(0);never executed: return path.pointAtPercent(0); | 0 | ||||||||||||||||||
| 625 | - | |||||||||||||||||||
| 626 | const int firstElement = 1; | - | ||||||||||||||||||
| 627 | bool haveCachedBez = prevBez.isValid; | - | ||||||||||||||||||
| 628 | int currElement = haveCachedBez
| 2-44 | ||||||||||||||||||
| 629 | qreal bezLength = haveCachedBez
| 2-44 | ||||||||||||||||||
| 630 | QBezier currBez = haveCachedBez
| 2-44 | ||||||||||||||||||
| 631 | qreal currLength = haveCachedBez
| 2-44 | ||||||||||||||||||
| 632 | qreal prevLength = currLength - bezLength; | - | ||||||||||||||||||
| 633 | qreal epc = prevLength / pathLength; | - | ||||||||||||||||||
| 634 | - | |||||||||||||||||||
| 635 | for (int ii = attributePoints.count() - 1; ii > 0
| 0-112 | ||||||||||||||||||
| 636 | qreal percent = p; | - | ||||||||||||||||||
| 637 | const AttributePoint &point = attributePoints.at(ii); | - | ||||||||||||||||||
| 638 | const AttributePoint &prevPoint = attributePoints.at(ii-1); | - | ||||||||||||||||||
| 639 | if (percent > prevPoint.percent
| 8-74 | ||||||||||||||||||
| 640 | qreal elementPercent = (percent - prevPoint.percent); | - | ||||||||||||||||||
| 641 | - | |||||||||||||||||||
| 642 | qreal spc = prevPoint.origpercent + elementPercent * point.scale; | - | ||||||||||||||||||
| 643 | - | |||||||||||||||||||
| 644 | while (spc < epc
| 16-46 | ||||||||||||||||||
| 645 | ((!(currElement < firstElement)) ? static_cast<void>(0) : qt_assert("!(currElement < firstElement)", __FILE__, 824)); | - | ||||||||||||||||||
| 646 | (void)firstElement;; | - | ||||||||||||||||||
| 647 | currBez = nextBezier(path, &currElement, &bezLength, true ); | - | ||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | - | |||||||||||||||||||
| 650 | currLength = (
| 6-10 | ||||||||||||||||||
| 651 | prevLength = currLength - bezLength; | - | ||||||||||||||||||
| 652 | epc = prevLength / pathLength; | - | ||||||||||||||||||
| 653 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 654 | prevBez.element = currElement; | - | ||||||||||||||||||
| 655 | prevBez.bezLength = bezLength; | - | ||||||||||||||||||
| 656 | prevBez.currLength = currLength; | - | ||||||||||||||||||
| 657 | prevBez.bezier = currBez; | - | ||||||||||||||||||
| 658 | prevBez.p = p; | - | ||||||||||||||||||
| 659 | prevBez.isValid = true; | - | ||||||||||||||||||
| 660 | - | |||||||||||||||||||
| 661 | qreal realT = (pathLength * spc - (currLength - bezLength)) / bezLength; | - | ||||||||||||||||||
| 662 | - | |||||||||||||||||||
| 663 | if (angle
| 6-40 | ||||||||||||||||||
| 664 | qreal m1 = slopeAt(realT, currBez.x1, currBez.x2, currBez.x3, currBez.x4); | - | ||||||||||||||||||
| 665 | qreal m2 = slopeAt(realT, currBez.y1, currBez.y2, currBez.y3, currBez.y4); | - | ||||||||||||||||||
| 666 | *angle = QLineF(0, 0, m1, m2).angle(); | - | ||||||||||||||||||
| 667 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 668 | - | |||||||||||||||||||
| 669 | return executed 46 times by 1 test: currBez.pointAt(qBound(qreal(0), realT, qreal(1)));return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));Executed by:
executed 46 times by 1 test: return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));Executed by:
| 46 | ||||||||||||||||||
| 670 | } | - | ||||||||||||||||||
| 671 | } executed 66 times by 1 test: end of blockExecuted by:
| 66 | ||||||||||||||||||
| 672 | - | |||||||||||||||||||
| 673 | return never executed: QPointF(0,0);return QPointF(0,0);never executed: return QPointF(0,0); | 0 | ||||||||||||||||||
| 674 | } | - | ||||||||||||||||||
| 675 | - | |||||||||||||||||||
| 676 | QPointF QQuickPath::pointAt(qreal p) const | - | ||||||||||||||||||
| 677 | { | - | ||||||||||||||||||
| 678 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 679 | if (d->_pointCache.isEmpty()
| 344-71609 | ||||||||||||||||||
| 680 | createPointCache(); | - | ||||||||||||||||||
| 681 | if (d->_pointCache.isEmpty()
| 40-304 | ||||||||||||||||||
| 682 | return executed 40 times by 1 test: QPointF();return QPointF();Executed by:
executed 40 times by 1 test: return QPointF();Executed by:
| 40 | ||||||||||||||||||
| 683 | } executed 304 times by 4 tests: end of blockExecuted by:
| 304 | ||||||||||||||||||
| 684 | - | |||||||||||||||||||
| 685 | const int segmentCount = d->_pointCache.size() - 1; | - | ||||||||||||||||||
| 686 | qreal idxf = p*segmentCount; | - | ||||||||||||||||||
| 687 | int idx1 = qFloor(idxf); | - | ||||||||||||||||||
| 688 | qreal delta = idxf - idx1; | - | ||||||||||||||||||
| 689 | if (idx1 > segmentCount
| 0-71913 | ||||||||||||||||||
| 690 | idx1 = segmentCount; never executed: idx1 = segmentCount; | 0 | ||||||||||||||||||
| 691 | else if (idx1 < 0
| 0-71913 | ||||||||||||||||||
| 692 | idx1 = 0; never executed: idx1 = 0; | 0 | ||||||||||||||||||
| 693 | - | |||||||||||||||||||
| 694 | if (delta == 0.0
| 5011-66902 | ||||||||||||||||||
| 695 | return executed 5011 times by 4 tests: d->_pointCache.at(idx1);return d->_pointCache.at(idx1);Executed by:
executed 5011 times by 4 tests: return d->_pointCache.at(idx1);Executed by:
| 5011 | ||||||||||||||||||
| 696 | - | |||||||||||||||||||
| 697 | - | |||||||||||||||||||
| 698 | int idx2 = qCeil(idxf); | - | ||||||||||||||||||
| 699 | if (idx2 > segmentCount
| 0-66902 | ||||||||||||||||||
| 700 | idx2 = segmentCount; never executed: idx2 = segmentCount; | 0 | ||||||||||||||||||
| 701 | else if (idx2 < 0
| 0-66902 | ||||||||||||||||||
| 702 | idx2 = 0; never executed: idx2 = 0; | 0 | ||||||||||||||||||
| 703 | - | |||||||||||||||||||
| 704 | QPointF p1 = d->_pointCache.at(idx1); | - | ||||||||||||||||||
| 705 | QPointF p2 = d->_pointCache.at(idx2); | - | ||||||||||||||||||
| 706 | QPointF pos = p1 * (1.0-delta) + p2 * delta; | - | ||||||||||||||||||
| 707 | - | |||||||||||||||||||
| 708 | return executed 66902 times by 4 tests: pos;return pos;Executed by:
executed 66902 times by 4 tests: return pos;Executed by:
| 66902 | ||||||||||||||||||
| 709 | } | - | ||||||||||||||||||
| 710 | - | |||||||||||||||||||
| 711 | qreal QQuickPath::attributeAt(const QString &name, qreal percent) const | - | ||||||||||||||||||
| 712 | { | - | ||||||||||||||||||
| 713 | const QQuickPathPrivate * const d = d_func(); | - | ||||||||||||||||||
| 714 | if (percent < 0
| 0-5156 | ||||||||||||||||||
| 715 | return executed 244 times by 1 test: 0;return 0;Executed by:
executed 244 times by 1 test: return 0;Executed by:
| 244 | ||||||||||||||||||
| 716 | - | |||||||||||||||||||
| 717 | for (int ii = 0; ii < d->_attributePoints.count()
| 24-11116 | ||||||||||||||||||
| 718 | const AttributePoint &point = d->_attributePoints.at(ii); | - | ||||||||||||||||||
| 719 | - | |||||||||||||||||||
| 720 | if (point.percent == percent
| 1452-9664 | ||||||||||||||||||
| 721 | return executed 1452 times by 2 tests: point.values.value(name);return point.values.value(name);Executed by:
executed 1452 times by 2 tests: return point.values.value(name);Executed by:
| 1452 | ||||||||||||||||||
| 722 | } else if (point.percent > percent
| 3436-6228 | ||||||||||||||||||
| 723 | qreal lastValue = | - | ||||||||||||||||||
| 724 | ii
| 0-3436 | ||||||||||||||||||
| 725 | qreal lastPercent = | - | ||||||||||||||||||
| 726 | ii
| 0-3436 | ||||||||||||||||||
| 727 | qreal curValue = point.values.value(name); | - | ||||||||||||||||||
| 728 | qreal curPercent = point.percent; | - | ||||||||||||||||||
| 729 | - | |||||||||||||||||||
| 730 | return executed 3436 times by 2 tests: lastValue + (curValue - lastValue) * (percent - lastPercent) / (curPercent - lastPercent);return lastValue + (curValue - lastValue) * (percent - lastPercent) / (curPercent - lastPercent);Executed by:
executed 3436 times by 2 tests: return lastValue + (curValue - lastValue) * (percent - lastPercent) / (curPercent - lastPercent);Executed by:
| 3436 | ||||||||||||||||||
| 731 | } | - | ||||||||||||||||||
| 732 | } executed 6228 times by 2 tests: end of blockExecuted by:
| 6228 | ||||||||||||||||||
| 733 | - | |||||||||||||||||||
| 734 | return executed 24 times by 1 test: 0;return 0;Executed by:
executed 24 times by 1 test: return 0;Executed by:
| 24 | ||||||||||||||||||
| 735 | } | - | ||||||||||||||||||
| 736 | - | |||||||||||||||||||
| 737 | - | |||||||||||||||||||
| 738 | - | |||||||||||||||||||
| 739 | qreal QQuickCurve::x() const | - | ||||||||||||||||||
| 740 | { | - | ||||||||||||||||||
| 741 | return executed 10344 times by 6 tests: _x.isNull ? 0 : _x.value;return _x.isNull ? 0 : _x.value;Executed by:
executed 10344 times by 6 tests: return _x.isNull ? 0 : _x.value;Executed by:
| 10344 | ||||||||||||||||||
| 742 | } | - | ||||||||||||||||||
| 743 | - | |||||||||||||||||||
| 744 | void QQuickCurve::setX(qreal x) | - | ||||||||||||||||||
| 745 | { | - | ||||||||||||||||||
| 746 | if (_x.isNull
| 0-10028 | ||||||||||||||||||
| 747 | _x = x; | - | ||||||||||||||||||
| 748 | xChanged(); | - | ||||||||||||||||||
| 749 | changed(); | - | ||||||||||||||||||
| 750 | } executed 10052 times by 6 tests: end of blockExecuted by:
| 10052 | ||||||||||||||||||
| 751 | } executed 10052 times by 6 tests: end of blockExecuted by:
| 10052 | ||||||||||||||||||
| 752 | - | |||||||||||||||||||
| 753 | bool QQuickCurve::hasX() | - | ||||||||||||||||||
| 754 | { | - | ||||||||||||||||||
| 755 | return executed 1504 times by 6 tests: _x.isValid();return _x.isValid();Executed by:
executed 1504 times by 6 tests: return _x.isValid();Executed by:
| 1504 | ||||||||||||||||||
| 756 | } | - | ||||||||||||||||||
| 757 | - | |||||||||||||||||||
| 758 | qreal QQuickCurve::y() const | - | ||||||||||||||||||
| 759 | { | - | ||||||||||||||||||
| 760 | return executed 10390 times by 6 tests: _y.isNull ? 0 : _y.value;return _y.isNull ? 0 : _y.value;Executed by:
executed 10390 times by 6 tests: return _y.isNull ? 0 : _y.value;Executed by:
| 10390 | ||||||||||||||||||
| 761 | } | - | ||||||||||||||||||
| 762 | - | |||||||||||||||||||
| 763 | void QQuickCurve::setY(qreal y) | - | ||||||||||||||||||
| 764 | { | - | ||||||||||||||||||
| 765 | if (_y.isNull
| 0-10056 | ||||||||||||||||||
| 766 | _y = y; | - | ||||||||||||||||||
| 767 | yChanged(); | - | ||||||||||||||||||
| 768 | changed(); | - | ||||||||||||||||||
| 769 | } executed 10104 times by 6 tests: end of blockExecuted by:
| 10104 | ||||||||||||||||||
| 770 | } executed 10104 times by 6 tests: end of blockExecuted by:
| 10104 | ||||||||||||||||||
| 771 | - | |||||||||||||||||||
| 772 | bool QQuickCurve::hasY() | - | ||||||||||||||||||
| 773 | { | - | ||||||||||||||||||
| 774 | return executed 1524 times by 6 tests: _y.isValid();return _y.isValid();Executed by:
executed 1524 times by 6 tests: return _y.isValid();Executed by:
| 1524 | ||||||||||||||||||
| 775 | } | - | ||||||||||||||||||
| 776 | - | |||||||||||||||||||
| 777 | qreal QQuickCurve::relativeX() const | - | ||||||||||||||||||
| 778 | { | - | ||||||||||||||||||
| 779 | return executed 74 times by 3 tests: _relativeX;return _relativeX;Executed by:
executed 74 times by 3 tests: return _relativeX;Executed by:
| 74 | ||||||||||||||||||
| 780 | } | - | ||||||||||||||||||
| 781 | - | |||||||||||||||||||
| 782 | void QQuickCurve::setRelativeX(qreal x) | - | ||||||||||||||||||
| 783 | { | - | ||||||||||||||||||
| 784 | if (_relativeX.isNull
| 0-54 | ||||||||||||||||||
| 785 | _relativeX = x; | - | ||||||||||||||||||
| 786 | relativeXChanged(); | - | ||||||||||||||||||
| 787 | changed(); | - | ||||||||||||||||||
| 788 | } executed 54 times by 3 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||
| 789 | } executed 54 times by 3 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||
| 790 | - | |||||||||||||||||||
| 791 | bool QQuickCurve::hasRelativeX() | - | ||||||||||||||||||
| 792 | { | - | ||||||||||||||||||
| 793 | return executed 10420 times by 6 tests: _relativeX.isValid();return _relativeX.isValid();Executed by:
executed 10420 times by 6 tests: return _relativeX.isValid();Executed by:
| 10420 | ||||||||||||||||||
| 794 | } | - | ||||||||||||||||||
| 795 | - | |||||||||||||||||||
| 796 | qreal QQuickCurve::relativeY() const | - | ||||||||||||||||||
| 797 | { | - | ||||||||||||||||||
| 798 | return executed 28 times by 2 tests: _relativeY;return _relativeY;Executed by:
executed 28 times by 2 tests: return _relativeY;Executed by:
| 28 | ||||||||||||||||||
| 799 | } | - | ||||||||||||||||||
| 800 | - | |||||||||||||||||||
| 801 | void QQuickCurve::setRelativeY(qreal y) | - | ||||||||||||||||||
| 802 | { | - | ||||||||||||||||||
| 803 | if (_relativeY.isNull
| 0-26 | ||||||||||||||||||
| 804 | _relativeY = y; | - | ||||||||||||||||||
| 805 | relativeYChanged(); | - | ||||||||||||||||||
| 806 | changed(); | - | ||||||||||||||||||
| 807 | } executed 26 times by 2 tests: end of blockExecuted by:
| 26 | ||||||||||||||||||
| 808 | } executed 26 times by 2 tests: end of blockExecuted by:
| 26 | ||||||||||||||||||
| 809 | - | |||||||||||||||||||
| 810 | bool QQuickCurve::hasRelativeY() | - | ||||||||||||||||||
| 811 | { | - | ||||||||||||||||||
| 812 | return executed 10420 times by 6 tests: _relativeY.isValid();return _relativeY.isValid();Executed by:
executed 10420 times by 6 tests: return _relativeY.isValid();Executed by:
| 10420 | ||||||||||||||||||
| 813 | } | - | ||||||||||||||||||
| 814 | QString QQuickPathAttribute::name() const | - | ||||||||||||||||||
| 815 | { | - | ||||||||||||||||||
| 816 | return executed 1764 times by 2 tests: _name;return _name;Executed by:
executed 1764 times by 2 tests: return _name;Executed by:
| 1764 | ||||||||||||||||||
| 817 | } | - | ||||||||||||||||||
| 818 | - | |||||||||||||||||||
| 819 | void QQuickPathAttribute::setName(const QString &name) | - | ||||||||||||||||||
| 820 | { | - | ||||||||||||||||||
| 821 | if (_name == name
| 2-546 | ||||||||||||||||||
| 822 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||
| 823 | _name = name; | - | ||||||||||||||||||
| 824 | nameChanged(); | - | ||||||||||||||||||
| 825 | } executed 546 times by 2 tests: end of blockExecuted by:
| 546 | ||||||||||||||||||
| 826 | qreal QQuickPathAttribute::value() const | - | ||||||||||||||||||
| 827 | { | - | ||||||||||||||||||
| 828 | return executed 1202 times by 2 tests: _value;return _value;Executed by:
executed 1202 times by 2 tests: return _value;Executed by:
| 1202 | ||||||||||||||||||
| 829 | } | - | ||||||||||||||||||
| 830 | - | |||||||||||||||||||
| 831 | void QQuickPathAttribute::setValue(qreal value) | - | ||||||||||||||||||
| 832 | { | - | ||||||||||||||||||
| 833 | if (_value != value
| 98-440 | ||||||||||||||||||
| 834 | _value = value; | - | ||||||||||||||||||
| 835 | valueChanged(); | - | ||||||||||||||||||
| 836 | changed(); | - | ||||||||||||||||||
| 837 | } executed 440 times by 2 tests: end of blockExecuted by:
| 440 | ||||||||||||||||||
| 838 | } executed 538 times by 2 tests: end of blockExecuted by:
| 538 | ||||||||||||||||||
| 839 | inline QPointF positionForCurve(const QQuickPathData &data, const QPointF &prevPoint) | - | ||||||||||||||||||
| 840 | { | - | ||||||||||||||||||
| 841 | QQuickCurve *curve = data.curves.at(data.index); | - | ||||||||||||||||||
| 842 | bool isEnd = data.index == data.curves.size() - 1; | - | ||||||||||||||||||
| 843 | return executed 10420 times by 6 tests: QPointF(curve->hasRelativeX() ? prevPoint.x() + curve->relativeX() : !isEnd || curve->hasX() ? curve->x() : data.endPoint.x(),return QPointF(curve->hasRelativeX() ? prevPoint.x() + curve->relativeX() : !isEnd || curve->hasX() ? curve->x() : data.endPoint.x(), curve->hasRelativeY() ? prevPoint.y() + curve->relativeY() : !isEnd || curve->hasY() ? curve->y() : data.endPoint.y());Executed by:
executed 10420 times by 6 tests: return QPointF(curve->hasRelativeX() ? prevPoint.x() + curve->relativeX() : !isEnd || curve->hasX() ? curve->x() : data.endPoint.x(), curve->hasRelativeY() ? prevPoint.y() + curve->relativeY() : !isEnd || curve->hasY() ? curve->y() : data.endPoint.y());Executed by:
| 10420 | ||||||||||||||||||
| 844 | curve->hasRelativeY() ? prevPoint.y() + curve->relativeY() : !isEnd || curve->hasY() ? curve->y() : data.endPoint.y()); executed 10420 times by 6 tests: return QPointF(curve->hasRelativeX() ? prevPoint.x() + curve->relativeX() : !isEnd || curve->hasX() ? curve->x() : data.endPoint.x(), curve->hasRelativeY() ? prevPoint.y() + curve->relativeY() : !isEnd || curve->hasY() ? curve->y() : data.endPoint.y());Executed by:
| 10420 | ||||||||||||||||||
| 845 | } | - | ||||||||||||||||||
| 846 | - | |||||||||||||||||||
| 847 | void QQuickPathLine::addToPath(QPainterPath &path, const QQuickPathData &data) | - | ||||||||||||||||||
| 848 | { | - | ||||||||||||||||||
| 849 | path.lineTo(positionForCurve(data, path.currentPosition())); | - | ||||||||||||||||||
| 850 | } executed 1062 times by 6 tests: end of blockExecuted by:
| 1062 | ||||||||||||||||||
| 851 | void QQuickPathMove::addToPath(QPainterPath &path, const QQuickPathData &data) | - | ||||||||||||||||||
| 852 | { | - | ||||||||||||||||||
| 853 | path.moveTo(positionForCurve(data, path.currentPosition())); | - | ||||||||||||||||||
| 854 | } executed 972 times by 1 test: end of blockExecuted by:
| 972 | ||||||||||||||||||
| 855 | qreal QQuickPathQuad::controlX() const | - | ||||||||||||||||||
| 856 | { | - | ||||||||||||||||||
| 857 | return executed 188 times by 3 tests: _controlX;return _controlX;Executed by:
executed 188 times by 3 tests: return _controlX;Executed by:
| 188 | ||||||||||||||||||
| 858 | } | - | ||||||||||||||||||
| 859 | - | |||||||||||||||||||
| 860 | void QQuickPathQuad::setControlX(qreal x) | - | ||||||||||||||||||
| 861 | { | - | ||||||||||||||||||
| 862 | if (_controlX != x
| 16-162 | ||||||||||||||||||
| 863 | _controlX = x; | - | ||||||||||||||||||
| 864 | controlXChanged(); | - | ||||||||||||||||||
| 865 | changed(); | - | ||||||||||||||||||
| 866 | } executed 162 times by 3 tests: end of blockExecuted by:
| 162 | ||||||||||||||||||
| 867 | } executed 178 times by 3 tests: end of blockExecuted by:
| 178 | ||||||||||||||||||
| 868 | - | |||||||||||||||||||
| 869 | - | |||||||||||||||||||
| 870 | - | |||||||||||||||||||
| 871 | - | |||||||||||||||||||
| 872 | - | |||||||||||||||||||
| 873 | qreal QQuickPathQuad::controlY() const | - | ||||||||||||||||||
| 874 | { | - | ||||||||||||||||||
| 875 | return executed 188 times by 3 tests: _controlY;return _controlY;Executed by:
executed 188 times by 3 tests: return _controlY;Executed by:
| 188 | ||||||||||||||||||
| 876 | } | - | ||||||||||||||||||
| 877 | - | |||||||||||||||||||
| 878 | void QQuickPathQuad::setControlY(qreal y) | - | ||||||||||||||||||
| 879 | { | - | ||||||||||||||||||
| 880 | if (_controlY != y
| 4-174 | ||||||||||||||||||
| 881 | _controlY = y; | - | ||||||||||||||||||
| 882 | controlYChanged(); | - | ||||||||||||||||||
| 883 | changed(); | - | ||||||||||||||||||
| 884 | } executed 174 times by 3 tests: end of blockExecuted by:
| 174 | ||||||||||||||||||
| 885 | } executed 178 times by 3 tests: end of blockExecuted by:
| 178 | ||||||||||||||||||
| 886 | qreal QQuickPathQuad::relativeControlX() const | - | ||||||||||||||||||
| 887 | { | - | ||||||||||||||||||
| 888 | return never executed: _relativeControlX;return _relativeControlX;never executed: return _relativeControlX; | 0 | ||||||||||||||||||
| 889 | } | - | ||||||||||||||||||
| 890 | - | |||||||||||||||||||
| 891 | void QQuickPathQuad::setRelativeControlX(qreal x) | - | ||||||||||||||||||
| 892 | { | - | ||||||||||||||||||
| 893 | if (_relativeControlX.isNull
| 0 | ||||||||||||||||||
| 894 | _relativeControlX = x; | - | ||||||||||||||||||
| 895 | relativeControlXChanged(); | - | ||||||||||||||||||
| 896 | changed(); | - | ||||||||||||||||||
| 897 | } never executed: end of block | 0 | ||||||||||||||||||
| 898 | } never executed: end of block | 0 | ||||||||||||||||||
| 899 | - | |||||||||||||||||||
| 900 | bool QQuickPathQuad::hasRelativeControlX() | - | ||||||||||||||||||
| 901 | { | - | ||||||||||||||||||
| 902 | return executed 186 times by 3 tests: _relativeControlX.isValid();return _relativeControlX.isValid();Executed by:
executed 186 times by 3 tests: return _relativeControlX.isValid();Executed by:
| 186 | ||||||||||||||||||
| 903 | } | - | ||||||||||||||||||
| 904 | - | |||||||||||||||||||
| 905 | qreal QQuickPathQuad::relativeControlY() const | - | ||||||||||||||||||
| 906 | { | - | ||||||||||||||||||
| 907 | return never executed: _relativeControlY;return _relativeControlY;never executed: return _relativeControlY; | 0 | ||||||||||||||||||
| 908 | } | - | ||||||||||||||||||
| 909 | - | |||||||||||||||||||
| 910 | void QQuickPathQuad::setRelativeControlY(qreal y) | - | ||||||||||||||||||
| 911 | { | - | ||||||||||||||||||
| 912 | if (_relativeControlY.isNull
| 0 | ||||||||||||||||||
| 913 | _relativeControlY = y; | - | ||||||||||||||||||
| 914 | relativeControlYChanged(); | - | ||||||||||||||||||
| 915 | changed(); | - | ||||||||||||||||||
| 916 | } never executed: end of block | 0 | ||||||||||||||||||
| 917 | } never executed: end of block | 0 | ||||||||||||||||||
| 918 | - | |||||||||||||||||||
| 919 | bool QQuickPathQuad::hasRelativeControlY() | - | ||||||||||||||||||
| 920 | { | - | ||||||||||||||||||
| 921 | return executed 186 times by 3 tests: _relativeControlY.isValid();return _relativeControlY.isValid();Executed by:
executed 186 times by 3 tests: return _relativeControlY.isValid();Executed by:
| 186 | ||||||||||||||||||
| 922 | } | - | ||||||||||||||||||
| 923 | - | |||||||||||||||||||
| 924 | void QQuickPathQuad::addToPath(QPainterPath &path, const QQuickPathData &data) | - | ||||||||||||||||||
| 925 | { | - | ||||||||||||||||||
| 926 | const QPointF &prevPoint = path.currentPosition(); | - | ||||||||||||||||||
| 927 | QPointF controlPoint(hasRelativeControlX() ? prevPoint.x() + relativeControlX() : controlX(), | - | ||||||||||||||||||
| 928 | hasRelativeControlY() ? prevPoint.y() + relativeControlY() : controlY()); | - | ||||||||||||||||||
| 929 | path.quadTo(controlPoint, positionForCurve(data, path.currentPosition())); | - | ||||||||||||||||||
| 930 | } executed 186 times by 3 tests: end of blockExecuted by:
| 186 | ||||||||||||||||||
| 931 | qreal QQuickPathCubic::control1X() const | - | ||||||||||||||||||
| 932 | { | - | ||||||||||||||||||
| 933 | return executed 7910 times by 4 tests: _control1X;return _control1X;Executed by:
executed 7910 times by 4 tests: return _control1X;Executed by:
| 7910 | ||||||||||||||||||
| 934 | } | - | ||||||||||||||||||
| 935 | - | |||||||||||||||||||
| 936 | void QQuickPathCubic::setControl1X(qreal x) | - | ||||||||||||||||||
| 937 | { | - | ||||||||||||||||||
| 938 | if (_control1X != x
| 6-7894 | ||||||||||||||||||
| 939 | _control1X = x; | - | ||||||||||||||||||
| 940 | control1XChanged(); | - | ||||||||||||||||||
| 941 | changed(); | - | ||||||||||||||||||
| 942 | } executed 7894 times by 3 tests: end of blockExecuted by:
| 7894 | ||||||||||||||||||
| 943 | } executed 7900 times by 4 tests: end of blockExecuted by:
| 7900 | ||||||||||||||||||
| 944 | - | |||||||||||||||||||
| 945 | qreal QQuickPathCubic::control1Y() const | - | ||||||||||||||||||
| 946 | { | - | ||||||||||||||||||
| 947 | return executed 7910 times by 4 tests: _control1Y;return _control1Y;Executed by:
executed 7910 times by 4 tests: return _control1Y;Executed by:
| 7910 | ||||||||||||||||||
| 948 | } | - | ||||||||||||||||||
| 949 | - | |||||||||||||||||||
| 950 | void QQuickPathCubic::setControl1Y(qreal y) | - | ||||||||||||||||||
| 951 | { | - | ||||||||||||||||||
| 952 | if (_control1Y != y
| 126-7774 | ||||||||||||||||||
| 953 | _control1Y = y; | - | ||||||||||||||||||
| 954 | control1YChanged(); | - | ||||||||||||||||||
| 955 | changed(); | - | ||||||||||||||||||
| 956 | } executed 7774 times by 4 tests: end of blockExecuted by:
| 7774 | ||||||||||||||||||
| 957 | } executed 7900 times by 4 tests: end of blockExecuted by:
| 7900 | ||||||||||||||||||
| 958 | - | |||||||||||||||||||
| 959 | - | |||||||||||||||||||
| 960 | - | |||||||||||||||||||
| 961 | - | |||||||||||||||||||
| 962 | - | |||||||||||||||||||
| 963 | - | |||||||||||||||||||
| 964 | - | |||||||||||||||||||
| 965 | qreal QQuickPathCubic::control2X() const | - | ||||||||||||||||||
| 966 | { | - | ||||||||||||||||||
| 967 | return executed 7910 times by 4 tests: _control2X;return _control2X;Executed by:
executed 7910 times by 4 tests: return _control2X;Executed by:
| 7910 | ||||||||||||||||||
| 968 | } | - | ||||||||||||||||||
| 969 | - | |||||||||||||||||||
| 970 | void QQuickPathCubic::setControl2X(qreal x) | - | ||||||||||||||||||
| 971 | { | - | ||||||||||||||||||
| 972 | if (_control2X != x
| 6-7898 | ||||||||||||||||||
| 973 | _control2X = x; | - | ||||||||||||||||||
| 974 | control2XChanged(); | - | ||||||||||||||||||
| 975 | changed(); | - | ||||||||||||||||||
| 976 | } executed 7898 times by 4 tests: end of blockExecuted by:
| 7898 | ||||||||||||||||||
| 977 | } executed 7904 times by 4 tests: end of blockExecuted by:
| 7904 | ||||||||||||||||||
| 978 | - | |||||||||||||||||||
| 979 | qreal QQuickPathCubic::control2Y() const | - | ||||||||||||||||||
| 980 | { | - | ||||||||||||||||||
| 981 | return executed 7910 times by 4 tests: _control2Y;return _control2Y;Executed by:
executed 7910 times by 4 tests: return _control2Y;Executed by:
| 7910 | ||||||||||||||||||
| 982 | } | - | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | void QQuickPathCubic::setControl2Y(qreal y) | - | ||||||||||||||||||
| 985 | { | - | ||||||||||||||||||
| 986 | if (_control2Y != y
| 124-7776 | ||||||||||||||||||
| 987 | _control2Y = y; | - | ||||||||||||||||||
| 988 | control2YChanged(); | - | ||||||||||||||||||
| 989 | changed(); | - | ||||||||||||||||||
| 990 | } executed 7776 times by 4 tests: end of blockExecuted by:
| 7776 | ||||||||||||||||||
| 991 | } executed 7900 times by 4 tests: end of blockExecuted by:
| 7900 | ||||||||||||||||||
| 992 | qreal QQuickPathCubic::relativeControl1X() const | - | ||||||||||||||||||
| 993 | { | - | ||||||||||||||||||
| 994 | return never executed: _relativeControl1X;return _relativeControl1X;never executed: return _relativeControl1X; | 0 | ||||||||||||||||||
| 995 | } | - | ||||||||||||||||||
| 996 | - | |||||||||||||||||||
| 997 | void QQuickPathCubic::setRelativeControl1X(qreal x) | - | ||||||||||||||||||
| 998 | { | - | ||||||||||||||||||
| 999 | if (_relativeControl1X.isNull
| 0 | ||||||||||||||||||
| 1000 | _relativeControl1X = x; | - | ||||||||||||||||||
| 1001 | relativeControl1XChanged(); | - | ||||||||||||||||||
| 1002 | changed(); | - | ||||||||||||||||||
| 1003 | } never executed: end of block | 0 | ||||||||||||||||||
| 1004 | } never executed: end of block | 0 | ||||||||||||||||||
| 1005 | - | |||||||||||||||||||
| 1006 | bool QQuickPathCubic::hasRelativeControl1X() | - | ||||||||||||||||||
| 1007 | { | - | ||||||||||||||||||
| 1008 | return executed 7908 times by 4 tests: _relativeControl1X.isValid();return _relativeControl1X.isValid();Executed by:
executed 7908 times by 4 tests: return _relativeControl1X.isValid();Executed by:
| 7908 | ||||||||||||||||||
| 1009 | } | - | ||||||||||||||||||
| 1010 | - | |||||||||||||||||||
| 1011 | qreal QQuickPathCubic::relativeControl1Y() const | - | ||||||||||||||||||
| 1012 | { | - | ||||||||||||||||||
| 1013 | return never executed: _relativeControl1Y;return _relativeControl1Y;never executed: return _relativeControl1Y; | 0 | ||||||||||||||||||
| 1014 | } | - | ||||||||||||||||||
| 1015 | - | |||||||||||||||||||
| 1016 | void QQuickPathCubic::setRelativeControl1Y(qreal y) | - | ||||||||||||||||||
| 1017 | { | - | ||||||||||||||||||
| 1018 | if (_relativeControl1Y.isNull
| 0 | ||||||||||||||||||
| 1019 | _relativeControl1Y = y; | - | ||||||||||||||||||
| 1020 | relativeControl1YChanged(); | - | ||||||||||||||||||
| 1021 | changed(); | - | ||||||||||||||||||
| 1022 | } never executed: end of block | 0 | ||||||||||||||||||
| 1023 | } never executed: end of block | 0 | ||||||||||||||||||
| 1024 | - | |||||||||||||||||||
| 1025 | bool QQuickPathCubic::hasRelativeControl1Y() | - | ||||||||||||||||||
| 1026 | { | - | ||||||||||||||||||
| 1027 | return executed 7908 times by 4 tests: _relativeControl1Y.isValid();return _relativeControl1Y.isValid();Executed by:
executed 7908 times by 4 tests: return _relativeControl1Y.isValid();Executed by:
| 7908 | ||||||||||||||||||
| 1028 | } | - | ||||||||||||||||||
| 1029 | - | |||||||||||||||||||
| 1030 | qreal QQuickPathCubic::relativeControl2X() const | - | ||||||||||||||||||
| 1031 | { | - | ||||||||||||||||||
| 1032 | return never executed: _relativeControl2X;return _relativeControl2X;never executed: return _relativeControl2X; | 0 | ||||||||||||||||||
| 1033 | } | - | ||||||||||||||||||
| 1034 | - | |||||||||||||||||||
| 1035 | void QQuickPathCubic::setRelativeControl2X(qreal x) | - | ||||||||||||||||||
| 1036 | { | - | ||||||||||||||||||
| 1037 | if (_relativeControl2X.isNull
| 0 | ||||||||||||||||||
| 1038 | _relativeControl2X = x; | - | ||||||||||||||||||
| 1039 | relativeControl2XChanged(); | - | ||||||||||||||||||
| 1040 | changed(); | - | ||||||||||||||||||
| 1041 | } never executed: end of block | 0 | ||||||||||||||||||
| 1042 | } never executed: end of block | 0 | ||||||||||||||||||
| 1043 | - | |||||||||||||||||||
| 1044 | bool QQuickPathCubic::hasRelativeControl2X() | - | ||||||||||||||||||
| 1045 | { | - | ||||||||||||||||||
| 1046 | return executed 7908 times by 4 tests: _relativeControl2X.isValid();return _relativeControl2X.isValid();Executed by:
executed 7908 times by 4 tests: return _relativeControl2X.isValid();Executed by:
| 7908 | ||||||||||||||||||
| 1047 | } | - | ||||||||||||||||||
| 1048 | - | |||||||||||||||||||
| 1049 | qreal QQuickPathCubic::relativeControl2Y() const | - | ||||||||||||||||||
| 1050 | { | - | ||||||||||||||||||
| 1051 | return never executed: _relativeControl2Y;return _relativeControl2Y;never executed: return _relativeControl2Y; | 0 | ||||||||||||||||||
| 1052 | } | - | ||||||||||||||||||
| 1053 | - | |||||||||||||||||||
| 1054 | void QQuickPathCubic::setRelativeControl2Y(qreal y) | - | ||||||||||||||||||
| 1055 | { | - | ||||||||||||||||||
| 1056 | if (_relativeControl2Y.isNull
| 0 | ||||||||||||||||||
| 1057 | _relativeControl2Y = y; | - | ||||||||||||||||||
| 1058 | relativeControl2YChanged(); | - | ||||||||||||||||||
| 1059 | changed(); | - | ||||||||||||||||||
| 1060 | } never executed: end of block | 0 | ||||||||||||||||||
| 1061 | } never executed: end of block | 0 | ||||||||||||||||||
| 1062 | - | |||||||||||||||||||
| 1063 | bool QQuickPathCubic::hasRelativeControl2Y() | - | ||||||||||||||||||
| 1064 | { | - | ||||||||||||||||||
| 1065 | return executed 7908 times by 4 tests: _relativeControl2Y.isValid();return _relativeControl2Y.isValid();Executed by:
executed 7908 times by 4 tests: return _relativeControl2Y.isValid();Executed by:
| 7908 | ||||||||||||||||||
| 1066 | } | - | ||||||||||||||||||
| 1067 | - | |||||||||||||||||||
| 1068 | void QQuickPathCubic::addToPath(QPainterPath &path, const QQuickPathData &data) | - | ||||||||||||||||||
| 1069 | { | - | ||||||||||||||||||
| 1070 | const QPointF &prevPoint = path.currentPosition(); | - | ||||||||||||||||||
| 1071 | QPointF controlPoint1(hasRelativeControl1X() ? prevPoint.x() + relativeControl1X() : control1X(), | - | ||||||||||||||||||
| 1072 | hasRelativeControl1Y() ? prevPoint.y() + relativeControl1Y() : control1Y()); | - | ||||||||||||||||||
| 1073 | QPointF controlPoint2(hasRelativeControl2X() ? prevPoint.x() + relativeControl2X() : control2X(), | - | ||||||||||||||||||
| 1074 | hasRelativeControl2Y() ? prevPoint.y() + relativeControl2Y() : control2Y()); | - | ||||||||||||||||||
| 1075 | path.cubicTo(controlPoint1, controlPoint2, positionForCurve(data, path.currentPosition())); | - | ||||||||||||||||||
| 1076 | } executed 7908 times by 4 tests: end of blockExecuted by:
| 7908 | ||||||||||||||||||
| 1077 | inline QPointF previousPathPosition(const QPainterPath &path) | - | ||||||||||||||||||
| 1078 | { | - | ||||||||||||||||||
| 1079 | int count = path.elementCount(); | - | ||||||||||||||||||
| 1080 | if (count < 1
| 0-30 | ||||||||||||||||||
| 1081 | return never executed: QPointF();return QPointF();never executed: return QPointF(); | 0 | ||||||||||||||||||
| 1082 | - | |||||||||||||||||||
| 1083 | int index = path.elementAt(count-1).type == QPainterPath::CurveToDataElement
| 0-30 | ||||||||||||||||||
| 1084 | return executed 30 times by 2 tests: index > -1 ? QPointF(path.elementAt(index)) : path.pointAtPercent(0);return index > -1 ? QPointF(path.elementAt(index)) : path.pointAtPercent(0);Executed by:
executed 30 times by 2 tests: return index > -1 ? QPointF(path.elementAt(index)) : path.pointAtPercent(0);Executed by:
| 30 | ||||||||||||||||||
| 1085 | } | - | ||||||||||||||||||
| 1086 | - | |||||||||||||||||||
| 1087 | void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathData &data) | - | ||||||||||||||||||
| 1088 | { | - | ||||||||||||||||||
| 1089 | - | |||||||||||||||||||
| 1090 | - | |||||||||||||||||||
| 1091 | - | |||||||||||||||||||
| 1092 | - | |||||||||||||||||||
| 1093 | - | |||||||||||||||||||
| 1094 | - | |||||||||||||||||||
| 1095 | QPointF prevFar, prev, point, next; | - | ||||||||||||||||||
| 1096 | - | |||||||||||||||||||
| 1097 | - | |||||||||||||||||||
| 1098 | int index = data.index - 1; | - | ||||||||||||||||||
| 1099 | QQuickCurve *curve = index == -1
| 12-30 | ||||||||||||||||||
| 1100 | if (qobject_cast<QQuickPathCatmullRomCurve*>(curve)
| 12-30 | ||||||||||||||||||
| 1101 | prev = path.currentPosition(); | - | ||||||||||||||||||
| 1102 | prevFar = previousPathPosition(path); | - | ||||||||||||||||||
| 1103 | } executed 30 times by 2 tests: else {end of blockExecuted by:
| 30 | ||||||||||||||||||
| 1104 | prev = path.currentPosition(); | - | ||||||||||||||||||
| 1105 | bool prevFarSet = false; | - | ||||||||||||||||||
| 1106 | if (index == -1
| 0-12 | ||||||||||||||||||
| 1107 | if (qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(data.curves.count()-1))
| 0-12 | ||||||||||||||||||
| 1108 | - | |||||||||||||||||||
| 1109 | QPointF pos = prev; | - | ||||||||||||||||||
| 1110 | QQuickPathData loopData; | - | ||||||||||||||||||
| 1111 | loopData.endPoint = data.endPoint; | - | ||||||||||||||||||
| 1112 | loopData.curves = data.curves; | - | ||||||||||||||||||
| 1113 | for (int i = data.index; i < data.curves.count()
| 12-42 | ||||||||||||||||||
| 1114 | loopData.index = i; | - | ||||||||||||||||||
| 1115 | pos = positionForCurve(loopData, pos); | - | ||||||||||||||||||
| 1116 | if (i == data.curves.count()-2
| 12-30 | ||||||||||||||||||
| 1117 | prevFar = pos; executed 12 times by 2 tests: prevFar = pos;Executed by:
| 12 | ||||||||||||||||||
| 1118 | } executed 42 times by 2 tests: end of blockExecuted by:
| 42 | ||||||||||||||||||
| 1119 | if (pos == QPointF(path.elementAt(0))
| 4-8 | ||||||||||||||||||
| 1120 | - | |||||||||||||||||||
| 1121 | - | |||||||||||||||||||
| 1122 | prevFarSet = true; | - | ||||||||||||||||||
| 1123 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 1124 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 1125 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 1126 | if (!prevFarSet
| 4-8 | ||||||||||||||||||
| 1127 | prevFar = prev; executed 8 times by 2 tests: prevFar = prev;Executed by:
| 8 | ||||||||||||||||||
| 1128 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 1129 | - | |||||||||||||||||||
| 1130 | - | |||||||||||||||||||
| 1131 | point = positionForCurve(data, path.currentPosition()); | - | ||||||||||||||||||
| 1132 | - | |||||||||||||||||||
| 1133 | - | |||||||||||||||||||
| 1134 | index = data.index + 1; | - | ||||||||||||||||||
| 1135 | if (index < data.curves.count()
| 0-30 | ||||||||||||||||||
| 1136 | QQuickPathData nextData; | - | ||||||||||||||||||
| 1137 | nextData.index = index; | - | ||||||||||||||||||
| 1138 | nextData.endPoint = data.endPoint; | - | ||||||||||||||||||
| 1139 | nextData.curves = data.curves; | - | ||||||||||||||||||
| 1140 | next = positionForCurve(nextData, point); | - | ||||||||||||||||||
| 1141 | } executed 30 times by 2 tests: else {end of blockExecuted by:
| 30 | ||||||||||||||||||
| 1142 | if (point == QPointF(path.elementAt(0))
| 0-8 | ||||||||||||||||||
| 1143 | - | |||||||||||||||||||
| 1144 | - | |||||||||||||||||||
| 1145 | next = QPointF(path.elementAt(3)); | - | ||||||||||||||||||
| 1146 | } executed 4 times by 2 tests: elseend of blockExecuted by:
| 4 | ||||||||||||||||||
| 1147 | next = point; executed 8 times by 2 tests: next = point;Executed by:
| 8 | ||||||||||||||||||
| 1148 | } | - | ||||||||||||||||||
| 1149 | QPointF control1(prevFar.x() * qreal(-0.167) + | - | ||||||||||||||||||
| 1150 | prev.x() + | - | ||||||||||||||||||
| 1151 | point.x() * qreal(0.167), | - | ||||||||||||||||||
| 1152 | prevFar.y() * qreal(-0.167) + | - | ||||||||||||||||||
| 1153 | prev.y() + | - | ||||||||||||||||||
| 1154 | point.y() * qreal(0.167)); | - | ||||||||||||||||||
| 1155 | - | |||||||||||||||||||
| 1156 | QPointF control2(prev.x() * qreal(0.167) + | - | ||||||||||||||||||
| 1157 | point.x() + | - | ||||||||||||||||||
| 1158 | next.x() * qreal(-0.167), | - | ||||||||||||||||||
| 1159 | prev.y() * qreal(0.167) + | - | ||||||||||||||||||
| 1160 | point.y() + | - | ||||||||||||||||||
| 1161 | next.y() * qreal(-0.167)); | - | ||||||||||||||||||
| 1162 | - | |||||||||||||||||||
| 1163 | path.cubicTo(control1, control2, point); | - | ||||||||||||||||||
| 1164 | } executed 42 times by 2 tests: end of blockExecuted by:
| 42 | ||||||||||||||||||
| 1165 | qreal QQuickPathArc::radiusX() const | - | ||||||||||||||||||
| 1166 | { | - | ||||||||||||||||||
| 1167 | return executed 2 times by 1 test: _radiusX;return _radiusX;Executed by:
executed 2 times by 1 test: return _radiusX;Executed by:
| 2 | ||||||||||||||||||
| 1168 | } | - | ||||||||||||||||||
| 1169 | - | |||||||||||||||||||
| 1170 | void QQuickPathArc::setRadiusX(qreal radius) | - | ||||||||||||||||||
| 1171 | { | - | ||||||||||||||||||
| 1172 | if (_radiusX == radius
| 0-70 | ||||||||||||||||||
| 1173 | return; never executed: return; | 0 | ||||||||||||||||||
| 1174 | - | |||||||||||||||||||
| 1175 | _radiusX = radius; | - | ||||||||||||||||||
| 1176 | radiusXChanged(); | - | ||||||||||||||||||
| 1177 | changed(); | - | ||||||||||||||||||
| 1178 | } executed 70 times by 3 tests: end of blockExecuted by:
| 70 | ||||||||||||||||||
| 1179 | - | |||||||||||||||||||
| 1180 | qreal QQuickPathArc::radiusY() const | - | ||||||||||||||||||
| 1181 | { | - | ||||||||||||||||||
| 1182 | return executed 2 times by 1 test: _radiusY;return _radiusY;Executed by:
executed 2 times by 1 test: return _radiusY;Executed by:
| 2 | ||||||||||||||||||
| 1183 | } | - | ||||||||||||||||||
| 1184 | - | |||||||||||||||||||
| 1185 | void QQuickPathArc::setRadiusY(qreal radius) | - | ||||||||||||||||||
| 1186 | { | - | ||||||||||||||||||
| 1187 | if (_radiusY == radius
| 0-70 | ||||||||||||||||||
| 1188 | return; never executed: return; | 0 | ||||||||||||||||||
| 1189 | - | |||||||||||||||||||
| 1190 | _radiusY = radius; | - | ||||||||||||||||||
| 1191 | radiusYChanged(); | - | ||||||||||||||||||
| 1192 | changed(); | - | ||||||||||||||||||
| 1193 | } executed 70 times by 3 tests: end of blockExecuted by:
| 70 | ||||||||||||||||||
| 1194 | bool QQuickPathArc::useLargeArc() const | - | ||||||||||||||||||
| 1195 | { | - | ||||||||||||||||||
| 1196 | return executed 2 times by 1 test: _useLargeArc;return _useLargeArc;Executed by:
executed 2 times by 1 test: return _useLargeArc;Executed by:
| 2 | ||||||||||||||||||
| 1197 | } | - | ||||||||||||||||||
| 1198 | - | |||||||||||||||||||
| 1199 | void QQuickPathArc::setUseLargeArc(bool largeArc) | - | ||||||||||||||||||
| 1200 | { | - | ||||||||||||||||||
| 1201 | if (_useLargeArc == largeArc
| 2-26 | ||||||||||||||||||
| 1202 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||
| 1203 | - | |||||||||||||||||||
| 1204 | _useLargeArc = largeArc; | - | ||||||||||||||||||
| 1205 | useLargeArcChanged(); | - | ||||||||||||||||||
| 1206 | changed(); | - | ||||||||||||||||||
| 1207 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||
| 1208 | QQuickPathArc::ArcDirection QQuickPathArc::direction() const | - | ||||||||||||||||||
| 1209 | { | - | ||||||||||||||||||
| 1210 | return executed 2 times by 1 test: _direction;return _direction;Executed by:
executed 2 times by 1 test: return _direction;Executed by:
| 2 | ||||||||||||||||||
| 1211 | } | - | ||||||||||||||||||
| 1212 | - | |||||||||||||||||||
| 1213 | void QQuickPathArc::setDirection(ArcDirection direction) | - | ||||||||||||||||||
| 1214 | { | - | ||||||||||||||||||
| 1215 | if (_direction == direction
| 6-8 | ||||||||||||||||||
| 1216 | return; executed 6 times by 2 tests: return;Executed by:
| 6 | ||||||||||||||||||
| 1217 | - | |||||||||||||||||||
| 1218 | _direction = direction; | - | ||||||||||||||||||
| 1219 | directionChanged(); | - | ||||||||||||||||||
| 1220 | changed(); | - | ||||||||||||||||||
| 1221 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 1222 | qreal QQuickPathArc::xAxisRotation() const | - | ||||||||||||||||||
| 1223 | { | - | ||||||||||||||||||
| 1224 | return never executed: _xAxisRotation;return _xAxisRotation;never executed: return _xAxisRotation; | 0 | ||||||||||||||||||
| 1225 | } | - | ||||||||||||||||||
| 1226 | - | |||||||||||||||||||
| 1227 | void QQuickPathArc::setXAxisRotation(qreal rotation) | - | ||||||||||||||||||
| 1228 | { | - | ||||||||||||||||||
| 1229 | if (_xAxisRotation == rotation
| 4 | ||||||||||||||||||
| 1230 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||
| 1231 | - | |||||||||||||||||||
| 1232 | _xAxisRotation = rotation; | - | ||||||||||||||||||
| 1233 | xAxisRotationChanged(); | - | ||||||||||||||||||
| 1234 | changed(); | - | ||||||||||||||||||
| 1235 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 1236 | - | |||||||||||||||||||
| 1237 | void QQuickPathArc::addToPath(QPainterPath &path, const QQuickPathData &data) | - | ||||||||||||||||||
| 1238 | { | - | ||||||||||||||||||
| 1239 | const QPointF &startPoint = path.currentPosition(); | - | ||||||||||||||||||
| 1240 | const QPointF &endPoint = positionForCurve(data, startPoint); | - | ||||||||||||||||||
| 1241 | QQuickSvgParser::pathArc(path, | - | ||||||||||||||||||
| 1242 | _radiusX, | - | ||||||||||||||||||
| 1243 | _radiusY, | - | ||||||||||||||||||
| 1244 | _xAxisRotation, | - | ||||||||||||||||||
| 1245 | _useLargeArc, | - | ||||||||||||||||||
| 1246 | _direction == Clockwise ? 1 : 0, | - | ||||||||||||||||||
| 1247 | endPoint.x(), | - | ||||||||||||||||||
| 1248 | endPoint.y(), | - | ||||||||||||||||||
| 1249 | startPoint.x(), startPoint.y()); | - | ||||||||||||||||||
| 1250 | } executed 178 times by 3 tests: end of blockExecuted by:
| 178 | ||||||||||||||||||
| 1251 | qreal QQuickPathAngleArc::centerX() const | - | ||||||||||||||||||
| 1252 | { | - | ||||||||||||||||||
| 1253 | return executed 2 times by 1 test: _centerX;return _centerX;Executed by:
executed 2 times by 1 test: return _centerX;Executed by:
| 2 | ||||||||||||||||||
| 1254 | } | - | ||||||||||||||||||
| 1255 | - | |||||||||||||||||||
| 1256 | void QQuickPathAngleArc::setCenterX(qreal centerX) | - | ||||||||||||||||||
| 1257 | { | - | ||||||||||||||||||
| 1258 | if (_centerX == centerX
| 0-6 | ||||||||||||||||||
| 1259 | return; never executed: return; | 0 | ||||||||||||||||||
| 1260 | - | |||||||||||||||||||
| 1261 | _centerX = centerX; | - | ||||||||||||||||||
| 1262 | centerXChanged(); | - | ||||||||||||||||||
| 1263 | changed(); | - | ||||||||||||||||||
| 1264 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 1265 | - | |||||||||||||||||||
| 1266 | qreal QQuickPathAngleArc::centerY() const | - | ||||||||||||||||||
| 1267 | { | - | ||||||||||||||||||
| 1268 | return executed 2 times by 1 test: _centerY;return _centerY;Executed by:
executed 2 times by 1 test: return _centerY;Executed by:
| 2 | ||||||||||||||||||
| 1269 | } | - | ||||||||||||||||||
| 1270 | - | |||||||||||||||||||
| 1271 | void QQuickPathAngleArc::setCenterY(qreal centerY) | - | ||||||||||||||||||
| 1272 | { | - | ||||||||||||||||||
| 1273 | if (_centerY == centerY
| 0-6 | ||||||||||||||||||
| 1274 | return; never executed: return; | 0 | ||||||||||||||||||
| 1275 | - | |||||||||||||||||||
| 1276 | _centerY = centerY; | - | ||||||||||||||||||
| 1277 | centerXChanged(); | - | ||||||||||||||||||
| 1278 | changed(); | - | ||||||||||||||||||
| 1279 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 1280 | qreal QQuickPathAngleArc::radiusX() const | - | ||||||||||||||||||
| 1281 | { | - | ||||||||||||||||||
| 1282 | return executed 2 times by 1 test: _radiusX;return _radiusX;Executed by:
executed 2 times by 1 test: return _radiusX;Executed by:
| 2 | ||||||||||||||||||
| 1283 | } | - | ||||||||||||||||||
| 1284 | - | |||||||||||||||||||
| 1285 | void QQuickPathAngleArc::setRadiusX(qreal radius) | - | ||||||||||||||||||
| 1286 | { | - | ||||||||||||||||||
| 1287 | if (_radiusX == radius
| 0-6 | ||||||||||||||||||
| 1288 | return; never executed: return; | 0 | ||||||||||||||||||
| 1289 | - | |||||||||||||||||||
| 1290 | _radiusX = radius; | - | ||||||||||||||||||
| 1291 | radiusXChanged(); | - | ||||||||||||||||||
| 1292 | changed(); | - | ||||||||||||||||||
| 1293 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 1294 | - | |||||||||||||||||||
| 1295 | qreal QQuickPathAngleArc::radiusY() const | - | ||||||||||||||||||
| 1296 | { | - | ||||||||||||||||||
| 1297 | return executed 2 times by 1 test: _radiusY;return _radiusY;Executed by:
executed 2 times by 1 test: return _radiusY;Executed by:
| 2 | ||||||||||||||||||
| 1298 | } | - | ||||||||||||||||||
| 1299 | - | |||||||||||||||||||
| 1300 | void QQuickPathAngleArc::setRadiusY(qreal radius) | - | ||||||||||||||||||
| 1301 | { | - | ||||||||||||||||||
| 1302 | if (_radiusY == radius
| 0-6 | ||||||||||||||||||
| 1303 | return; never executed: return; | 0 | ||||||||||||||||||
| 1304 | - | |||||||||||||||||||
| 1305 | _radiusY = radius; | - | ||||||||||||||||||
| 1306 | radiusYChanged(); | - | ||||||||||||||||||
| 1307 | changed(); | - | ||||||||||||||||||
| 1308 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 1309 | qreal QQuickPathAngleArc::startAngle() const | - | ||||||||||||||||||
| 1310 | { | - | ||||||||||||||||||
| 1311 | return executed 2 times by 1 test: _startAngle;return _startAngle;Executed by:
executed 2 times by 1 test: return _startAngle;Executed by:
| 2 | ||||||||||||||||||
| 1312 | } | - | ||||||||||||||||||
| 1313 | - | |||||||||||||||||||
| 1314 | void QQuickPathAngleArc::setStartAngle(qreal angle) | - | ||||||||||||||||||
| 1315 | { | - | ||||||||||||||||||
| 1316 | if (_startAngle == angle
| 0-6 | ||||||||||||||||||
| 1317 | return; never executed: return; | 0 | ||||||||||||||||||
| 1318 | - | |||||||||||||||||||
| 1319 | _startAngle = angle; | - | ||||||||||||||||||
| 1320 | startAngleChanged(); | - | ||||||||||||||||||
| 1321 | changed(); | - | ||||||||||||||||||
| 1322 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 1323 | qreal QQuickPathAngleArc::sweepAngle() const | - | ||||||||||||||||||
| 1324 | { | - | ||||||||||||||||||
| 1325 | return executed 6 times by 2 tests: _sweepAngle;return _sweepAngle;Executed by:
executed 6 times by 2 tests: return _sweepAngle;Executed by:
| 6 | ||||||||||||||||||
| 1326 | } | - | ||||||||||||||||||
| 1327 | - | |||||||||||||||||||
| 1328 | void QQuickPathAngleArc::setSweepAngle(qreal angle) | - | ||||||||||||||||||
| 1329 | { | - | ||||||||||||||||||
| 1330 | if (_sweepAngle == angle
| 2-4 | ||||||||||||||||||
| 1331 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||
| 1332 | - | |||||||||||||||||||
| 1333 | _sweepAngle = angle; | - | ||||||||||||||||||
| 1334 | sweepAngleChanged(); | - | ||||||||||||||||||
| 1335 | changed(); | - | ||||||||||||||||||
| 1336 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 1337 | bool QQuickPathAngleArc::moveToStart() const | - | ||||||||||||||||||
| 1338 | { | - | ||||||||||||||||||
| 1339 | return executed 2 times by 1 test: _moveToStart;return _moveToStart;Executed by:
executed 2 times by 1 test: return _moveToStart;Executed by:
| 2 | ||||||||||||||||||
| 1340 | } | - | ||||||||||||||||||
| 1341 | - | |||||||||||||||||||
| 1342 | void QQuickPathAngleArc::setMoveToStart(bool move) | - | ||||||||||||||||||
| 1343 | { | - | ||||||||||||||||||
| 1344 | if (_moveToStart == move
| 0-2 | ||||||||||||||||||
| 1345 | return; never executed: return; | 0 | ||||||||||||||||||
| 1346 | - | |||||||||||||||||||
| 1347 | _moveToStart = move; | - | ||||||||||||||||||
| 1348 | moveToStartChanged(); | - | ||||||||||||||||||
| 1349 | changed(); | - | ||||||||||||||||||
| 1350 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 1351 | - | |||||||||||||||||||
| 1352 | void QQuickPathAngleArc::addToPath(QPainterPath &path, const QQuickPathData &) | - | ||||||||||||||||||
| 1353 | { | - | ||||||||||||||||||
| 1354 | qreal x = _centerX - _radiusX; | - | ||||||||||||||||||
| 1355 | qreal y = _centerY - _radiusY; | - | ||||||||||||||||||
| 1356 | qreal width = _radiusX * 2; | - | ||||||||||||||||||
| 1357 | qreal height = _radiusY * 2; | - | ||||||||||||||||||
| 1358 | if (_moveToStart
| 2-6 | ||||||||||||||||||
| 1359 | path.arcMoveTo(x, y, width, height, -_startAngle); executed 6 times by 2 tests: path.arcMoveTo(x, y, width, height, -_startAngle);Executed by:
| 6 | ||||||||||||||||||
| 1360 | path.arcTo(x, y, width, height, -_startAngle, -_sweepAngle); | - | ||||||||||||||||||
| 1361 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 1362 | QString QQuickPathSvg::path() const | - | ||||||||||||||||||
| 1363 | { | - | ||||||||||||||||||
| 1364 | return executed 2 times by 1 test: _path;return _path;Executed by:
executed 2 times by 1 test: return _path;Executed by:
| 2 | ||||||||||||||||||
| 1365 | } | - | ||||||||||||||||||
| 1366 | - | |||||||||||||||||||
| 1367 | void QQuickPathSvg::setPath(const QString &path) | - | ||||||||||||||||||
| 1368 | { | - | ||||||||||||||||||
| 1369 | if (_path == path
| 0-8 | ||||||||||||||||||
| 1370 | return; never executed: return; | 0 | ||||||||||||||||||
| 1371 | - | |||||||||||||||||||
| 1372 | _path = path; | - | ||||||||||||||||||
| 1373 | pathChanged(); | - | ||||||||||||||||||
| 1374 | changed(); | - | ||||||||||||||||||
| 1375 | } executed 8 times by 3 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 1376 | - | |||||||||||||||||||
| 1377 | void QQuickPathSvg::addToPath(QPainterPath &path, const QQuickPathData &) | - | ||||||||||||||||||
| 1378 | { | - | ||||||||||||||||||
| 1379 | QQuickSvgParser::parsePathDataFast(_path, path); | - | ||||||||||||||||||
| 1380 | } executed 8 times by 3 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 1381 | qreal QQuickPathPercent::value() const | - | ||||||||||||||||||
| 1382 | { | - | ||||||||||||||||||
| 1383 | return executed 10 times by 1 test: _value;return _value;Executed by:
executed 10 times by 1 test: return _value;Executed by:
| 10 | ||||||||||||||||||
| 1384 | } | - | ||||||||||||||||||
| 1385 | - | |||||||||||||||||||
| 1386 | void QQuickPathPercent::setValue(qreal value) | - | ||||||||||||||||||
| 1387 | { | - | ||||||||||||||||||
| 1388 | if (_value != value
| 0-4 | ||||||||||||||||||
| 1389 | _value = value; | - | ||||||||||||||||||
| 1390 | valueChanged(); | - | ||||||||||||||||||
| 1391 | changed(); | - | ||||||||||||||||||
| 1392 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 1393 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 1394 | - | |||||||||||||||||||
| 1395 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |