summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2024-04-10 09:02:09 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2024-04-24 15:13:12 +0000
commit5f0ed0ac0ddffd3779fae0db956df8d48d629f92 (patch)
tree7a5b0b68a19accfcbab515d4eae10cce02691902 /tests/auto/gui
parent175839695d8312960922ff2c06af223e04f3651d (diff)
QMovie: fix regression in frame delays
The recent addition of support for multi-frame (non-animation) formats had an unwanted side effect of sometimes calling QImageReader::nextImageDelay() when the reader is at a different frame than intended. Fix by effectively reverting to the previous call pattern. Fixes: QTBUG-124227 Pick-to: 6.7 6.5 Change-Id: I735f8d67afb17bd4c77f9b4507a71796b7d66958 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/image/qmovie/tst_qmovie.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
index c2171d4209..29c3297043 100644
--- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp
+++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
@@ -36,6 +36,7 @@ private slots:
void playMovie();
void jumpToFrame_data();
void jumpToFrame();
+ void frameDelay();
void changeMovieFile();
#ifndef QT_NO_WIDGETS
void infiniteLoop();
@@ -184,6 +185,17 @@ void tst_QMovie::jumpToFrame()
QCOMPARE(movie.currentFrameNumber(), 0);
}
+void tst_QMovie::frameDelay()
+{
+ QMovie movie(QFINDTESTDATA("animations/comicsecard.gif"));
+ QList<int> frameDelays{ 200, 800, 800, 2000, 2600 };
+ for (int i = 0; i < movie.frameCount(); i++) {
+ movie.jumpToFrame(i);
+ // Processing may have taken a little time, so round to nearest 100ms
+ QCOMPARE(100 * qRound(movie.nextFrameDelay() / 100.0f), frameDelays[i]);
+ }
+}
+
void tst_QMovie::changeMovieFile()
{
QMovie movie(QFINDTESTDATA("animations/comicsecard.gif"));