| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/animation/qsequentialanimationgroup.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | typedef QList<QAbstractAnimation *>::ConstIterator AnimationListConstIt; | - | ||||||||||||
| 9 | - | |||||||||||||
| 10 | bool QSequentialAnimationGroupPrivate::atEnd() const | - | ||||||||||||
| 11 | { | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | - | |||||||||||||
| 15 | - | |||||||||||||
| 16 | - | |||||||||||||
| 17 | - | |||||||||||||
| 18 | const int animTotalCurrentTime = QAbstractAnimationPrivate::get(currentAnimation)->totalCurrentTime; | - | ||||||||||||
| 19 | return executed 622 times by 5 tests: (currentLoop == loopCount - 1return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));Executed by:
executed 622 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));Executed by:
| 35-622 | ||||||||||||
| 20 | && direction == QAbstractAnimation::Forward
executed 622 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));Executed by:
| 2-622 | ||||||||||||
| 21 | && currentAnimation == animations.last()
executed 622 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));Executed by:
| 268-622 | ||||||||||||
| 22 | && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex)
executed 622 times by 5 tests: return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));Executed by:
| 35-622 | ||||||||||||
| 23 | } | - | ||||||||||||
| 24 | - | |||||||||||||
| 25 | int QSequentialAnimationGroupPrivate::animationActualTotalDuration(int index) const | - | ||||||||||||
| 26 | { | - | ||||||||||||
| 27 | QAbstractAnimation *anim = animations.at(index); | - | ||||||||||||
| 28 | int ret = anim->totalDuration(); | - | ||||||||||||
| 29 | if (ret == -1
| 21-1224 | ||||||||||||
| 30 | ret = actualDuration.at(index); executed 21 times by 1 test: ret = actualDuration.at(index);Executed by:
| 21 | ||||||||||||
| 31 | return executed 1301 times by 5 tests: ret;return ret;Executed by:
executed 1301 times by 5 tests: return ret;Executed by:
| 1301 | ||||||||||||
| 32 | } | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivate::indexForCurrentTime() const | - | ||||||||||||
| 35 | { | - | ||||||||||||
| 36 | ((!(!animations.isEmpty())) ? qt_assert("!animations.isEmpty()",__FILE__,112) : qt_noop()); | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | AnimationIndex ret; | - | ||||||||||||
| 39 | int duration = 0; | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | for (int i = 0; i < animations.size()
| 35-948 | ||||||||||||
| 42 | duration = animationActualTotalDuration(i); | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | - | |||||||||||||
| 46 | - | |||||||||||||
| 47 | - | |||||||||||||
| 48 | - | |||||||||||||
| 49 | if (duration == -1
| 38-910 | ||||||||||||
| 50 | || (currentTime == (ret.timeOffset + duration)
| 3-306 | ||||||||||||
| 51 | ret.index = i; | - | ||||||||||||
| 52 | return executed 588 times by 5 tests: ret;return ret;Executed by:
executed 588 times by 5 tests: return ret;Executed by:
| 588 | ||||||||||||
| 53 | } | - | ||||||||||||
| 54 | - | |||||||||||||
| 55 | - | |||||||||||||
| 56 | ret.timeOffset += duration; | - | ||||||||||||
| 57 | } executed 360 times by 5 tests: end of blockExecuted by:
| 360 | ||||||||||||
| 58 | - | |||||||||||||
| 59 | - | |||||||||||||
| 60 | - | |||||||||||||
| 61 | - | |||||||||||||
| 62 | ret.timeOffset -= duration; | - | ||||||||||||
| 63 | ret.index = animations.size() - 1; | - | ||||||||||||
| 64 | return executed 35 times by 4 tests: ret;return ret;Executed by:
executed 35 times by 4 tests: return ret;Executed by:
| 35 | ||||||||||||
| 65 | } | - | ||||||||||||
| 66 | - | |||||||||||||
| 67 | void QSequentialAnimationGroupPrivate::restart() | - | ||||||||||||
| 68 | { | - | ||||||||||||
| 69 | - | |||||||||||||
| 70 | if (direction == QAbstractAnimation::Forward
| 1-45 | ||||||||||||
| 71 | lastLoop = 0; | - | ||||||||||||
| 72 | if (currentAnimationIndex == 0
| 11-34 | ||||||||||||
| 73 | activateCurrentAnimation(); executed 34 times by 5 tests: activateCurrentAnimation();Executed by:
| 34 | ||||||||||||
| 74 | else | - | ||||||||||||
| 75 | setCurrentAnimation(0); executed 11 times by 2 tests: setCurrentAnimation(0);Executed by:
| 11 | ||||||||||||
| 76 | } else { | - | ||||||||||||
| 77 | lastLoop = loopCount - 1; | - | ||||||||||||
| 78 | int index = animations.size() - 1; | - | ||||||||||||
| 79 | if (currentAnimationIndex == index
| 0-1 | ||||||||||||
| 80 | activateCurrentAnimation(); executed 1 time by 1 test: activateCurrentAnimation();Executed by:
| 1 | ||||||||||||
| 81 | else | - | ||||||||||||
| 82 | setCurrentAnimation(index); never executed: setCurrentAnimation(index); | 0 | ||||||||||||
| 83 | } | - | ||||||||||||
| 84 | } | - | ||||||||||||
| 85 | - | |||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | void QSequentialAnimationGroupPrivate::advanceForwards(const AnimationIndex &newAnimationIndex) | - | ||||||||||||
| 93 | { | - | ||||||||||||
| 94 | if (lastLoop < currentLoop
| 7-50 | ||||||||||||
| 95 | - | |||||||||||||
| 96 | for (int i = currentAnimationIndex; i < animations.size()
| 7-13 | ||||||||||||
| 97 | QAbstractAnimation *anim = animations.at(i); | - | ||||||||||||
| 98 | setCurrentAnimation(i, true); | - | ||||||||||||
| 99 | anim->setCurrentTime(animationActualTotalDuration(i)); | - | ||||||||||||
| 100 | } executed 13 times by 2 tests: end of blockExecuted by:
| 13 | ||||||||||||
| 101 | - | |||||||||||||
| 102 | if (animations.size() == 1
| 2-5 | ||||||||||||
| 103 | - | |||||||||||||
| 104 | activateCurrentAnimation(); executed 2 times by 1 test: activateCurrentAnimation();Executed by:
| 2 | ||||||||||||
| 105 | else | - | ||||||||||||
| 106 | setCurrentAnimation(0, true); executed 5 times by 2 tests: setCurrentAnimation(0, true);Executed by:
| 5 | ||||||||||||
| 107 | } | - | ||||||||||||
| 108 | - | |||||||||||||
| 109 | - | |||||||||||||
| 110 | for (int i = currentAnimationIndex; i < newAnimationIndex.index
| 57-65 | ||||||||||||
| 111 | QAbstractAnimation *anim = animations.at(i); | - | ||||||||||||
| 112 | setCurrentAnimation(i, true); | - | ||||||||||||
| 113 | anim->setCurrentTime(animationActualTotalDuration(i)); | - | ||||||||||||
| 114 | } executed 65 times by 5 tests: end of blockExecuted by:
| 65 | ||||||||||||
| 115 | - | |||||||||||||
| 116 | } executed 57 times by 5 tests: end of blockExecuted by:
| 57 | ||||||||||||
| 117 | - | |||||||||||||
| 118 | - | |||||||||||||
| 119 | - | |||||||||||||
| 120 | - | |||||||||||||
| 121 | - | |||||||||||||
| 122 | - | |||||||||||||
| 123 | - | |||||||||||||
| 124 | void QSequentialAnimationGroupPrivate::rewindForwards(const AnimationIndex &newAnimationIndex) | - | ||||||||||||
| 125 | { | - | ||||||||||||
| 126 | if (lastLoop > currentLoop
| 1-3 | ||||||||||||
| 127 | - | |||||||||||||
| 128 | for (int i = currentAnimationIndex; i >= 0
| 1-4 | ||||||||||||
| 129 | QAbstractAnimation *anim = animations.at(i); | - | ||||||||||||
| 130 | setCurrentAnimation(i, true); | - | ||||||||||||
| 131 | anim->setCurrentTime(0); | - | ||||||||||||
| 132 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 133 | - | |||||||||||||
| 134 | if (animations.size() == 1
| 0-1 | ||||||||||||
| 135 | - | |||||||||||||
| 136 | activateCurrentAnimation(); never executed: activateCurrentAnimation(); | 0 | ||||||||||||
| 137 | else | - | ||||||||||||
| 138 | setCurrentAnimation(animations.count() - 1, true); executed 1 time by 1 test: setCurrentAnimation(animations.count() - 1, true);Executed by:
| 1 | ||||||||||||
| 139 | } | - | ||||||||||||
| 140 | - | |||||||||||||
| 141 | - | |||||||||||||
| 142 | for (int i = currentAnimationIndex; i > newAnimationIndex.index
| 4-9 | ||||||||||||
| 143 | QAbstractAnimation *anim = animations.at(i); | - | ||||||||||||
| 144 | setCurrentAnimation(i, true); | - | ||||||||||||
| 145 | anim->setCurrentTime(0); | - | ||||||||||||
| 146 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||
| 147 | - | |||||||||||||
| 148 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||||||||
| 149 | QSequentialAnimationGroup::QSequentialAnimationGroup(QObject *parent) | - | ||||||||||||
| 150 | : QAnimationGroup(*new QSequentialAnimationGroupPrivate, parent) | - | ||||||||||||
| 151 | { | - | ||||||||||||
| 152 | } executed 64 times by 5 tests: end of blockExecuted by:
| 64 | ||||||||||||
| 153 | - | |||||||||||||
| 154 | - | |||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | QSequentialAnimationGroup::QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, | - | ||||||||||||
| 158 | QObject *parent) | - | ||||||||||||
| 159 | : QAnimationGroup(dd, parent) | - | ||||||||||||
| 160 | { | - | ||||||||||||
| 161 | } never executed: end of block | 0 | ||||||||||||
| 162 | - | |||||||||||||
| 163 | - | |||||||||||||
| 164 | - | |||||||||||||
| 165 | - | |||||||||||||
| 166 | QSequentialAnimationGroup::~QSequentialAnimationGroup() | - | ||||||||||||
| 167 | { | - | ||||||||||||
| 168 | } | - | ||||||||||||
| 169 | QPauseAnimation *QSequentialAnimationGroup::addPause(int msecs) | - | ||||||||||||
| 170 | { | - | ||||||||||||
| 171 | QPauseAnimation *pause = new QPauseAnimation(msecs); | - | ||||||||||||
| 172 | addAnimation(pause); | - | ||||||||||||
| 173 | return executed 22 times by 1 test: pause;return pause;Executed by:
executed 22 times by 1 test: return pause;Executed by:
| 22 | ||||||||||||
| 174 | } | - | ||||||||||||
| 175 | - | |||||||||||||
| 176 | - | |||||||||||||
| 177 | - | |||||||||||||
| 178 | - | |||||||||||||
| 179 | - | |||||||||||||
| 180 | - | |||||||||||||
| 181 | - | |||||||||||||
| 182 | QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs) | - | ||||||||||||
| 183 | { | - | ||||||||||||
| 184 | const QSequentialAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 185 | - | |||||||||||||
| 186 | if (index < 0
| 0 | ||||||||||||
| 187 | QMessageLogger(__FILE__, 287, __PRETTY_FUNCTION__).warning("QSequentialAnimationGroup::insertPause: index is out of bounds"); | - | ||||||||||||
| 188 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 189 | } | - | ||||||||||||
| 190 | - | |||||||||||||
| 191 | QPauseAnimation *pause = new QPauseAnimation(msecs); | - | ||||||||||||
| 192 | insertAnimation(index, pause); | - | ||||||||||||
| 193 | return never executed: pause;return pause;never executed: return pause; | 0 | ||||||||||||
| 194 | } | - | ||||||||||||
| 195 | - | |||||||||||||
| 196 | - | |||||||||||||
| 197 | - | |||||||||||||
| 198 | - | |||||||||||||
| 199 | - | |||||||||||||
| 200 | - | |||||||||||||
| 201 | QAbstractAnimation *QSequentialAnimationGroup::currentAnimation() const | - | ||||||||||||
| 202 | { | - | ||||||||||||
| 203 | const QSequentialAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 204 | return executed 28 times by 3 tests: d->currentAnimation;return d->currentAnimation;Executed by:
executed 28 times by 3 tests: return d->currentAnimation;Executed by:
| 28 | ||||||||||||
| 205 | } | - | ||||||||||||
| 206 | - | |||||||||||||
| 207 | - | |||||||||||||
| 208 | - | |||||||||||||
| 209 | - | |||||||||||||
| 210 | int QSequentialAnimationGroup::duration() const | - | ||||||||||||
| 211 | { | - | ||||||||||||
| 212 | const QSequentialAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 213 | int ret = 0; | - | ||||||||||||
| 214 | - | |||||||||||||
| 215 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend
| 1914-4301 | ||||||||||||
| 216 | const int currentDuration = (*it)->totalDuration(); | - | ||||||||||||
| 217 | if (currentDuration == -1
| 65-4236 | ||||||||||||
| 218 | return executed 65 times by 1 test: -1;return -1;Executed by:
executed 65 times by 1 test: return -1;Executed by:
| 65 | ||||||||||||
| 219 | - | |||||||||||||
| 220 | ret += currentDuration; | - | ||||||||||||
| 221 | } executed 4236 times by 5 tests: end of blockExecuted by:
| 4236 | ||||||||||||
| 222 | - | |||||||||||||
| 223 | return executed 1914 times by 5 tests: ret;return ret;Executed by:
executed 1914 times by 5 tests: return ret;Executed by:
| 1914 | ||||||||||||
| 224 | } | - | ||||||||||||
| 225 | - | |||||||||||||
| 226 | - | |||||||||||||
| 227 | - | |||||||||||||
| 228 | - | |||||||||||||
| 229 | void QSequentialAnimationGroup::updateCurrentTime(int currentTime) | - | ||||||||||||
| 230 | { | - | ||||||||||||
| 231 | QSequentialAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 232 | if (!d->currentAnimation
| 2-623 | ||||||||||||
| 233 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||
| 234 | - | |||||||||||||
| 235 | const QSequentialAnimationGroupPrivate::AnimationIndex newAnimationIndex = d->indexForCurrentTime(); | - | ||||||||||||
| 236 | - | |||||||||||||
| 237 | - | |||||||||||||
| 238 | while (newAnimationIndex.index < d->actualDuration.size()
| 1-623 | ||||||||||||
| 239 | d->actualDuration.removeLast(); executed 1 time by 1 test: d->actualDuration.removeLast();Executed by:
| 1 | ||||||||||||
| 240 | - | |||||||||||||
| 241 | - | |||||||||||||
| 242 | if (d->lastLoop < d->currentLoop
| 7-616 | ||||||||||||
| 243 | || (d->lastLoop == d->currentLoop
| 1-615 | ||||||||||||
| 244 | - | |||||||||||||
| 245 | d->advanceForwards(newAnimationIndex); | - | ||||||||||||
| 246 | } executed 57 times by 5 tests: else if (d->lastLoop > d->currentLoopend of blockExecuted by:
| 1-565 | ||||||||||||
| 247 | || (d->lastLoop == d->currentLoop
| 0-565 | ||||||||||||
| 248 | - | |||||||||||||
| 249 | d->rewindForwards(newAnimationIndex); | - | ||||||||||||
| 250 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||||||||
| 251 | - | |||||||||||||
| 252 | d->setCurrentAnimation(newAnimationIndex.index); | - | ||||||||||||
| 253 | - | |||||||||||||
| 254 | const int newCurrentTime = currentTime - newAnimationIndex.timeOffset; | - | ||||||||||||
| 255 | - | |||||||||||||
| 256 | if (d->currentAnimation
| 1-622 | ||||||||||||
| 257 | d->currentAnimation->setCurrentTime(newCurrentTime); | - | ||||||||||||
| 258 | if (d->atEnd()
| 35-587 | ||||||||||||
| 259 | - | |||||||||||||
| 260 | d->currentTime += QAbstractAnimationPrivate::get(d->currentAnimation)->totalCurrentTime - newCurrentTime; | - | ||||||||||||
| 261 | stop(); | - | ||||||||||||
| 262 | } executed 35 times by 4 tests: end of blockExecuted by:
| 35 | ||||||||||||
| 263 | } executed 622 times by 5 tests: else {end of blockExecuted by:
| 622 | ||||||||||||
| 264 | - | |||||||||||||
| 265 | - | |||||||||||||
| 266 | ((!(d->animations.isEmpty())) ? qt_assert("d->animations.isEmpty()",__FILE__,366) : qt_noop()); | - | ||||||||||||
| 267 | d->currentTime = 0; | - | ||||||||||||
| 268 | stop(); | - | ||||||||||||
| 269 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 270 | - | |||||||||||||
| 271 | d->lastLoop = d->currentLoop; | - | ||||||||||||
| 272 | } executed 623 times by 5 tests: end of blockExecuted by:
| 623 | ||||||||||||
| 273 | - | |||||||||||||
| 274 | - | |||||||||||||
| 275 | - | |||||||||||||
| 276 | - | |||||||||||||
| 277 | void QSequentialAnimationGroup::updateState(QAbstractAnimation::State newState, | - | ||||||||||||
| 278 | QAbstractAnimation::State oldState) | - | ||||||||||||
| 279 | { | - | ||||||||||||
| 280 | QSequentialAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 281 | QAnimationGroup::updateState(newState, oldState); | - | ||||||||||||
| 282 | - | |||||||||||||
| 283 | if (!d->currentAnimation
| 4-101 | ||||||||||||
| 284 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||
| 285 | - | |||||||||||||
| 286 | switch (newState) { | - | ||||||||||||
| 287 | case executed 40 times by 5 tests: Stopped:case Stopped:Executed by:
executed 40 times by 5 tests: case Stopped:Executed by:
| 40 | ||||||||||||
| 288 | d->currentAnimation->stop(); | - | ||||||||||||
| 289 | break; executed 40 times by 5 tests: break;Executed by:
| 40 | ||||||||||||
| 290 | case executed 13 times by 1 test: Paused:case Paused:Executed by:
executed 13 times by 1 test: case Paused:Executed by:
| 13 | ||||||||||||
| 291 | if (oldState == d->currentAnimation->state()
| 0-13 | ||||||||||||
| 292 | && oldState == QSequentialAnimationGroup::Running
| 0-13 | ||||||||||||
| 293 | d->currentAnimation->pause(); | - | ||||||||||||
| 294 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||
| 295 | else | - | ||||||||||||
| 296 | d->restart(); never executed: d->restart(); | 0 | ||||||||||||
| 297 | break; executed 13 times by 1 test: break;Executed by:
| 13 | ||||||||||||
| 298 | case executed 48 times by 5 tests: Running:case Running:Executed by:
executed 48 times by 5 tests: case Running:Executed by:
| 48 | ||||||||||||
| 299 | if (oldState == d->currentAnimation->state()
| 1-47 | ||||||||||||
| 300 | && oldState == QSequentialAnimationGroup::Paused
| 2-45 | ||||||||||||
| 301 | d->currentAnimation->start(); executed 2 times by 1 test: d->currentAnimation->start();Executed by:
| 2 | ||||||||||||
| 302 | else | - | ||||||||||||
| 303 | d->restart(); executed 46 times by 5 tests: d->restart();Executed by:
| 46 | ||||||||||||
| 304 | break; executed 48 times by 5 tests: break;Executed by:
| 48 | ||||||||||||
| 305 | } | - | ||||||||||||
| 306 | } executed 101 times by 5 tests: end of blockExecuted by:
| 101 | ||||||||||||
| 307 | - | |||||||||||||
| 308 | - | |||||||||||||
| 309 | - | |||||||||||||
| 310 | - | |||||||||||||
| 311 | void QSequentialAnimationGroup::updateDirection(QAbstractAnimation::Direction direction) | - | ||||||||||||
| 312 | { | - | ||||||||||||
| 313 | QSequentialAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 314 | - | |||||||||||||
| 315 | if (state() != Stopped
| 0-2 | ||||||||||||
| 316 | d->currentAnimation->setDirection(direction); never executed: d->currentAnimation->setDirection(direction); | 0 | ||||||||||||
| 317 | } executed 2 times by 2 tests: end of blockExecuted by:
| 2 | ||||||||||||
| 318 | - | |||||||||||||
| 319 | - | |||||||||||||
| 320 | - | |||||||||||||
| 321 | - | |||||||||||||
| 322 | bool QSequentialAnimationGroup::event(QEvent *event) | - | ||||||||||||
| 323 | { | - | ||||||||||||
| 324 | return executed 266 times by 5 tests: QAnimationGroup::event(event);return QAnimationGroup::event(event);Executed by:
executed 266 times by 5 tests: return QAnimationGroup::event(event);Executed by:
| 266 | ||||||||||||
| 325 | } | - | ||||||||||||
| 326 | - | |||||||||||||
| 327 | void QSequentialAnimationGroupPrivate::setCurrentAnimation(int index, bool intermediate) | - | ||||||||||||
| 328 | { | - | ||||||||||||
| 329 | QSequentialAnimationGroup * const q = q_func(); | - | ||||||||||||
| 330 | - | |||||||||||||
| 331 | index = qMin(index, animations.count() - 1); | - | ||||||||||||
| 332 | - | |||||||||||||
| 333 | if (index == -1
| 23-900 | ||||||||||||
| 334 | ((!(animations.isEmpty())) ? qt_assert("animations.isEmpty()",__FILE__,434) : qt_noop()); | - | ||||||||||||
| 335 | currentAnimationIndex = -1; | - | ||||||||||||
| 336 | currentAnimation = 0; | - | ||||||||||||
| 337 | return; executed 23 times by 4 tests: return;Executed by:
| 23 | ||||||||||||
| 338 | } | - | ||||||||||||
| 339 | - | |||||||||||||
| 340 | - | |||||||||||||
| 341 | - | |||||||||||||
| 342 | if (index == currentAnimationIndex
| 27-722 | ||||||||||||
| 343 | return; executed 695 times by 5 tests: return;Executed by:
| 695 | ||||||||||||
| 344 | - | |||||||||||||
| 345 | - | |||||||||||||
| 346 | if (currentAnimation
| 65-140 | ||||||||||||
| 347 | currentAnimation->stop(); executed 140 times by 5 tests: currentAnimation->stop();Executed by:
| 140 | ||||||||||||
| 348 | - | |||||||||||||
| 349 | currentAnimation = animations.at(index); | - | ||||||||||||
| 350 | currentAnimationIndex = index; | - | ||||||||||||
| 351 | - | |||||||||||||
| 352 | q->currentAnimationChanged(currentAnimation); | - | ||||||||||||
| 353 | - | |||||||||||||
| 354 | activateCurrentAnimation(intermediate); | - | ||||||||||||
| 355 | } executed 205 times by 5 tests: end of blockExecuted by:
| 205 | ||||||||||||
| 356 | - | |||||||||||||
| 357 | void QSequentialAnimationGroupPrivate::activateCurrentAnimation(bool intermediate) | - | ||||||||||||
| 358 | { | - | ||||||||||||
| 359 | if (!currentAnimation
| 0-242 | ||||||||||||
| 360 | return; executed 126 times by 5 tests: return;Executed by:
| 126 | ||||||||||||
| 361 | - | |||||||||||||
| 362 | currentAnimation->stop(); | - | ||||||||||||
| 363 | - | |||||||||||||
| 364 | - | |||||||||||||
| 365 | currentAnimation->setDirection(direction); | - | ||||||||||||
| 366 | - | |||||||||||||
| 367 | - | |||||||||||||
| 368 | if (currentAnimation->totalDuration() == -1
| 6-110 | ||||||||||||
| 369 | connectUncontrolledAnimation(currentAnimation); executed 6 times by 1 test: connectUncontrolledAnimation(currentAnimation);Executed by:
| 6 | ||||||||||||
| 370 | - | |||||||||||||
| 371 | currentAnimation->start(); | - | ||||||||||||
| 372 | if (!intermediate
| 9-91 | ||||||||||||
| 373 | currentAnimation->pause(); executed 9 times by 1 test: currentAnimation->pause();Executed by:
| 9 | ||||||||||||
| 374 | } executed 116 times by 5 tests: end of blockExecuted by:
| 116 | ||||||||||||
| 375 | - | |||||||||||||
| 376 | void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished() | - | ||||||||||||
| 377 | { | - | ||||||||||||
| 378 | QSequentialAnimationGroup * const q = q_func(); | - | ||||||||||||
| 379 | ((!(qobject_cast<QAbstractAnimation *>(q->sender()) == currentAnimation)) ? qt_assert("qobject_cast<QAbstractAnimation *>(q->sender()) == currentAnimation",__FILE__,479) : qt_noop()); | - | ||||||||||||
| 380 | - | |||||||||||||
| 381 | - | |||||||||||||
| 382 | while (actualDuration.size() < (currentAnimationIndex + 1)
| 6-7 | ||||||||||||
| 383 | actualDuration.append(-1); executed 7 times by 1 test: actualDuration.append(-1);Executed by:
| 7 | ||||||||||||
| 384 | actualDuration[currentAnimationIndex] = currentAnimation->currentTime(); | - | ||||||||||||
| 385 | - | |||||||||||||
| 386 | disconnectUncontrolledAnimation(currentAnimation); | - | ||||||||||||
| 387 | - | |||||||||||||
| 388 | if ((direction == QAbstractAnimation::Forward
| 0-6 | ||||||||||||
| 389 | || (direction == QAbstractAnimation::Backward
| 0-3 | ||||||||||||
| 390 | - | |||||||||||||
| 391 | q->stop(); | - | ||||||||||||
| 392 | } executed 3 times by 1 test: else if (direction == QAbstractAnimation::Forwardend of blockExecuted by:
| 0-3 | ||||||||||||
| 393 | - | |||||||||||||
| 394 | setCurrentAnimation(currentAnimationIndex + 1); | - | ||||||||||||
| 395 | } executed 3 times by 1 test: else {end of blockExecuted by:
| 3 | ||||||||||||
| 396 | - | |||||||||||||
| 397 | setCurrentAnimation(currentAnimationIndex - 1); | - | ||||||||||||
| 398 | } never executed: end of block | 0 | ||||||||||||
| 399 | } | - | ||||||||||||
| 400 | - | |||||||||||||
| 401 | - | |||||||||||||
| 402 | - | |||||||||||||
| 403 | - | |||||||||||||
| 404 | - | |||||||||||||
| 405 | - | |||||||||||||
| 406 | - | |||||||||||||
| 407 | void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) | - | ||||||||||||
| 408 | { | - | ||||||||||||
| 409 | if (currentAnimation == 0
| 65-79 | ||||||||||||
| 410 | setCurrentAnimation(0); executed 65 times by 5 tests: setCurrentAnimation(0);Executed by:
| 65 | ||||||||||||
| 411 | - | |||||||||||||
| 412 | if (currentAnimationIndex == index
| 66-78 | ||||||||||||
| 413 | && currentAnimation->currentTime() == 0
| 0-66 | ||||||||||||
| 414 | - | |||||||||||||
| 415 | setCurrentAnimation(index); | - | ||||||||||||
| 416 | } executed 66 times by 5 tests: end of blockExecuted by:
| 66 | ||||||||||||
| 417 | - | |||||||||||||
| 418 | - | |||||||||||||
| 419 | currentAnimationIndex = animations.indexOf(currentAnimation); | - | ||||||||||||
| 420 | - | |||||||||||||
| 421 | if (index < currentAnimationIndex
| 0-144 | ||||||||||||
| 422 | QMessageLogger(__FILE__, 522, __PRETTY_FUNCTION__).warning("QSequentialGroup::insertAnimation only supports to add animations after the current one."); | - | ||||||||||||
| 423 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 424 | } | - | ||||||||||||
| 425 | } executed 143 times by 5 tests: end of blockExecuted by:
| 143 | ||||||||||||
| 426 | - | |||||||||||||
| 427 | - | |||||||||||||
| 428 | - | |||||||||||||
| 429 | - | |||||||||||||
| 430 | - | |||||||||||||
| 431 | - | |||||||||||||
| 432 | - | |||||||||||||
| 433 | void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim) | - | ||||||||||||
| 434 | { | - | ||||||||||||
| 435 | QSequentialAnimationGroup * const q = q_func(); | - | ||||||||||||
| 436 | QAnimationGroupPrivate::animationRemoved(index, anim); | - | ||||||||||||
| 437 | - | |||||||||||||
| 438 | ((!(currentAnimation)) ? qt_assert("currentAnimation",__FILE__,538) : qt_noop()); | - | ||||||||||||
| 439 | - | |||||||||||||
| 440 | if (actualDuration.size() > index
| 3-62 | ||||||||||||
| 441 | actualDuration.removeAt(index); executed 3 times by 1 test: actualDuration.removeAt(index);Executed by:
| 3 | ||||||||||||
| 442 | - | |||||||||||||
| 443 | const int currentIndex = animations.indexOf(currentAnimation); | - | ||||||||||||
| 444 | if (currentIndex == -1
| 7-58 | ||||||||||||
| 445 | - | |||||||||||||
| 446 | - | |||||||||||||
| 447 | disconnectUncontrolledAnimation(currentAnimation); | - | ||||||||||||
| 448 | - | |||||||||||||
| 449 | if (index < animations.count()
| 25-33 | ||||||||||||
| 450 | setCurrentAnimation(index); executed 25 times by 3 tests: setCurrentAnimation(index);Executed by:
| 25 | ||||||||||||
| 451 | else if (index > 0
| 11-22 | ||||||||||||
| 452 | setCurrentAnimation(index - 1); executed 11 times by 2 tests: setCurrentAnimation(index - 1);Executed by:
| 11 | ||||||||||||
| 453 | else | - | ||||||||||||
| 454 | setCurrentAnimation(-1); executed 22 times by 4 tests: setCurrentAnimation(-1);Executed by:
| 22 | ||||||||||||
| 455 | } else if (currentAnimationIndex > index
| 1-6 | ||||||||||||
| 456 | currentAnimationIndex--; | - | ||||||||||||
| 457 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 458 | - | |||||||||||||
| 459 | - | |||||||||||||
| 460 | currentTime = 0; | - | ||||||||||||
| 461 | for (int i = 0; i < currentAnimationIndex
| 7-65 | ||||||||||||
| 462 | const int current = animationActualTotalDuration(i); | - | ||||||||||||
| 463 | currentTime += current; | - | ||||||||||||
| 464 | } executed 7 times by 2 tests: end of blockExecuted by:
| 7 | ||||||||||||
| 465 | - | |||||||||||||
| 466 | if (currentIndex != -1
| 7-58 | ||||||||||||
| 467 | - | |||||||||||||
| 468 | - | |||||||||||||
| 469 | currentTime += QAbstractAnimationPrivate::get(currentAnimation)->totalCurrentTime; | - | ||||||||||||
| 470 | } executed 7 times by 2 tests: end of blockExecuted by:
| 7 | ||||||||||||
| 471 | - | |||||||||||||
| 472 | - | |||||||||||||
| 473 | totalCurrentTime = currentTime + loopCount * q->duration(); | - | ||||||||||||
| 474 | } executed 65 times by 4 tests: end of blockExecuted by:
| 65 | ||||||||||||
| 475 | - | |||||||||||||
| 476 | - | |||||||||||||
| 477 | - | |||||||||||||
| Switch to Source code | Preprocessed file |