summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@qt.io>2016-08-03 15:41:30 +0200
committerYoann Lopes <yoann.lopes@qt.io>2016-08-12 10:33:16 +0000
commit87abe0bad1945decd71345633be0509b29ab9396 (patch)
tree0f51a21c4acfd8fca83db1b8ce50053ca6a36417
parent7966aca38451ed9ef32ac0fb1b344cdbf22521bb (diff)
Improve tst_QMediaPlayerBackend::playPauseStop()
Check the state of the media player when trying to play or pause without a loaded media. Change-Id: I6685f196457630eb9f4e834426c8e1b9a9eaf8dc Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index c032734c..81fa3dd2 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -332,6 +332,33 @@ void tst_QMediaPlayerBackend::playPauseStop()
QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State)));
QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
QSignalSpy positionSpy(&player, SIGNAL(positionChanged(qint64)));
+ QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error)));
+
+ // Check play() without a media
+ player.play();
+
+ QCOMPARE(player.state(), QMediaPlayer::StoppedState);
+ QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia);
+ QCOMPARE(player.error(), QMediaPlayer::NoError);
+ QCOMPARE(player.position(), 0);
+ QCOMPARE(stateSpy.count(), 0);
+ QCOMPARE(statusSpy.count(), 0);
+ QCOMPARE(positionSpy.count(), 0);
+ QCOMPARE(errorSpy.count(), 0);
+
+ // Check pause() without a media
+ player.pause();
+
+ QCOMPARE(player.state(), QMediaPlayer::StoppedState);
+ QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia);
+ QCOMPARE(player.error(), QMediaPlayer::NoError);
+ QCOMPARE(player.position(), 0);
+ QCOMPARE(stateSpy.count(), 0);
+ QCOMPARE(statusSpy.count(), 0);
+ QCOMPARE(positionSpy.count(), 0);
+ QCOMPARE(errorSpy.count(), 0);
+
+ // The rest is with a valid media
player.setMedia(localWavFile);