From ba26496647bca4b37fc2319b553b95966823b941 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 8 Oct 2019 13:16:00 +0200 Subject: 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 --- tests/auto/gui/image/qmovie/tst_qmovie.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/gui') 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" -- cgit v1.2.3