summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-10-08 13:16:00 +0200
committerLars Knoll <lars.knoll@qt.io>2019-10-09 15:58:26 +0200
commitba26496647bca4b37fc2319b553b95966823b941 (patch)
tree8db936484d2042693a40e9b1074946cbcf3a2b3d /tests
parent8c092570fcd1330dd916f31d46e8472b7817ec80 (diff)
Don't crash when calling jumpToFrame() on an empty QMovie
Properly return an invalid frame when calling jumpToFrame() with a non existent frame number. Fixes: QTBUG-79029 Change-Id: Ic40f4a6de3106fab42c0bb6c961194be47b04e31 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qmovie/tst_qmovie.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
index 4e9e9b8115..c8217b2cec 100644
--- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp
+++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
@@ -62,6 +62,7 @@ private slots:
#ifndef QT_NO_WIDGETS
void infiniteLoop();
#endif
+ void emptyMovie();
};
// Testing get/set functions
@@ -220,5 +221,13 @@ void tst_QMovie::infiniteLoop()
}
#endif
+void tst_QMovie::emptyMovie()
+{
+ QMovie movie;
+ movie.setCacheMode(QMovie::CacheAll);
+ movie.jumpToFrame(100);
+ QCOMPARE(movie.currentFrameNumber(), -1);
+}
+
QTEST_MAIN(tst_QMovie)
#include "tst_qmovie.moc"