OpenCoverage

qquickpointattractor.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickpointattractor.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2QQuickAttractorAffector::QQuickAttractorAffector(QQuickItem *parent) :-
3 QQuickParticleAffector(parent), m_strength(0.0), m_x(0), m_y(0)-
4 , m_physics(Velocity), m_proportionalToDistance(Linear)-
5{-
6}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpointattractor
4
7-
8bool QQuickAttractorAffector::affectParticle(QQuickParticleData *d, qreal dt)-
9{-
10 if (m_strength == 0.0
m_strength == 0.0Description
TRUEnever evaluated
FALSEevaluated 22846 times by 1 test
Evaluated by:
  • tst_qquickpointattractor
)
0-22846
11 return
never executed: return false;
false;
never executed: return false;
0
12 qreal dx = m_x+m_offset.x() - d->curX(m_system);-
13 qreal dy = m_y+m_offset.y() - d->curY(m_system);-
14 qreal r = std::sqrt((dx*dx) + (dy*dy));-
15 qreal theta = std::atan2(dy,dx);-
16 qreal ds = 0;-
17 switch (m_proportionalToDistance){-
18 case
never executed: case InverseQuadratic:
InverseQuadratic:
never executed: case InverseQuadratic:
0
19 ds = (m_strength / qMax<qreal>(1.,r*r));-
20 break;
never executed: break;
0
21 case
never executed: case InverseLinear:
InverseLinear:
never executed: case InverseLinear:
0
22 ds = (m_strength / qMax<qreal>(1.,r));-
23 break;
never executed: break;
0
24 case
never executed: case Quadratic:
Quadratic:
never executed: case Quadratic:
0
25 ds = (m_strength * qMax<qreal>(1.,r*r));-
26 break;
never executed: break;
0
27 case
never executed: case Linear:
Linear:
never executed: case Linear:
0
28 ds = (m_strength * qMax<qreal>(1.,r));-
29 break;
never executed: break;
0
30 default
executed 22846 times by 1 test: default:
Executed by:
  • tst_qquickpointattractor
:
executed 22846 times by 1 test: default:
Executed by:
  • tst_qquickpointattractor
22846
31 ds = m_strength;-
32 }
executed 22846 times by 1 test: end of block
Executed by:
  • tst_qquickpointattractor
22846
33 ds *= dt;-
34 dx = ds * std::cos(theta);-
35 dy = ds * std::sin(theta);-
36 qreal vx,vy;-
37 switch (m_physics){-
38 case
executed 22846 times by 1 test: case Position:
Executed by:
  • tst_qquickpointattractor
Position:
executed 22846 times by 1 test: case Position:
Executed by:
  • tst_qquickpointattractor
22846
39 d->x = (d->x + dx);-
40 d->y = (d->y + dy);-
41 break;
executed 22846 times by 1 test: break;
Executed by:
  • tst_qquickpointattractor
22846
42 case
never executed: case Acceleration:
Acceleration:
never executed: case Acceleration:
0
43 d->setInstantaneousAX(d->ax + dx, m_system);-
44 d->setInstantaneousAY(d->ay + dy, m_system);-
45 break;
never executed: break;
0
46 case
never executed: case Velocity:
Velocity:
never executed: case Velocity:
0
47 default
never executed: default:
:
never executed: default:
0
48 vx = d->curVX(m_system);-
49 vy = d->curVY(m_system);-
50 d->setInstantaneousVX(vx + dx, m_system);-
51 d->setInstantaneousVY(vy + dy, m_system);-
52 }
never executed: end of block
0
53-
54 return
executed 22846 times by 1 test: return true;
Executed by:
  • tst_qquickpointattractor
true;
executed 22846 times by 1 test: return true;
Executed by:
  • tst_qquickpointattractor
22846
55}-
56-
57-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0