Commit 4736c9b0 authored by Yoann Lopes's avatar Yoann Lopes Committed by Christian Stromme
Browse files

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: default avatarEirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: default avatarChristian Stromme <christian.stromme@qt.io>
parent 1ecf2934
No related merge requests found
Showing with 26 additions and 0 deletions
...@@ -541,6 +541,32 @@ void tst_QMediaPlayerBackend::processEOS() ...@@ -541,6 +541,32 @@ void tst_QMediaPlayerBackend::processEOS()
QCOMPARE(stateSpy.count(), 0); QCOMPARE(stateSpy.count(), 0);
QTRY_VERIFY(statusSpy.count() > 0 && QTRY_VERIFY(statusSpy.count() > 0 &&
statusSpy.last()[0].value<QMediaPlayer::MediaStatus>() == QMediaPlayer::LoadedMedia); 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() // Helper class for tst_QMediaPlayerBackend::deleteLaterAtEOS()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment