summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@qt.io>2016-08-05 14:52:39 +0200
committerChristian Stromme <christian.stromme@qt.io>2017-04-20 19:38:26 +0000
commit4736c9b04c9692a20fac520214d8076b4574ef71 (patch)
tree65e9833be31fc106c7370462e1844f658d261997
parent1ecf293429e38e469e2f0f933a29ce5555d9bdc8 (diff)
Improve tst_QMediaPlayerBackend::processEOS()
When at the end of the media, check that pause() resets the position to the beginning and that the status changes to BufferedMedia. Change-Id: I3c7aeb98284de8cbeb12195fbf0a308e593af67b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index 8d1ce0d5..9aad6dd8 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -541,6 +541,32 @@ void tst_QMediaPlayerBackend::processEOS()
QCOMPARE(stateSpy.count(), 0);
QTRY_VERIFY(statusSpy.count() > 0 &&
statusSpy.last()[0].value<QMediaPlayer::MediaStatus>() == QMediaPlayer::LoadedMedia);
+
+ player.play();
+ player.setPosition(900);
+ //wait up to 5 seconds for EOS
+ QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::EndOfMedia);
+ QCOMPARE(player.state(), QMediaPlayer::StoppedState);
+ QCOMPARE(player.position(), player.duration());
+
+ stateSpy.clear();
+ statusSpy.clear();
+ positionSpy.clear();
+
+ // pause() should reset position to beginning and status to Buffered
+ player.pause();
+
+ QTRY_COMPARE(player.position(), 0);
+ QTRY_VERIFY(positionSpy.count() > 0);
+ QCOMPARE(positionSpy.first()[0].value<qint64>(), 0);
+
+ QCOMPARE(player.state(), QMediaPlayer::PausedState);
+ QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::BufferedMedia);
+
+ QCOMPARE(stateSpy.count(), 1);
+ QCOMPARE(stateSpy.last()[0].value<QMediaPlayer::State>(), QMediaPlayer::PausedState);
+ QVERIFY(statusSpy.count() > 0);
+ QCOMPARE(statusSpy.last()[0].value<QMediaPlayer::MediaStatus>(), QMediaPlayer::BufferedMedia);
}
// Helper class for tst_QMediaPlayerBackend::deleteLaterAtEOS()