| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/animation/qanimationgroup.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | - | |||||||||||||
| 11 | - | |||||||||||||
| 12 | - | |||||||||||||
| 13 | QAnimationGroup::QAnimationGroup(QObject *parent) | - | ||||||||||||
| 14 | : QAbstractAnimation(*new QAnimationGroupPrivate, parent) | - | ||||||||||||
| 15 | { | - | ||||||||||||
| 16 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 17 | - | |||||||||||||
| 18 | - | |||||||||||||
| 19 | - | |||||||||||||
| 20 | - | |||||||||||||
| 21 | QAnimationGroup::QAnimationGroup(QAnimationGroupPrivate &dd, QObject *parent) | - | ||||||||||||
| 22 | : QAbstractAnimation(dd, parent) | - | ||||||||||||
| 23 | { | - | ||||||||||||
| 24 | } executed 145 times by 6 tests: end of blockExecuted by:
| 145 | ||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | - | |||||||||||||
| 29 | QAnimationGroup::~QAnimationGroup() | - | ||||||||||||
| 30 | { | - | ||||||||||||
| 31 | } | - | ||||||||||||
| 32 | QAbstractAnimation *QAnimationGroup::animationAt(int index) const | - | ||||||||||||
| 33 | { | - | ||||||||||||
| 34 | const QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | if (index < 0
| 0-85 | ||||||||||||
| 37 | QMessageLogger(__FILE__, 132, __PRETTY_FUNCTION__).warning("QAnimationGroup::animationAt: index is out of bounds"); | - | ||||||||||||
| 38 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 39 | } | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | return executed 85 times by 4 tests: d->animations.at(index);return d->animations.at(index);Executed by:
executed 85 times by 4 tests: return d->animations.at(index);Executed by:
| 85 | ||||||||||||
| 42 | } | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | - | |||||||||||||
| 46 | - | |||||||||||||
| 47 | - | |||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | int QAnimationGroup::animationCount() const | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | const QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 53 | return executed 38 times by 4 tests: d->animations.size();return d->animations.size();Executed by:
executed 38 times by 4 tests: return d->animations.size();Executed by:
| 38 | ||||||||||||
| 54 | } | - | ||||||||||||
| 55 | - | |||||||||||||
| 56 | - | |||||||||||||
| 57 | - | |||||||||||||
| 58 | - | |||||||||||||
| 59 | - | |||||||||||||
| 60 | - | |||||||||||||
| 61 | - | |||||||||||||
| 62 | int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const | - | ||||||||||||
| 63 | { | - | ||||||||||||
| 64 | const QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 65 | return never executed: d->animations.indexOf(animation);return d->animations.indexOf(animation);never executed: return d->animations.indexOf(animation); | 0 | ||||||||||||
| 66 | } | - | ||||||||||||
| 67 | void QAnimationGroup::addAnimation(QAbstractAnimation *animation) | - | ||||||||||||
| 68 | { | - | ||||||||||||
| 69 | QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 70 | insertAnimation(d->animations.count(), animation); | - | ||||||||||||
| 71 | } executed 335 times by 7 tests: end of blockExecuted by:
| 335 | ||||||||||||
| 72 | void QAnimationGroup::insertAnimation(int index, QAbstractAnimation *animation) | - | ||||||||||||
| 73 | { | - | ||||||||||||
| 74 | QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 75 | - | |||||||||||||
| 76 | if (index < 0
| 0-337 | ||||||||||||
| 77 | QMessageLogger(__FILE__, 191, __PRETTY_FUNCTION__).warning("QAnimationGroup::insertAnimation: index is out of bounds"); | - | ||||||||||||
| 78 | return; never executed: return; | 0 | ||||||||||||
| 79 | } | - | ||||||||||||
| 80 | - | |||||||||||||
| 81 | if (QAnimationGroup *oldGroup = animation->group()
| 2-335 | ||||||||||||
| 82 | oldGroup->removeAnimation(animation); executed 2 times by 1 test: oldGroup->removeAnimation(animation);Executed by:
| 2 | ||||||||||||
| 83 | - | |||||||||||||
| 84 | d->animations.insert(index, animation); | - | ||||||||||||
| 85 | QAbstractAnimationPrivate::get(animation)->group = this; | - | ||||||||||||
| 86 | - | |||||||||||||
| 87 | animation->setParent(this); | - | ||||||||||||
| 88 | d->animationInsertedAt(index); | - | ||||||||||||
| 89 | } executed 337 times by 7 tests: end of blockExecuted by:
| 337 | ||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | - | |||||||||||||
| 93 | - | |||||||||||||
| 94 | - | |||||||||||||
| 95 | - | |||||||||||||
| 96 | - | |||||||||||||
| 97 | void QAnimationGroup::removeAnimation(QAbstractAnimation *animation) | - | ||||||||||||
| 98 | { | - | ||||||||||||
| 99 | QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 100 | - | |||||||||||||
| 101 | if (!animation
| 0-8 | ||||||||||||
| 102 | QMessageLogger(__FILE__, 216, __PRETTY_FUNCTION__).warning("QAnimationGroup::remove: cannot remove null animation"); | - | ||||||||||||
| 103 | return; never executed: return; | 0 | ||||||||||||
| 104 | } | - | ||||||||||||
| 105 | int index = d->animations.indexOf(animation); | - | ||||||||||||
| 106 | if (index == -1
| 0-8 | ||||||||||||
| 107 | QMessageLogger(__FILE__, 221, __PRETTY_FUNCTION__).warning("QAnimationGroup::remove: animation is not part of this group"); | - | ||||||||||||
| 108 | return; never executed: return; | 0 | ||||||||||||
| 109 | } | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | takeAnimation(index); | - | ||||||||||||
| 112 | } executed 8 times by 3 tests: end of blockExecuted by:
| 8 | ||||||||||||
| 113 | QAbstractAnimation *QAnimationGroup::takeAnimation(int index) | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 116 | if (index < 0
| 0-229 | ||||||||||||
| 117 | QMessageLogger(__FILE__, 239, __PRETTY_FUNCTION__).warning("QAnimationGroup::takeAnimation: no animation at index %d", index); | - | ||||||||||||
| 118 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 119 | } | - | ||||||||||||
| 120 | QAbstractAnimation *animation = d->animations.at(index); | - | ||||||||||||
| 121 | QAbstractAnimationPrivate::get(animation)->group = 0; | - | ||||||||||||
| 122 | - | |||||||||||||
| 123 | - | |||||||||||||
| 124 | d->animations.removeAt(index); | - | ||||||||||||
| 125 | animation->setParent(0); | - | ||||||||||||
| 126 | d->animationRemoved(index, animation); | - | ||||||||||||
| 127 | return executed 229 times by 5 tests: animation;return animation;Executed by:
executed 229 times by 5 tests: return animation;Executed by:
| 229 | ||||||||||||
| 128 | } | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | - | |||||||||||||
| 131 | - | |||||||||||||
| 132 | - | |||||||||||||
| 133 | - | |||||||||||||
| 134 | - | |||||||||||||
| 135 | - | |||||||||||||
| 136 | void QAnimationGroup::clear() | - | ||||||||||||
| 137 | { | - | ||||||||||||
| 138 | QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 139 | qDeleteAll(d->animations); | - | ||||||||||||
| 140 | } executed 5 times by 3 tests: end of blockExecuted by:
| 5 | ||||||||||||
| 141 | - | |||||||||||||
| 142 | - | |||||||||||||
| 143 | - | |||||||||||||
| 144 | - | |||||||||||||
| 145 | bool QAnimationGroup::event(QEvent *event) | - | ||||||||||||
| 146 | { | - | ||||||||||||
| 147 | QAnimationGroupPrivate * const d = d_func(); | - | ||||||||||||
| 148 | if (event->type() == QEvent::ChildAdded
| 337-450 | ||||||||||||
| 149 | QChildEvent *childEvent = static_cast<QChildEvent *>(event); | - | ||||||||||||
| 150 | if (QAbstractAnimation *a = qobject_cast<QAbstractAnimation *>(childEvent->child())
| 0-337 | ||||||||||||
| 151 | if (a->group() != this
| 65-272 | ||||||||||||
| 152 | addAnimation(a); executed 65 times by 4 tests: addAnimation(a);Executed by:
| 65 | ||||||||||||
| 153 | } executed 337 times by 7 tests: end of blockExecuted by:
| 337 | ||||||||||||
| 154 | } executed 337 times by 7 tests: else if (event->type() == QEvent::ChildRemovedend of blockExecuted by:
| 0-450 | ||||||||||||
| 155 | QChildEvent *childEvent = static_cast<QChildEvent *>(event); | - | ||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| 159 | const QList<QAbstractAnimation *>::const_iterator it | - | ||||||||||||
| 160 | = std::find(d->animations.cbegin(), d->animations.cend(), childEvent->child()); | - | ||||||||||||
| 161 | if (it != d->animations.cend()
| 221-229 | ||||||||||||
| 162 | takeAnimation(it - d->animations.cbegin()); executed 221 times by 4 tests: takeAnimation(it - d->animations.cbegin());Executed by:
| 221 | ||||||||||||
| 163 | } executed 450 times by 5 tests: end of blockExecuted by:
| 450 | ||||||||||||
| 164 | return executed 787 times by 7 tests: QAbstractAnimation::event(event);return QAbstractAnimation::event(event);Executed by:
executed 787 times by 7 tests: return QAbstractAnimation::event(event);Executed by:
| 787 | ||||||||||||
| 165 | } | - | ||||||||||||
| 166 | - | |||||||||||||
| 167 | - | |||||||||||||
| 168 | void QAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *) | - | ||||||||||||
| 169 | { | - | ||||||||||||
| 170 | QAnimationGroup * const q = q_func(); | - | ||||||||||||
| 171 | (void)index;; | - | ||||||||||||
| 172 | if (animations.isEmpty()
| 77-152 | ||||||||||||
| 173 | currentTime = 0; | - | ||||||||||||
| 174 | q->stop(); | - | ||||||||||||
| 175 | } executed 77 times by 5 tests: end of blockExecuted by:
| 77 | ||||||||||||
| 176 | } executed 229 times by 5 tests: end of blockExecuted by:
| 229 | ||||||||||||
| 177 | - | |||||||||||||
| 178 | - | |||||||||||||
| 179 | - | |||||||||||||
| Switch to Source code | Preprocessed file |