OpenCoverage

qquickfriction.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickfriction.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static qreal sign(qreal a)-
4{-
5 return
executed 98808 times by 1 test: return a >= 0 ? 1 : -1;
Executed by:
  • tst_qquickfriction
a >= 0 ? 1 : -1;
executed 98808 times by 1 test: return a >= 0 ? 1 : -1;
Executed by:
  • tst_qquickfriction
98808
6}-
7-
8static const qreal epsilon = 0.00001;-
9-
10QQuickFrictionAffector::QQuickFrictionAffector(QQuickItem *parent) :-
11 QQuickParticleAffector(parent), m_factor(0.0), m_threshold(0.0)-
12{-
13}
executed 10 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfriction
10
14-
15bool QQuickFrictionAffector::affectParticle(QQuickParticleData *d, qreal dt)-
16{-
17 if (!m_factor
!m_factorDescription
TRUEnever evaluated
FALSEevaluated 93378 times by 1 test
Evaluated by:
  • tst_qquickfriction
)
0-93378
18 return
never executed: return false;
false;
never executed: return false;
0
19 qreal curVX = d->curVX(m_system);-
20 qreal curVY = d->curVY(m_system);-
21 if (!curVX
!curVXDescription
TRUEevaluated 44476 times by 1 test
Evaluated by:
  • tst_qquickfriction
FALSEevaluated 48902 times by 1 test
Evaluated by:
  • tst_qquickfriction
&& !curVY
!curVYDescription
TRUEevaluated 44476 times by 1 test
Evaluated by:
  • tst_qquickfriction
FALSEnever evaluated
)
0-48902
22 return
executed 44476 times by 1 test: return false;
Executed by:
  • tst_qquickfriction
false;
executed 44476 times by 1 test: return false;
Executed by:
  • tst_qquickfriction
44476
23 qreal newVX = curVX + (curVX * m_factor * -1 * dt);-
24 qreal newVY = curVY + (curVY * m_factor * -1 * dt);-
25-
26 if (!m_threshold
!m_thresholdDescription
TRUEevaluated 24062 times by 1 test
Evaluated by:
  • tst_qquickfriction
FALSEevaluated 24840 times by 1 test
Evaluated by:
  • tst_qquickfriction
) {
24062-24840
27 if (sign(curVX) != sign(newVX)
sign(curVX) != sign(newVX)Description
TRUEevaluated 1216 times by 1 test
Evaluated by:
  • tst_qquickfriction
FALSEevaluated 22846 times by 1 test
Evaluated by:
  • tst_qquickfriction
)
1216-22846
28 newVX = 0;
executed 1216 times by 1 test: newVX = 0;
Executed by:
  • tst_qquickfriction
1216
29 if (sign(curVY) != sign(newVY)
sign(curVY) != sign(newVY)Description
TRUEnever evaluated
FALSEevaluated 24062 times by 1 test
Evaluated by:
  • tst_qquickfriction
)
0-24062
30 newVY = 0;
never executed: newVY = 0;
0
31 }
executed 24062 times by 1 test: end of block
Executed by:
  • tst_qquickfriction
else {
24062
32 qreal curMag = qSqrt(curVX*curVX + curVY*curVY);-
33 if (curMag <= m_threshold + epsilon
curMag <= m_th...hold + epsilonDescription
TRUEevaluated 23560 times by 1 test
Evaluated by:
  • tst_qquickfriction
FALSEevaluated 1280 times by 1 test
Evaluated by:
  • tst_qquickfriction
)
1280-23560
34 return
executed 23560 times by 1 test: return false;
Executed by:
  • tst_qquickfriction
false;
executed 23560 times by 1 test: return false;
Executed by:
  • tst_qquickfriction
23560
35 qreal newMag = qSqrt(newVX*newVX + newVY*newVY);-
36 if (newMag <= m_threshold + epsilon
newMag <= m_th...hold + epsilonDescription
TRUEnever evaluated
FALSEevaluated 1280 times by 1 test
Evaluated by:
  • tst_qquickfriction
||
0-1280
37 sign(curVX) != sign(newVX)
sign(curVX) != sign(newVX)Description
TRUEevaluated 1280 times by 1 test
Evaluated by:
  • tst_qquickfriction
FALSEnever evaluated
||
0-1280
38 sign(curVY) != sign(newVY)
sign(curVY) != sign(newVY)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
39 qreal theta = qAtan2(curVY, curVX);-
40 newVX = m_threshold * qCos(theta);-
41 newVY = m_threshold * qSin(theta);-
42 }
executed 1280 times by 1 test: end of block
Executed by:
  • tst_qquickfriction
1280
43 }
executed 1280 times by 1 test: end of block
Executed by:
  • tst_qquickfriction
1280
44-
45 d->setInstantaneousVX(newVX, m_system);-
46 d->setInstantaneousVY(newVY, m_system);-
47 return
executed 25342 times by 1 test: return true;
Executed by:
  • tst_qquickfriction
true;
executed 25342 times by 1 test: return true;
Executed by:
  • tst_qquickfriction
25342
48}-
49-
50-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0