Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickanimatorcontroller.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | - | |||||||
7 | - | |||||||
8 | QQuickAnimatorController::~QQuickAnimatorController() | - | ||||||
9 | { | - | ||||||
10 | } | - | ||||||
11 | - | |||||||
12 | QQuickAnimatorController::QQuickAnimatorController(QQuickWindow *window) | - | ||||||
13 | : m_window(window) | - | ||||||
14 | { | - | ||||||
15 | } executed 5366 times by 90 tests: end of block Executed by:
| 5366 | ||||||
16 | - | |||||||
17 | static void qquickanimator_invalidate_jobs(QAbstractAnimationJob *job) | - | ||||||
18 | { | - | ||||||
19 | if (job->isRenderThreadJob()
| 14-44 | ||||||
20 | static_cast<QQuickAnimatorJob *>(job)->invalidate(); | - | ||||||
21 | } executed 44 times by 2 tests: else if (job->isGroup()end of block Executed by:
| 2-44 | ||||||
22 | QAnimationGroupJob *g = static_cast<QAnimationGroupJob *>(job); | - | ||||||
23 | for (QAbstractAnimationJob *a = g->firstChild(); a
| 12-24 | ||||||
24 | qquickanimator_invalidate_jobs(a); executed 24 times by 1 test: qquickanimator_invalidate_jobs(a); Executed by:
| 24 | ||||||
25 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||
26 | } executed 58 times by 2 tests: end of block Executed by:
| 58 | ||||||
27 | - | |||||||
28 | void QQuickAnimatorController::windowNodesDestroyed() | - | ||||||
29 | { | - | ||||||
30 | for (const QSharedPointer<QAbstractAnimationJob> &toStop : qAsConst(m_rootsPendingStop)) { | - | ||||||
31 | qquickanimator_invalidate_jobs(toStop.data()); | - | ||||||
32 | toStop->stop(); | - | ||||||
33 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||
34 | m_rootsPendingStop.clear(); | - | ||||||
35 | - | |||||||
36 | - | |||||||
37 | - | |||||||
38 | const auto roots = m_animationRoots; | - | ||||||
39 | m_animationRoots.clear(); | - | ||||||
40 | for (const QSharedPointer<QAbstractAnimationJob> &job : roots) { | - | ||||||
41 | qquickanimator_invalidate_jobs(job.data()); | - | ||||||
42 | - | |||||||
43 | - | |||||||
44 | - | |||||||
45 | job->stop(); | - | ||||||
46 | m_rootsPendingStart.insert(job); | - | ||||||
47 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||
48 | } executed 5362 times by 90 tests: end of block Executed by:
| 5362 | ||||||
49 | - | |||||||
50 | void QQuickAnimatorController::advance() | - | ||||||
51 | { | - | ||||||
52 | bool running = false; | - | ||||||
53 | for (const QSharedPointer<QAbstractAnimationJob> &job : qAsConst(m_animationRoots)) { | - | ||||||
54 | if (job->isRunning()
| 0-855 | ||||||
55 | running = true; | - | ||||||
56 | break; executed 855 times by 2 tests: break; Executed by:
| 855 | ||||||
57 | } | - | ||||||
58 | } never executed: end of block | 0 | ||||||
59 | - | |||||||
60 | for (QQuickAnimatorJob *job : qAsConst(m_runningAnimators)) | - | ||||||
61 | job->commit(); executed 881 times by 2 tests: job->commit(); Executed by:
| 881 | ||||||
62 | - | |||||||
63 | if (running
| 855-49768 | ||||||
64 | m_window->update(); executed 855 times by 2 tests: m_window->update(); Executed by:
| 855 | ||||||
65 | } executed 50623 times by 76 tests: end of block Executed by:
| 50623 | ||||||
66 | - | |||||||
67 | static void qquickanimator_sync_before_start(QAbstractAnimationJob *job) | - | ||||||
68 | { | - | ||||||
69 | if (job->isRenderThreadJob()
| 6-36 | ||||||
70 | static_cast<QQuickAnimatorJob *>(job)->preSync(); | - | ||||||
71 | } executed 36 times by 2 tests: else if (job->isGroup()end of block Executed by:
| 0-36 | ||||||
72 | QAnimationGroupJob *g = static_cast<QAnimationGroupJob *>(job); | - | ||||||
73 | for (QAbstractAnimationJob *a = g->firstChild(); a
| 6-12 | ||||||
74 | qquickanimator_sync_before_start(a); executed 12 times by 1 test: qquickanimator_sync_before_start(a); Executed by:
| 12 | ||||||
75 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||
76 | } executed 42 times by 2 tests: end of block Executed by:
| 42 | ||||||
77 | - | |||||||
78 | void QQuickAnimatorController::beforeNodeSync() | - | ||||||
79 | { | - | ||||||
80 | for (const QSharedPointer<QAbstractAnimationJob> &toStop : qAsConst(m_rootsPendingStop)) { | - | ||||||
81 | toStop->stop(); | - | ||||||
82 | m_animationRoots.remove(toStop.data()); | - | ||||||
83 | } never executed: end of block | 0 | ||||||
84 | m_rootsPendingStop.clear(); | - | ||||||
85 | - | |||||||
86 | - | |||||||
87 | for (QQuickAnimatorJob *job : qAsConst(m_runningAnimators)) | - | ||||||
88 | job->preSync(); executed 849 times by 1 test: job->preSync(); Executed by:
| 849 | ||||||
89 | - | |||||||
90 | - | |||||||
91 | for (const QSharedPointer<QAbstractAnimationJob> &job : qAsConst(m_rootsPendingStart)) { | - | ||||||
92 | ((!job->isRunning()) ? static_cast<void>(0) : qt_assert("!job->isRunning()", __FILE__, 138)); | - | ||||||
93 | - | |||||||
94 | - | |||||||
95 | - | |||||||
96 | - | |||||||
97 | - | |||||||
98 | qquickanimator_sync_before_start(job.data()); | - | ||||||
99 | - | |||||||
100 | - | |||||||
101 | job->start(); | - | ||||||
102 | m_animationRoots.insert(job.data(), job); | - | ||||||
103 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||
104 | m_rootsPendingStart.clear(); | - | ||||||
105 | - | |||||||
106 | - | |||||||
107 | if (m_animationRoots.size()
| 855-49764 | ||||||
108 | m_window->update(); executed 855 times by 2 tests: m_window->update(); Executed by:
| 855 | ||||||
109 | } executed 50619 times by 76 tests: end of block Executed by:
| 50619 | ||||||
110 | - | |||||||
111 | void QQuickAnimatorController::afterNodeSync() | - | ||||||
112 | { | - | ||||||
113 | for (QQuickAnimatorJob *job : qAsConst(m_runningAnimators)) | - | ||||||
114 | job->postSync(); executed 881 times by 2 tests: job->postSync(); Executed by:
| 881 | ||||||
115 | } executed 50619 times by 76 tests: end of block Executed by:
| 50619 | ||||||
116 | - | |||||||
117 | void QQuickAnimatorController::animationFinished(QAbstractAnimationJob *job) | - | ||||||
118 | { | - | ||||||
119 | m_animationRoots.remove(job); | - | ||||||
120 | } never executed: end of block | 0 | ||||||
121 | - | |||||||
122 | void QQuickAnimatorController::animationStateChanged(QAbstractAnimationJob *job, | - | ||||||
123 | QAbstractAnimationJob::State newState, | - | ||||||
124 | QAbstractAnimationJob::State oldState) | - | ||||||
125 | { | - | ||||||
126 | ((job->isRenderThreadJob()) ? static_cast<void>(0) : qt_assert("job->isRenderThreadJob()", __FILE__, 172)); | - | ||||||
127 | QQuickAnimatorJob *animator = static_cast<QQuickAnimatorJob *>(job); | - | ||||||
128 | if (newState == QAbstractAnimationJob::Running
| 32 | ||||||
129 | m_runningAnimators.insert(animator); | - | ||||||
130 | } executed 32 times by 2 tests: else if (oldState == QAbstractAnimationJob::Runningend of block Executed by:
| 0-32 | ||||||
131 | animator->commit(); | - | ||||||
132 | m_runningAnimators.remove(animator); | - | ||||||
133 | } executed 32 times by 2 tests: end of block Executed by:
| 32 | ||||||
134 | } executed 64 times by 2 tests: end of block Executed by:
| 64 | ||||||
135 | - | |||||||
136 | - | |||||||
137 | void QQuickAnimatorController::requestSync() | - | ||||||
138 | { | - | ||||||
139 | - | |||||||
140 | m_window->maybeUpdate(); | - | ||||||
141 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||
142 | - | |||||||
143 | - | |||||||
144 | - | |||||||
145 | void QQuickAnimatorController::start_helper(QAbstractAnimationJob *job) | - | ||||||
146 | { | - | ||||||
147 | if (job->isRenderThreadJob()
| 6-36 | ||||||
148 | QQuickAnimatorJob *j = static_cast<QQuickAnimatorJob *>(job); | - | ||||||
149 | j->addAnimationChangeListener(this, QAbstractAnimationJob::StateChange); | - | ||||||
150 | j->initialize(this); | - | ||||||
151 | } executed 36 times by 2 tests: else if (job->isGroup()end of block Executed by:
| 0-36 | ||||||
152 | QAnimationGroupJob *g = static_cast<QAnimationGroupJob *>(job); | - | ||||||
153 | for (QAbstractAnimationJob *a = g->firstChild(); a
| 6-12 | ||||||
154 | start_helper(a); executed 12 times by 1 test: start_helper(a); Executed by:
| 12 | ||||||
155 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||
156 | } executed 42 times by 2 tests: end of block Executed by:
| 42 | ||||||
157 | - | |||||||
158 | - | |||||||
159 | void QQuickAnimatorController::start(const QSharedPointer<QAbstractAnimationJob> &job) | - | ||||||
160 | { | - | ||||||
161 | m_rootsPendingStart.insert(job); | - | ||||||
162 | m_rootsPendingStop.remove(job); | - | ||||||
163 | job->addAnimationChangeListener(this, QAbstractAnimationJob::Completion); | - | ||||||
164 | start_helper(job.data()); | - | ||||||
165 | requestSync(); | - | ||||||
166 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||
167 | - | |||||||
168 | - | |||||||
169 | - | |||||||
170 | void QQuickAnimatorController::cancel(const QSharedPointer<QAbstractAnimationJob> &job) | - | ||||||
171 | { | - | ||||||
172 | m_rootsPendingStart.remove(job); | - | ||||||
173 | m_rootsPendingStop.insert(job); | - | ||||||
174 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||
175 | - | |||||||
176 | - | |||||||
177 | - | |||||||
178 | - | |||||||
Switch to Source code | Preprocessed file |