| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/animations/qanimationgroupjob.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||
| 2 | ** | - | ||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company 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/qanimationgroupjob_p.h" | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | QAnimationGroupJob::QAnimationGroupJob() | - | ||||||||||||
| 45 | : QAbstractAnimationJob(), m_firstChild(nullptr), m_lastChild(nullptr) | - | ||||||||||||
| 46 | { | - | ||||||||||||
| 47 | m_isGroup = true; | - | ||||||||||||
| 48 | } executed 33873 times by 20 tests: end of blockExecuted by:
| 33873 | ||||||||||||
| 49 | - | |||||||||||||
| 50 | QAnimationGroupJob::~QAnimationGroupJob() | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | clear(); | - | ||||||||||||
| 53 | } executed 33829 times by 20 tests: end of blockExecuted by:
| 33829 | ||||||||||||
| 54 | - | |||||||||||||
| 55 | void QAnimationGroupJob::topLevelAnimationLoopChanged() | - | ||||||||||||
| 56 | { | - | ||||||||||||
| 57 | for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling())
| 33999-78773 | ||||||||||||
| 58 | animation->fireTopLevelAnimationLoopChanged(); executed 78773 times by 18 tests: animation->fireTopLevelAnimationLoopChanged();Executed by:
| 78773 | ||||||||||||
| 59 | } executed 33999 times by 19 tests: end of blockExecuted by:
| 33999 | ||||||||||||
| 60 | - | |||||||||||||
| 61 | void QAnimationGroupJob::appendAnimation(QAbstractAnimationJob *animation) | - | ||||||||||||
| 62 | { | - | ||||||||||||
| 63 | if (QAnimationGroupJob *oldGroup = animation->m_group)
| 71-78254 | ||||||||||||
| 64 | oldGroup->removeAnimation(animation); executed 71 times by 4 tests: oldGroup->removeAnimation(animation);Executed by:
| 71 | ||||||||||||
| 65 | - | |||||||||||||
| 66 | Q_ASSERT(!animation->previousSibling() && !animation->nextSibling()); | - | ||||||||||||
| 67 | - | |||||||||||||
| 68 | if (m_lastChild)
| 33845-44480 | ||||||||||||
| 69 | m_lastChild->m_nextSibling = animation; executed 44480 times by 16 tests: m_lastChild->m_nextSibling = animation;Executed by:
| 44480 | ||||||||||||
| 70 | else | - | ||||||||||||
| 71 | m_firstChild = animation; executed 33845 times by 20 tests: m_firstChild = animation;Executed by:
| 33845 | ||||||||||||
| 72 | animation->m_previousSibling = m_lastChild; | - | ||||||||||||
| 73 | m_lastChild = animation; | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | animation->m_group = this; | - | ||||||||||||
| 76 | animationInserted(animation); | - | ||||||||||||
| 77 | } executed 78325 times by 20 tests: end of blockExecuted by:
| 78325 | ||||||||||||
| 78 | - | |||||||||||||
| 79 | void QAnimationGroupJob::prependAnimation(QAbstractAnimationJob *animation) | - | ||||||||||||
| 80 | { | - | ||||||||||||
| 81 | if (QAnimationGroupJob *oldGroup = animation->m_group)
| 0-6 | ||||||||||||
| 82 | oldGroup->removeAnimation(animation); never executed: oldGroup->removeAnimation(animation); | 0 | ||||||||||||
| 83 | - | |||||||||||||
| 84 | Q_ASSERT(!previousSibling() && !nextSibling()); | - | ||||||||||||
| 85 | - | |||||||||||||
| 86 | if (m_firstChild)
| 2-4 | ||||||||||||
| 87 | m_firstChild->m_previousSibling = animation; executed 4 times by 1 test: m_firstChild->m_previousSibling = animation;Executed by:
| 4 | ||||||||||||
| 88 | else | - | ||||||||||||
| 89 | m_lastChild = animation; executed 2 times by 1 test: m_lastChild = animation;Executed by:
| 2 | ||||||||||||
| 90 | animation->m_nextSibling = m_firstChild; | - | ||||||||||||
| 91 | m_firstChild = animation; | - | ||||||||||||
| 92 | - | |||||||||||||
| 93 | animation->m_group = this; | - | ||||||||||||
| 94 | animationInserted(animation); | - | ||||||||||||
| 95 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 96 | - | |||||||||||||
| 97 | void QAnimationGroupJob::removeAnimation(QAbstractAnimationJob *animation) | - | ||||||||||||
| 98 | { | - | ||||||||||||
| 99 | Q_ASSERT(animation); | - | ||||||||||||
| 100 | Q_ASSERT(animation->m_group == this); | - | ||||||||||||
| 101 | QAbstractAnimationJob *prev = animation->previousSibling(); | - | ||||||||||||
| 102 | QAbstractAnimationJob *next = animation->nextSibling(); | - | ||||||||||||
| 103 | - | |||||||||||||
| 104 | if (prev)
| 213-232 | ||||||||||||
| 105 | prev->m_nextSibling = next; executed 232 times by 3 tests: prev->m_nextSibling = next;Executed by:
| 232 | ||||||||||||
| 106 | else | - | ||||||||||||
| 107 | m_firstChild = next; executed 213 times by 7 tests: m_firstChild = next;Executed by:
| 213 | ||||||||||||
| 108 | - | |||||||||||||
| 109 | if (next)
| 10-435 | ||||||||||||
| 110 | next->m_previousSibling = prev; executed 10 times by 3 tests: next->m_previousSibling = prev;Executed by:
| 10 | ||||||||||||
| 111 | else | - | ||||||||||||
| 112 | m_lastChild = prev; executed 435 times by 7 tests: m_lastChild = prev;Executed by:
| 435 | ||||||||||||
| 113 | - | |||||||||||||
| 114 | animation->m_previousSibling = nullptr; | - | ||||||||||||
| 115 | animation->m_nextSibling = nullptr; | - | ||||||||||||
| 116 | - | |||||||||||||
| 117 | animation->m_group = nullptr; | - | ||||||||||||
| 118 | animationRemoved(animation, prev, next); | - | ||||||||||||
| 119 | } executed 445 times by 7 tests: end of blockExecuted by:
| 445 | ||||||||||||
| 120 | - | |||||||||||||
| 121 | void QAnimationGroupJob::clear() | - | ||||||||||||
| 122 | { | - | ||||||||||||
| 123 | QAbstractAnimationJob *child = firstChild(); | - | ||||||||||||
| 124 | QAbstractAnimationJob *nextSibling = nullptr; | - | ||||||||||||
| 125 | while (child != nullptr) {
| 33835-77830 | ||||||||||||
| 126 | child->m_group = nullptr; | - | ||||||||||||
| 127 | nextSibling = child->nextSibling(); | - | ||||||||||||
| 128 | delete child; | - | ||||||||||||
| 129 | child = nextSibling; | - | ||||||||||||
| 130 | } executed 77830 times by 19 tests: end of blockExecuted by:
| 77830 | ||||||||||||
| 131 | m_firstChild = nullptr; | - | ||||||||||||
| 132 | m_lastChild = nullptr; | - | ||||||||||||
| 133 | } executed 33835 times by 20 tests: end of blockExecuted by:
| 33835 | ||||||||||||
| 134 | - | |||||||||||||
| 135 | void QAnimationGroupJob::resetUncontrolledAnimationsFinishTime() | - | ||||||||||||
| 136 | { | - | ||||||||||||
| 137 | for (QAbstractAnimationJob *animation = firstChild(); animation; animation = animation->nextSibling()) {
| 0 | ||||||||||||
| 138 | if (animation->duration() == -1 || animation->loopCount() < 0) {
| 0 | ||||||||||||
| 139 | resetUncontrolledAnimationFinishTime(animation); | - | ||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||
| 141 | } never executed: end of block | 0 | ||||||||||||
| 142 | } never executed: end of block | 0 | ||||||||||||
| 143 | - | |||||||||||||
| 144 | void QAnimationGroupJob::resetUncontrolledAnimationFinishTime(QAbstractAnimationJob *anim) | - | ||||||||||||
| 145 | { | - | ||||||||||||
| 146 | setUncontrolledAnimationFinishTime(anim, -1); | - | ||||||||||||
| 147 | } executed 32118 times by 15 tests: end of blockExecuted by:
| 32118 | ||||||||||||
| 148 | - | |||||||||||||
| 149 | void QAnimationGroupJob::setUncontrolledAnimationFinishTime(QAbstractAnimationJob *anim, int time) | - | ||||||||||||
| 150 | { | - | ||||||||||||
| 151 | anim->m_uncontrolledFinishTime = time; | - | ||||||||||||
| 152 | } executed 32282 times by 15 tests: end of blockExecuted by:
| 32282 | ||||||||||||
| 153 | - | |||||||||||||
| 154 | void QAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimationJob *animation) | - | ||||||||||||
| 155 | { | - | ||||||||||||
| 156 | Q_UNUSED(animation); | - | ||||||||||||
| 157 | } never executed: end of block | 0 | ||||||||||||
| 158 | - | |||||||||||||
| 159 | void QAnimationGroupJob::animationRemoved(QAbstractAnimationJob* anim, QAbstractAnimationJob* , QAbstractAnimationJob* ) | - | ||||||||||||
| 160 | { | - | ||||||||||||
| 161 | resetUncontrolledAnimationFinishTime(anim); | - | ||||||||||||
| 162 | if (!firstChild()) {
| 207-238 | ||||||||||||
| 163 | m_currentTime = 0; | - | ||||||||||||
| 164 | stop(); | - | ||||||||||||
| 165 | } executed 207 times by 7 tests: end of blockExecuted by:
| 207 | ||||||||||||
| 166 | } executed 445 times by 7 tests: end of blockExecuted by:
| 445 | ||||||||||||
| 167 | - | |||||||||||||
| 168 | void QAnimationGroupJob::debugChildren(QDebug d) const | - | ||||||||||||
| 169 | { | - | ||||||||||||
| 170 | int indentLevel = 1; | - | ||||||||||||
| 171 | const QAnimationGroupJob *group = this; | - | ||||||||||||
| 172 | while ((group = group->m_group))
| 0 | ||||||||||||
| 173 | ++indentLevel; never executed: ++indentLevel; | 0 | ||||||||||||
| 174 | - | |||||||||||||
| 175 | QByteArray ind(indentLevel, ' '); | - | ||||||||||||
| 176 | for (QAbstractAnimationJob *child = firstChild(); child; child = child->nextSibling())
| 0 | ||||||||||||
| 177 | d << "\n" << ind.constData() << child; never executed: d << "\n" << ind.constData() << child; | 0 | ||||||||||||
| 178 | } never executed: end of block | 0 | ||||||||||||
| 179 | - | |||||||||||||
| 180 | QT_END_NAMESPACE | - | ||||||||||||
| Source code | Switch to Preprocessed file |