| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickanimatedimage.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | QQuickPixmap* QQuickAnimatedImagePrivate::infoForCurrentFrame(QQmlEngine *engine) | - | ||||||||||||||||||
| 8 | { | - | ||||||||||||||||||
| 9 | if (!movie
| 0-404 | ||||||||||||||||||
| 10 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | int current = movie->currentFrameNumber(); | - | ||||||||||||||||||
| 13 | if (!frameMap.contains(current)
| 172-232 | ||||||||||||||||||
| 14 | QUrl requestedUrl; | - | ||||||||||||||||||
| 15 | QQuickPixmap *pixmap = nullptr; | - | ||||||||||||||||||
| 16 | if (engine
| 0-232 | ||||||||||||||||||
| 17 | requestedUrl.setUrl(QString::fromUtf8("quickanimatedimage://%1#%2") | - | ||||||||||||||||||
| 18 | .arg(movie->fileName()) | - | ||||||||||||||||||
| 19 | .arg(current)); | - | ||||||||||||||||||
| 20 | } executed 220 times by 1 test: end of blockExecuted by:
| 220 | ||||||||||||||||||
| 21 | if (!requestedUrl.isEmpty()
| 12-220 | ||||||||||||||||||
| 22 | if (QQuickPixmap::isCached(requestedUrl, QSize(), QQuickImageProviderOptions())
| 56-164 | ||||||||||||||||||
| 23 | pixmap = new QQuickPixmap(engine, requestedUrl); executed 164 times by 1 test: pixmap = new QQuickPixmap(engine, requestedUrl);Executed by:
| 164 | ||||||||||||||||||
| 24 | else | - | ||||||||||||||||||
| 25 | pixmap = new QQuickPixmap(requestedUrl, movie->currentImage()); executed 56 times by 1 test: pixmap = new QQuickPixmap(requestedUrl, movie->currentImage());Executed by:
| 56 | ||||||||||||||||||
| 26 | } else { | - | ||||||||||||||||||
| 27 | pixmap = new QQuickPixmap; | - | ||||||||||||||||||
| 28 | pixmap->setImage(movie->currentImage()); | - | ||||||||||||||||||
| 29 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 30 | frameMap.insert(current, pixmap); | - | ||||||||||||||||||
| 31 | } executed 232 times by 1 test: end of blockExecuted by:
| 232 | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | return executed 404 times by 1 test: frameMap.value(current);return frameMap.value(current);Executed by:
executed 404 times by 1 test: return frameMap.value(current);Executed by:
| 404 | ||||||||||||||||||
| 34 | } | - | ||||||||||||||||||
| 35 | QQuickAnimatedImage::QQuickAnimatedImage(QQuickItem *parent) | - | ||||||||||||||||||
| 36 | : QQuickImage(*(new QQuickAnimatedImagePrivate), parent) | - | ||||||||||||||||||
| 37 | { | - | ||||||||||||||||||
| 38 | connect(this, &QQuickImageBase::cacheChanged, this, &QQuickAnimatedImage::onCacheChanged); | - | ||||||||||||||||||
| 39 | } executed 90 times by 2 tests: end of blockExecuted by:
| 90 | ||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | QQuickAnimatedImage::~QQuickAnimatedImage() | - | ||||||||||||||||||
| 42 | { | - | ||||||||||||||||||
| 43 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 44 | - | |||||||||||||||||||
| 45 | if (d->reply
| 6-84 | ||||||||||||||||||
| 46 | d->reply->deleteLater(); executed 6 times by 1 test: d->reply->deleteLater();Executed by:
| 6 | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | delete d->movie; | - | ||||||||||||||||||
| 49 | qDeleteAll(d->frameMap); | - | ||||||||||||||||||
| 50 | d->frameMap.clear(); | - | ||||||||||||||||||
| 51 | } executed 90 times by 2 tests: end of blockExecuted by:
| 90 | ||||||||||||||||||
| 52 | bool QQuickAnimatedImage::isPaused() const | - | ||||||||||||||||||
| 53 | { | - | ||||||||||||||||||
| 54 | const QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 55 | if (!d->movie
| 42-48 | ||||||||||||||||||
| 56 | return executed 42 times by 1 test: d->paused;return d->paused;Executed by:
executed 42 times by 1 test: return d->paused;Executed by:
| 42 | ||||||||||||||||||
| 57 | return executed 48 times by 1 test: d->movie->state()==QMovie::Paused;return d->movie->state()==QMovie::Paused;Executed by:
executed 48 times by 1 test: return d->movie->state()==QMovie::Paused;Executed by:
| 48 | ||||||||||||||||||
| 58 | } | - | ||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | void QQuickAnimatedImage::setPaused(bool pause) | - | ||||||||||||||||||
| 61 | { | - | ||||||||||||||||||
| 62 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 63 | if (pause == d->paused
| 2-14 | ||||||||||||||||||
| 64 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||
| 65 | if (!d->movie
| 2-12 | ||||||||||||||||||
| 66 | d->paused = pause; | - | ||||||||||||||||||
| 67 | pausedChanged(); | - | ||||||||||||||||||
| 68 | } executed 12 times by 1 test: else {end of blockExecuted by:
| 12 | ||||||||||||||||||
| 69 | d->movie->setPaused(pause); | - | ||||||||||||||||||
| 70 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 71 | } | - | ||||||||||||||||||
| 72 | bool QQuickAnimatedImage::isPlaying() const | - | ||||||||||||||||||
| 73 | { | - | ||||||||||||||||||
| 74 | const QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 75 | if (!d->movie
| 164-338 | ||||||||||||||||||
| 76 | return executed 164 times by 2 tests: d->playing;return d->playing;Executed by:
executed 164 times by 2 tests: return d->playing;Executed by:
| 164 | ||||||||||||||||||
| 77 | return executed 338 times by 1 test: d->movie->state()!=QMovie::NotRunning;return d->movie->state()!=QMovie::NotRunning;Executed by:
executed 338 times by 1 test: return d->movie->state()!=QMovie::NotRunning;Executed by:
| 338 | ||||||||||||||||||
| 78 | } | - | ||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | void QQuickAnimatedImage::setPlaying(bool play) | - | ||||||||||||||||||
| 81 | { | - | ||||||||||||||||||
| 82 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 83 | if (play == d->playing
| 2-16 | ||||||||||||||||||
| 84 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||
| 85 | if (!d->movie
| 6-10 | ||||||||||||||||||
| 86 | d->playing = play; | - | ||||||||||||||||||
| 87 | playingChanged(); | - | ||||||||||||||||||
| 88 | return; executed 10 times by 1 test: return;Executed by:
| 10 | ||||||||||||||||||
| 89 | } | - | ||||||||||||||||||
| 90 | if (play
| 2-4 | ||||||||||||||||||
| 91 | d->movie->start(); executed 4 times by 1 test: d->movie->start();Executed by:
| 4 | ||||||||||||||||||
| 92 | else | - | ||||||||||||||||||
| 93 | d->movie->stop(); executed 2 times by 1 test: d->movie->stop();Executed by:
| 2 | ||||||||||||||||||
| 94 | } | - | ||||||||||||||||||
| 95 | int QQuickAnimatedImage::currentFrame() const | - | ||||||||||||||||||
| 96 | { | - | ||||||||||||||||||
| 97 | const QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 98 | if (!d->movie
| 8-22 | ||||||||||||||||||
| 99 | return executed 8 times by 2 tests: d->presetCurrentFrame;return d->presetCurrentFrame;Executed by:
executed 8 times by 2 tests: return d->presetCurrentFrame;Executed by:
| 8 | ||||||||||||||||||
| 100 | return executed 22 times by 2 tests: d->movie->currentFrameNumber();return d->movie->currentFrameNumber();Executed by:
executed 22 times by 2 tests: return d->movie->currentFrameNumber();Executed by:
| 22 | ||||||||||||||||||
| 101 | } | - | ||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | void QQuickAnimatedImage::setCurrentFrame(int frame) | - | ||||||||||||||||||
| 104 | { | - | ||||||||||||||||||
| 105 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 106 | if (!d->movie
| 8-40 | ||||||||||||||||||
| 107 | d->presetCurrentFrame = frame; | - | ||||||||||||||||||
| 108 | return; executed 8 times by 1 test: return;Executed by:
| 8 | ||||||||||||||||||
| 109 | } | - | ||||||||||||||||||
| 110 | d->movie->jumpToFrame(frame); | - | ||||||||||||||||||
| 111 | } executed 40 times by 1 test: end of blockExecuted by:
| 40 | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | int QQuickAnimatedImage::frameCount() const | - | ||||||||||||||||||
| 114 | { | - | ||||||||||||||||||
| 115 | const QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 116 | if (!d->movie
| 242-270 | ||||||||||||||||||
| 117 | return executed 242 times by 2 tests: 0;return 0;Executed by:
executed 242 times by 2 tests: return 0;Executed by:
| 242 | ||||||||||||||||||
| 118 | return executed 270 times by 2 tests: d->movie->frameCount();return d->movie->frameCount();Executed by:
executed 270 times by 2 tests: return d->movie->frameCount();Executed by:
| 270 | ||||||||||||||||||
| 119 | } | - | ||||||||||||||||||
| 120 | qreal QQuickAnimatedImage::speed() const | - | ||||||||||||||||||
| 121 | { | - | ||||||||||||||||||
| 122 | const QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 123 | return never executed: d->speed;return d->speed;never executed: return d->speed; | 0 | ||||||||||||||||||
| 124 | } | - | ||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | void QQuickAnimatedImage::setSpeed(qreal speed) | - | ||||||||||||||||||
| 127 | { | - | ||||||||||||||||||
| 128 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 129 | if (d->speed != speed
| 0 | ||||||||||||||||||
| 130 | d->speed = speed; | - | ||||||||||||||||||
| 131 | if (d->movie
| 0 | ||||||||||||||||||
| 132 | d->movie->setSpeed(qRound(speed * 100.0)); never executed: d->movie->setSpeed(qRound(speed * 100.0)); | 0 | ||||||||||||||||||
| 133 | speedChanged(); | - | ||||||||||||||||||
| 134 | } never executed: end of block | 0 | ||||||||||||||||||
| 135 | } never executed: end of block | 0 | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | void QQuickAnimatedImage::setSource(const QUrl &url) | - | ||||||||||||||||||
| 138 | { | - | ||||||||||||||||||
| 139 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 140 | if (url == d->url
| 64-168 | ||||||||||||||||||
| 141 | return; executed 64 times by 1 test: return;Executed by:
| 64 | ||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | if (d->reply
| 8-160 | ||||||||||||||||||
| 145 | d->reply->deleteLater(); | - | ||||||||||||||||||
| 146 | d->reply = nullptr; | - | ||||||||||||||||||
| 147 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | d->setImage(QImage()); | - | ||||||||||||||||||
| 151 | qDeleteAll(d->frameMap); | - | ||||||||||||||||||
| 152 | d->frameMap.clear(); | - | ||||||||||||||||||
| 153 | - | |||||||||||||||||||
| 154 | d->oldPlaying = isPlaying(); | - | ||||||||||||||||||
| 155 | d->setMovie(nullptr); | - | ||||||||||||||||||
| 156 | d->url = url; | - | ||||||||||||||||||
| 157 | sourceChanged(d->url); | - | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | if (isComponentComplete()
| 82-86 | ||||||||||||||||||
| 160 | load(); executed 86 times by 1 test: load();Executed by:
| 86 | ||||||||||||||||||
| 161 | } executed 168 times by 2 tests: end of blockExecuted by:
| 168 | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | void QQuickAnimatedImage::load() | - | ||||||||||||||||||
| 164 | { | - | ||||||||||||||||||
| 165 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | if (d->url.isEmpty()
| 16-160 | ||||||||||||||||||
| 168 | if (d->progress != 0
| 8 | ||||||||||||||||||
| 169 | d->progress = 0; | - | ||||||||||||||||||
| 170 | progressChanged(d->progress); | - | ||||||||||||||||||
| 171 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | d->setImage(QImage()); | - | ||||||||||||||||||
| 174 | d->status = Null; | - | ||||||||||||||||||
| 175 | statusChanged(d->status); | - | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | d->currentSourceSize = QSize(0, 0); | - | ||||||||||||||||||
| 178 | if (d->currentSourceSize != d->oldSourceSize
| 0-16 | ||||||||||||||||||
| 179 | d->oldSourceSize = d->currentSourceSize; | - | ||||||||||||||||||
| 180 | sourceSizeChanged(); | - | ||||||||||||||||||
| 181 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 182 | if (isPlaying() != d->oldPlaying
| 8 | ||||||||||||||||||
| 183 | playingChanged(); executed 8 times by 1 test: playingChanged();Executed by:
| 8 | ||||||||||||||||||
| 184 | } executed 16 times by 1 test: else {end of blockExecuted by:
| 16 | ||||||||||||||||||
| 185 | const qreal targetDevicePixelRatio = (window()
| 2-158 | ||||||||||||||||||
| 186 | d->devicePixelRatio = 1.0; | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | QUrl loadUrl = d->url; | - | ||||||||||||||||||
| 189 | resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio); | - | ||||||||||||||||||
| 190 | QString lf = QQmlFile::urlToLocalFileOrQrc(loadUrl); | - | ||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | if (!lf.isEmpty()
| 14-146 | ||||||||||||||||||
| 193 | d->setMovie(new QMovie(lf)); | - | ||||||||||||||||||
| 194 | movieRequestFinished(); | - | ||||||||||||||||||
| 195 | } executed 146 times by 2 tests: else {end of blockExecuted by:
| 146 | ||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | if (d->status != Loading
| 0-14 | ||||||||||||||||||
| 198 | d->status = Loading; | - | ||||||||||||||||||
| 199 | statusChanged(d->status); | - | ||||||||||||||||||
| 200 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||
| 201 | if (d->progress != 0
| 6-8 | ||||||||||||||||||
| 202 | d->progress = 0; | - | ||||||||||||||||||
| 203 | progressChanged(d->progress); | - | ||||||||||||||||||
| 204 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 205 | QNetworkRequest req(d->url); | - | ||||||||||||||||||
| 206 | req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); | - | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | d->reply = qmlEngine(this)->networkAccessManager()->get(req); | - | ||||||||||||||||||
| 209 | connect(d->reply, &QNetworkReply::finished, this, &QQuickAnimatedImage::movieRequestFinished); | - | ||||||||||||||||||
| 210 | connect(d->reply, qFlagLocation("2""downloadProgress(qint64,qint64)" "\0" __FILE__ ":" "362"), this, qFlagLocation("1""requestProgress(qint64,qint64)" "\0" __FILE__ ":" "362")); | - | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||
| 213 | } | - | ||||||||||||||||||
| 214 | } | - | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | void QQuickAnimatedImage::movieRequestFinished() | - | ||||||||||||||||||
| 219 | { | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | if (d->reply
| 10-146 | ||||||||||||||||||
| 225 | d->redirectCount++; | - | ||||||||||||||||||
| 226 | if (d->redirectCount < 16
| 0-10 | ||||||||||||||||||
| 227 | QVariant redirect = d->reply->attribute(QNetworkRequest::RedirectionTargetAttribute); | - | ||||||||||||||||||
| 228 | if (redirect.isValid()
| 0-10 | ||||||||||||||||||
| 229 | QUrl url = d->reply->url().resolved(redirect.toUrl()); | - | ||||||||||||||||||
| 230 | d->reply->deleteLater(); | - | ||||||||||||||||||
| 231 | setSource(url); | - | ||||||||||||||||||
| 232 | return; never executed: return; | 0 | ||||||||||||||||||
| 233 | } | - | ||||||||||||||||||
| 234 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | d->redirectCount=0; | - | ||||||||||||||||||
| 237 | d->setMovie(new QMovie(d->reply)); | - | ||||||||||||||||||
| 238 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | if (!d->movie
| 0-156 | ||||||||||||||||||
| 242 | qmlWarning(this) << "Error Reading Animated Image File " << d->url.toString(); | - | ||||||||||||||||||
| 243 | d->setMovie(nullptr); | - | ||||||||||||||||||
| 244 | d->setImage(QImage()); | - | ||||||||||||||||||
| 245 | if (d->progress != 0
| 0-4 | ||||||||||||||||||
| 246 | d->progress = 0; | - | ||||||||||||||||||
| 247 | progressChanged(d->progress); | - | ||||||||||||||||||
| 248 | } never executed: end of block | 0 | ||||||||||||||||||
| 249 | d->status = Error; | - | ||||||||||||||||||
| 250 | statusChanged(d->status); | - | ||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | d->currentSourceSize = QSize(0, 0); | - | ||||||||||||||||||
| 253 | if (d->currentSourceSize != d->oldSourceSize
| 0-4 | ||||||||||||||||||
| 254 | d->oldSourceSize = d->currentSourceSize; | - | ||||||||||||||||||
| 255 | sourceSizeChanged(); | - | ||||||||||||||||||
| 256 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 257 | if (isPlaying() != d->oldPlaying
| 0-4 | ||||||||||||||||||
| 258 | playingChanged(); never executed: playingChanged(); | 0 | ||||||||||||||||||
| 259 | return; executed 4 times by 2 tests: return;Executed by:
| 4 | ||||||||||||||||||
| 260 | } | - | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | connect(d->movie, &QMovie::stateChanged, this, &QQuickAnimatedImage::playingStatusChanged); | - | ||||||||||||||||||
| 263 | connect(d->movie, &QMovie::frameChanged, this, &QQuickAnimatedImage::movieUpdate); | - | ||||||||||||||||||
| 264 | if (d->cache
| 2-150 | ||||||||||||||||||
| 265 | d->movie->setCacheMode(QMovie::CacheAll); executed 150 times by 1 test: d->movie->setCacheMode(QMovie::CacheAll);Executed by:
| 150 | ||||||||||||||||||
| 266 | d->movie->setSpeed(qRound(d->speed * 100.0)); | - | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | d->status = Ready; | - | ||||||||||||||||||
| 269 | statusChanged(d->status); | - | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | if (d->progress != 1.0
| 70-82 | ||||||||||||||||||
| 272 | d->progress = 1.0; | - | ||||||||||||||||||
| 273 | progressChanged(d->progress); | - | ||||||||||||||||||
| 274 | } executed 82 times by 1 test: end of blockExecuted by:
| 82 | ||||||||||||||||||
| 275 | - | |||||||||||||||||||
| 276 | bool pausedAtStart = d->paused; | - | ||||||||||||||||||
| 277 | if (d->movie
| 0-152 | ||||||||||||||||||
| 278 | d->movie->start(); executed 146 times by 1 test: d->movie->start();Executed by:
| 146 | ||||||||||||||||||
| 279 | if (d->movie
| 0-152 | ||||||||||||||||||
| 280 | d->movie->setPaused(true); executed 6 times by 1 test: d->movie->setPaused(true);Executed by:
| 6 | ||||||||||||||||||
| 281 | if (d->movie
| 0-152 | ||||||||||||||||||
| 282 | d->movie->jumpToFrame(d->presetCurrentFrame); | - | ||||||||||||||||||
| 283 | d->presetCurrentFrame = 0; | - | ||||||||||||||||||
| 284 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 | QQuickPixmap *pixmap = d->infoForCurrentFrame(qmlEngine(this)); | - | ||||||||||||||||||
| 287 | if (pixmap
| 0-152 | ||||||||||||||||||
| 288 | d->setPixmap(*pixmap); executed 152 times by 1 test: d->setPixmap(*pixmap);Executed by:
| 152 | ||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | if (isPlaying() != d->oldPlaying
| 0-152 | ||||||||||||||||||
| 291 | playingChanged(); never executed: playingChanged(); | 0 | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | if (d->movie
| 0-152 | ||||||||||||||||||
| 294 | d->currentSourceSize = d->movie->currentPixmap().size(); executed 152 times by 1 test: d->currentSourceSize = d->movie->currentPixmap().size();Executed by:
| 152 | ||||||||||||||||||
| 295 | else | - | ||||||||||||||||||
| 296 | d->currentSourceSize = QSize(0, 0); never executed: d->currentSourceSize = QSize(0, 0); | 0 | ||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | if (d->currentSourceSize != d->oldSourceSize
| 6-146 | ||||||||||||||||||
| 299 | d->oldSourceSize = d->currentSourceSize; | - | ||||||||||||||||||
| 300 | sourceSizeChanged(); | - | ||||||||||||||||||
| 301 | } executed 146 times by 1 test: end of blockExecuted by:
| 146 | ||||||||||||||||||
| 302 | } executed 152 times by 1 test: end of blockExecuted by:
| 152 | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | void QQuickAnimatedImage::movieUpdate() | - | ||||||||||||||||||
| 305 | { | - | ||||||||||||||||||
| 306 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 307 | - | |||||||||||||||||||
| 308 | if (!d->cache
| 18-234 | ||||||||||||||||||
| 309 | qDeleteAll(d->frameMap); | - | ||||||||||||||||||
| 310 | d->frameMap.clear(); | - | ||||||||||||||||||
| 311 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | if (d->movie
| 0-252 | ||||||||||||||||||
| 314 | d->setPixmap(*d->infoForCurrentFrame(qmlEngine(this))); | - | ||||||||||||||||||
| 315 | frameChanged(); | - | ||||||||||||||||||
| 316 | } executed 252 times by 1 test: end of blockExecuted by:
| 252 | ||||||||||||||||||
| 317 | } executed 252 times by 1 test: end of blockExecuted by:
| 252 | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | void QQuickAnimatedImage::playingStatusChanged() | - | ||||||||||||||||||
| 320 | { | - | ||||||||||||||||||
| 321 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 322 | - | |||||||||||||||||||
| 323 | if ((
| 8-154 | ||||||||||||||||||
| 324 | d->playing = (d->movie->state() != QMovie::NotRunning); | - | ||||||||||||||||||
| 325 | playingChanged(); | - | ||||||||||||||||||
| 326 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 327 | if ((
| 16-146 | ||||||||||||||||||
| 328 | d->paused = (d->movie->state() == QMovie::Paused); | - | ||||||||||||||||||
| 329 | pausedChanged(); | - | ||||||||||||||||||
| 330 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 331 | } executed 162 times by 1 test: end of blockExecuted by:
| 162 | ||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | void QQuickAnimatedImage::onCacheChanged() | - | ||||||||||||||||||
| 334 | { | - | ||||||||||||||||||
| 335 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 336 | if (!cache()
| 0-2 | ||||||||||||||||||
| 337 | qDeleteAll(d->frameMap); | - | ||||||||||||||||||
| 338 | d->frameMap.clear(); | - | ||||||||||||||||||
| 339 | if (d->movie
| 0-2 | ||||||||||||||||||
| 340 | d->movie->setCacheMode(QMovie::CacheNone); never executed: d->movie->setCacheMode(QMovie::CacheNone); | 0 | ||||||||||||||||||
| 341 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||
| 342 | if (d->movie
| 0 | ||||||||||||||||||
| 343 | d->movie->setCacheMode(QMovie::CacheAll); never executed: d->movie->setCacheMode(QMovie::CacheAll); | 0 | ||||||||||||||||||
| 344 | } never executed: end of block | 0 | ||||||||||||||||||
| 345 | } | - | ||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 | QSize QQuickAnimatedImage::sourceSize() | - | ||||||||||||||||||
| 348 | { | - | ||||||||||||||||||
| 349 | QQuickAnimatedImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 350 | return executed 24 times by 1 test: d->currentSourceSize;return d->currentSourceSize;Executed by:
executed 24 times by 1 test: return d->currentSourceSize;Executed by:
| 24 | ||||||||||||||||||
| 351 | } | - | ||||||||||||||||||
| 352 | - | |||||||||||||||||||
| 353 | void QQuickAnimatedImage::componentComplete() | - | ||||||||||||||||||
| 354 | { | - | ||||||||||||||||||
| 355 | QQuickItem::componentComplete(); | - | ||||||||||||||||||
| 356 | load(); | - | ||||||||||||||||||
| 357 | } executed 90 times by 2 tests: end of blockExecuted by:
| 90 | ||||||||||||||||||
| 358 | - | |||||||||||||||||||
| 359 | void QQuickAnimatedImagePrivate::setMovie(QMovie *m) | - | ||||||||||||||||||
| 360 | { | - | ||||||||||||||||||
| 361 | if (movie == m
| 94-234 | ||||||||||||||||||
| 362 | return; executed 94 times by 2 tests: return;Executed by:
| 94 | ||||||||||||||||||
| 363 | QQuickAnimatedImage * const q = q_func(); | - | ||||||||||||||||||
| 364 | const int oldFrameCount = q->frameCount(); | - | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | if (movie
| 78-156 | ||||||||||||||||||
| 367 | movie->disconnect(); | - | ||||||||||||||||||
| 368 | movie->deleteLater(); | - | ||||||||||||||||||
| 369 | } executed 78 times by 2 tests: end of blockExecuted by:
| 78 | ||||||||||||||||||
| 370 | movie = m; | - | ||||||||||||||||||
| 371 | - | |||||||||||||||||||
| 372 | if (oldFrameCount != q->frameCount()
| 18-216 | ||||||||||||||||||
| 373 | q->frameCountChanged(); executed 216 times by 2 tests: q->frameCountChanged();Executed by:
| 216 | ||||||||||||||||||
| 374 | } executed 234 times by 2 tests: end of blockExecuted by:
| 234 | ||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | - | |||||||||||||||||||
| 377 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |