OpenCoverage

qquicksprite.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicksprite.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static const int unsetDuration = -2;-
4QQuickSprite::QQuickSprite(QObject *parent)-
5 : QQuickStochasticState(parent)-
6 , m_generatedCount(0)-
7 , m_framesPerRow(0)-
8 , m_rowY(0)-
9 , m_rowStartX(0)-
10 , m_reverse(false)-
11 , m_frameHeight(0)-
12 , m_frameWidth(0)-
13 , m_frames(1)-
14 , m_frameX(0)-
15 , m_frameY(0)-
16 , m_frameRate(unsetDuration)-
17 , m_frameRateVariation(0)-
18 , m_frameDuration(unsetDuration)-
19 , m_frameDurationVariation(0)-
20 , m_frameSync(false)-
21 , m_devicePixelRatio(1.0)-
22{-
23}
executed 90 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
90
24-
25-
26QQuickSprite::~QQuickSprite()-
27{-
28}-
29-
30int QQuickSprite::variedDuration() const-
31{-
32 if (m_frameSync
m_frameSyncDescription
TRUEevaluated 38 times by 2 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickspritesequence
FALSEevaluated 3696 times by 4 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
)
38-3696
33 return
executed 38 times by 2 tests: return 0;
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickspritesequence
0;
executed 38 times by 2 tests: return 0;
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickspritesequence
38
34-
35 if (m_frameRate != unsetDuration
m_frameRate != unsetDurationDescription
TRUEnever evaluated
FALSEevaluated 3696 times by 4 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
) {
0-3696
36 qreal fpms = (m_frameRate-
37 + (m_frameRateVariation * QRandomGenerator::global()->generateDouble() * 2)-
38 - m_frameRateVariation) / 1000.0;-
39 return
never executed: return qMax(qreal(0.0) , m_frames / fpms);
qMax(qreal(0.0) , m_frames / fpms);
never executed: return qMax(qreal(0.0) , m_frames / fpms);
0
40 } else if (m_frameDuration != unsetDuration
m_frameDuratio... unsetDurationDescription
TRUEevaluated 3688 times by 4 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickspritesequence
) {
8-3688
41 int mspf = m_frameDuration-
42 + (m_frameDurationVariation * QRandomGenerator::global()->generateDouble() * 2)-
43 - m_frameDurationVariation;-
44 return
executed 3688 times by 4 tests: return qMax(0, m_frames * mspf);
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
qMax(0, m_frames * mspf);
executed 3688 times by 4 tests: return qMax(0, m_frames * mspf);
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
3688
45 } else if (duration() >= 0
duration() >= 0Description
TRUEnever evaluated
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickspritesequence
) {
0-8
46 QMessageLogger(__FILE__, 251, __PRETTY_FUNCTION__).warning() << "Sprite::duration is changing meaning to the full animation duration.";-
47 QMessageLogger(__FILE__, 252, __PRETTY_FUNCTION__).warning() << "Use Sprite::frameDuration for the old meaning, of per frame duration.";-
48 QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__).warning() << "As an interim measure, duration/durationVariation means the same as frameDuration/frameDurationVariation, and you'll get this warning spewed out everywhere to motivate you.";-
49-
50 return
never executed: return QQuickStochasticState::variedDuration() * m_frames;
QQuickStochasticState::variedDuration() * m_frames;
never executed: return QQuickStochasticState::variedDuration() * m_frames;
0
51 }-
52 return
executed 8 times by 2 tests: return 1000;
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickspritesequence
1000;
executed 8 times by 2 tests: return 1000;
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickspritesequence
8
53}-
54-
55void QQuickSprite::startImageLoading()-
56{-
57 m_pix.clear(this);-
58 if (!m_source.isEmpty()
!m_source.isEmpty()Description
TRUEevaluated 92 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
FALSEnever evaluated
) {
0-92
59 QQmlEngine *e = qmlEngine(this);-
60 if (!e
!eDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickanimatedsprite
FALSEevaluated 72 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
) {
20-72
61 e = qmlEngine(parent());-
62 if (!e
!eDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickanimatedsprite
)
0-20
63 QMessageLogger(__FILE__, 268, __PRETTY_FUNCTION__).warning() << "QQuickSprite: Cannot find QQmlEngine - this class is only for use in QML and may not work";
never executed: QMessageLogger(__FILE__, 268, __PRETTY_FUNCTION__).warning() << "QQuickSprite: Cannot find QQmlEngine - this class is only for use in QML and may not work";
0
64 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickanimatedsprite
20
65 QUrl loadUrl = m_source;-
66 QQuickImageBase::resolve2xLocalFile(m_source, m_devicePixelRatio, &loadUrl, &m_devicePixelRatio);-
67-
68 m_pix.load(e, loadUrl);-
69 }
executed 92 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
92
70}
executed 92 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimatedsprite
  • tst_qquickimageparticle
  • tst_qquickspritegoal
  • tst_qquickspritesequence
92
71-
72-
73-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0