Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/animations/qcontinuinganimationgroupjob.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2016 Jolla Ltd. | - | ||||||||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||
5 | ** | - | ||||||||||||
6 | ** This file is part of the QtQml module of the Qt Toolkit. | - | ||||||||||||
7 | ** | - | ||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||
16 | ** | - | ||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||
24 | ** | - | ||||||||||||
25 | ** GNU General Public License Usage | - | ||||||||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||
35 | ** | - | ||||||||||||
36 | ** $QT_END_LICENSE$ | - | ||||||||||||
37 | ** | - | ||||||||||||
38 | ****************************************************************************/ | - | ||||||||||||
39 | - | |||||||||||||
40 | #include "private/qcontinuinganimationgroupjob_p.h" | - | ||||||||||||
41 | #include "private/qanimationjobutil_p.h" | - | ||||||||||||
42 | - | |||||||||||||
43 | QT_BEGIN_NAMESPACE | - | ||||||||||||
44 | - | |||||||||||||
45 | QContinuingAnimationGroupJob::QContinuingAnimationGroupJob() | - | ||||||||||||
46 | { | - | ||||||||||||
47 | } | - | ||||||||||||
48 | - | |||||||||||||
49 | QContinuingAnimationGroupJob::~QContinuingAnimationGroupJob() | - | ||||||||||||
50 | { | - | ||||||||||||
51 | } | - | ||||||||||||
52 | - | |||||||||||||
53 | void QContinuingAnimationGroupJob::updateCurrentTime(int /*currentTime*/) | - | ||||||||||||
54 | { | - | ||||||||||||
55 | Q_ASSERT(firstChild()); | - | ||||||||||||
56 | - | |||||||||||||
57 | for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling()) {
| 1093-1106 | ||||||||||||
58 | if (animation->state() == state()) {
| 0-1106 | ||||||||||||
59 | RETURN_IF_DELETED(animation->setCurrentTime(m_currentTime)); executed 13 times by 2 tests: return; Executed by:
executed 13 times by 2 tests: *prevWasDeleted = true; Executed by:
| 0-1093 | ||||||||||||
60 | } executed 1093 times by 6 tests: end of block Executed by:
| 1093 | ||||||||||||
61 | } executed 1093 times by 6 tests: end of block Executed by:
| 1093 | ||||||||||||
62 | } executed 1093 times by 6 tests: end of block Executed by:
| 1093 | ||||||||||||
63 | - | |||||||||||||
64 | void QContinuingAnimationGroupJob::updateState(QAbstractAnimationJob::State newState, | - | ||||||||||||
65 | QAbstractAnimationJob::State oldState) | - | ||||||||||||
66 | { | - | ||||||||||||
67 | QAnimationGroupJob::updateState(newState, oldState); | - | ||||||||||||
68 | - | |||||||||||||
69 | switch (newState) { | - | ||||||||||||
70 | case Stopped: executed 99 times by 5 tests: case Stopped: Executed by:
| 99 | ||||||||||||
71 | for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling())
| 45-99 | ||||||||||||
72 | animation->stop(); executed 45 times by 5 tests: animation->stop(); Executed by:
| 45 | ||||||||||||
73 | break; executed 99 times by 5 tests: break; Executed by:
| 99 | ||||||||||||
74 | case Paused: executed 2 times by 1 test: case Paused: Executed by:
| 2 | ||||||||||||
75 | for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling())
| 2 | ||||||||||||
76 | if (animation->isRunning())
| 0-2 | ||||||||||||
77 | animation->pause(); executed 2 times by 1 test: animation->pause(); Executed by:
| 2 | ||||||||||||
78 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
79 | case Running: executed 121 times by 6 tests: case Running: Executed by:
| 121 | ||||||||||||
80 | if (!firstChild()) {
| 2-119 | ||||||||||||
81 | stop(); | - | ||||||||||||
82 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||
83 | } | - | ||||||||||||
84 | for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling()) {
| 119 | ||||||||||||
85 | resetUncontrolledAnimationFinishTime(animation); | - | ||||||||||||
86 | animation->setDirection(m_direction); | - | ||||||||||||
87 | animation->start(); | - | ||||||||||||
88 | } executed 119 times by 6 tests: end of block Executed by:
| 119 | ||||||||||||
89 | break; executed 119 times by 6 tests: break; Executed by:
| 119 | ||||||||||||
90 | } | - | ||||||||||||
91 | } executed 220 times by 6 tests: end of block Executed by:
| 220 | ||||||||||||
92 | - | |||||||||||||
93 | void QContinuingAnimationGroupJob::updateDirection(QAbstractAnimationJob::Direction direction) | - | ||||||||||||
94 | { | - | ||||||||||||
95 | if (!isStopped()) {
| 0 | ||||||||||||
96 | for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling()) {
| 0 | ||||||||||||
97 | animation->setDirection(direction); | - | ||||||||||||
98 | } never executed: end of block | 0 | ||||||||||||
99 | } never executed: end of block | 0 | ||||||||||||
100 | } never executed: end of block | 0 | ||||||||||||
101 | - | |||||||||||||
102 | void QContinuingAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimationJob *animation) | - | ||||||||||||
103 | { | - | ||||||||||||
104 | Q_ASSERT(animation && (animation->duration() == -1)); | - | ||||||||||||
105 | int uncontrolledRunningCount = 0; | - | ||||||||||||
106 | - | |||||||||||||
107 | for (QAbstractAnimationJob *child = firstChild(); child; child = child->nextSibling()) {
| 45 | ||||||||||||
108 | if (child == animation)
| 0-45 | ||||||||||||
109 | setUncontrolledAnimationFinishTime(animation, animation->currentTime()); executed 45 times by 5 tests: setUncontrolledAnimationFinishTime(animation, animation->currentTime()); Executed by:
| 45 | ||||||||||||
110 | else if (uncontrolledAnimationFinishTime(child) == -1)
| 0 | ||||||||||||
111 | ++uncontrolledRunningCount; never executed: ++uncontrolledRunningCount; | 0 | ||||||||||||
112 | } executed 45 times by 5 tests: end of block Executed by:
| 45 | ||||||||||||
113 | - | |||||||||||||
114 | if (uncontrolledRunningCount > 0)
| 0-45 | ||||||||||||
115 | return; never executed: return; | 0 | ||||||||||||
116 | - | |||||||||||||
117 | setUncontrolledAnimationFinishTime(this, currentTime()); | - | ||||||||||||
118 | stop(); | - | ||||||||||||
119 | } executed 45 times by 5 tests: end of block Executed by:
| 45 | ||||||||||||
120 | - | |||||||||||||
121 | void QContinuingAnimationGroupJob::debugAnimation(QDebug d) const | - | ||||||||||||
122 | { | - | ||||||||||||
123 | d << "ContinuingAnimationGroupJob(" << hex << (const void *) this << dec << ")"; | - | ||||||||||||
124 | - | |||||||||||||
125 | debugChildren(d); | - | ||||||||||||
126 | } never executed: end of block | 0 | ||||||||||||
127 | - | |||||||||||||
128 | QT_END_NAMESPACE | - | ||||||||||||
129 | - | |||||||||||||
Source code | Switch to Preprocessed file |