summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-04-28 16:38:49 +0200
committerLars Knoll <lars.knoll@qt.io>2021-05-03 07:06:39 +0000
commit447f68cb419d74b7acfc58ed3e738e40cc17f54a (patch)
tree2ede536eb81dfcafab5274f760a208eaab04ceb0 /tests
parentd7c5b9e34ac09a26c94c7610ae7f1b699c2e1e49 (diff)
Pass more media player autotests on gstreamer
Fix a couple of more autotests and do better state and status handling. Move keeping track of state changes into the platform independent code. Change-Id: If401af6cfa2707ce7c7184cf9baff76a60dd41ff Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index 9b4ed66d7..01269aaa7 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -278,13 +278,18 @@ void tst_QMediaPlayerBackend::loadMediaInLoadingState()
QSKIP("Sound format is not supported");
QMediaPlayer player;
- player.setSource(localWavFile);
- player.play();
+ player.setSource(localWavFile2);
QCOMPARE(player.mediaStatus(), QMediaPlayer::LoadingMedia);
+ QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::LoadedMedia);
// Sets new media while old has not been finished.
player.setSource(localWavFile);
QCOMPARE(player.mediaStatus(), QMediaPlayer::LoadingMedia);
QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::LoadedMedia);
+ player.play();
+ QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::BufferedMedia);
+
+ player.setSource(localWavFile2);
+ QCOMPARE(player.mediaStatus(), QMediaPlayer::LoadingMedia);
}
void tst_QMediaPlayerBackend::playPauseStop()
@@ -358,7 +363,7 @@ void tst_QMediaPlayerBackend::playPauseStop()
QCOMPARE(stateSpy.count(), 1);
QCOMPARE(stateSpy.last()[0].value<QMediaPlayer::PlaybackState>(), QMediaPlayer::PausedState);
- QTest::qWait(2000);
+ QTest::qWait(500);
QVERIFY(qAbs(player.position() - positionBeforePause) < 150);
QCOMPARE(positionSpy.count(), 1);