diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-04-28 10:58:53 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-05-03 07:06:14 +0000 |
commit | 254b6d379f692e46e8204ae886f8dcf64816657c (patch) | |
tree | 48a919f6f685d13323b6aa733efdbe8580ed3d06 /tests | |
parent | 23b5eeb2887b351c673a53bdadf136bcf6b8fd0a (diff) |
Some cleanups in the mediaplayerbackend autotest
Adjusted the signal spys and a few other parts to the API
changes in QMediaPlayer.
Still getting lots of errors and even crashes on gstreamer.
Change-Id: Ic1bca00f3e1fedc6ec77a7d28f83ba00d7d42dcd
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.cpp | 65 | ||||
-rw-r--r-- | tests/auto/integration/shared/mediafileselector.h | 4 |
2 files changed, 10 insertions, 59 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp index ba3342869..9b4ed66d7 100644 --- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp +++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp @@ -72,7 +72,6 @@ private slots: void seekPauseSeek(); void seekInStoppedState(); void subsequentPlayback(); - void surfaceTest_data(); void surfaceTest(); void multipleSurfaces(); void metadata(); @@ -172,9 +171,7 @@ void tst_QMediaPlayerBackend::initTestCase() QStringList mediaCandidates; mediaCandidates << QFINDTESTDATA("testdata/colors.mp4"); -#ifndef SKIP_OGV_TEST mediaCandidates << QFINDTESTDATA("testdata/colors.ogv"); -#endif localVideoFile = MediaFileSelector::selectMediaFile(mediaCandidates); mediaCandidates.clear(); @@ -207,10 +204,9 @@ void tst_QMediaPlayerBackend::loadMedia() QCOMPARE(player.playbackState(), QMediaPlayer::StoppedState); QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia); - QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State))); + QSignalSpy stateSpy(&player, SIGNAL(playbackStateChanged(QMediaPlayer::PlaybackState))); QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QUrl))); - QSignalSpy currentMediaSpy(&player, SIGNAL(currentMediaChanged(QUrl))); + QSignalSpy mediaSpy(&player, SIGNAL(sourceChanged(QUrl))); player.setSource(localWavFile); @@ -224,7 +220,6 @@ void tst_QMediaPlayerBackend::loadMedia() QVERIFY(statusSpy.count() > 0); QCOMPARE(mediaSpy.count(), 1); QCOMPARE(mediaSpy.last()[0].value<QUrl>(), localWavFile); - QCOMPARE(currentMediaSpy.last()[0].value<QUrl>(), localWavFile); QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::LoadedMedia); @@ -239,12 +234,11 @@ void tst_QMediaPlayerBackend::unloadMedia() QMediaPlayer player; - QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State))); + QSignalSpy stateSpy(&player, SIGNAL(playbackStateChanged(QMediaPlayer::PlaybackState))); QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QUrl))); - QSignalSpy currentMediaSpy(&player, SIGNAL(currentMediaChanged(QUrl))); + QSignalSpy mediaSpy(&player, SIGNAL(sourceChanged(QUrl))); QSignalSpy positionSpy(&player, SIGNAL(positionChanged(qint64))); - QSignalSpy durationSpy(&player, SIGNAL(positionChanged(qint64))); + QSignalSpy durationSpy(&player, SIGNAL(durationChanged(qint64))); player.setSource(localWavFile); @@ -261,7 +255,6 @@ void tst_QMediaPlayerBackend::unloadMedia() stateSpy.clear(); statusSpy.clear(); mediaSpy.clear(); - currentMediaSpy.clear(); positionSpy.clear(); durationSpy.clear(); @@ -276,7 +269,6 @@ void tst_QMediaPlayerBackend::unloadMedia() QVERIFY(!stateSpy.isEmpty()); QVERIFY(!statusSpy.isEmpty()); QVERIFY(!mediaSpy.isEmpty()); - QVERIFY(!currentMediaSpy.isEmpty()); QVERIFY(!positionSpy.isEmpty()); } @@ -302,10 +294,10 @@ void tst_QMediaPlayerBackend::playPauseStop() QMediaPlayer player; - QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State))); + QSignalSpy stateSpy(&player, SIGNAL(playbackStateChanged(QMediaPlayer::PlaybackState))); QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); QSignalSpy positionSpy(&player, SIGNAL(positionChanged(qint64))); - QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error))); + QSignalSpy errorSpy(&player, SIGNAL(errorOccurred(QMediaPlayer::Error, const QString&))); // Check play() without a media player.play(); @@ -456,7 +448,7 @@ void tst_QMediaPlayerBackend::processEOS() QMediaPlayer player; - QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State))); + QSignalSpy stateSpy(&player, SIGNAL(playbackStateChanged(QMediaPlayer::PlaybackState))); QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); QSignalSpy positionSpy(&player, SIGNAL(positionChanged(qint64))); @@ -667,11 +659,6 @@ void tst_QMediaPlayerBackend::volumeAcrossFiles_data() void tst_QMediaPlayerBackend::volumeAcrossFiles() { -#ifdef Q_OS_LINUX - if (m_inCISystem) - QSKIP("QTBUG-26577 Fails with gstreamer backend on ubuntu 10.4"); -#endif - QFETCH(int, volume); QFETCH(bool, muted); @@ -929,11 +916,6 @@ void tst_QMediaPlayerBackend::seekInStoppedState() void tst_QMediaPlayerBackend::subsequentPlayback() { -#ifdef Q_OS_LINUX - if (m_inCISystem) - QSKIP("QTBUG-26769 Fails with gstreamer backend on ubuntu 10.4, setPosition(0)"); -#endif - if (localCompressedSoundFile.isEmpty()) QSKIP("Sound format is not supported"); @@ -967,43 +949,12 @@ void tst_QMediaPlayerBackend::subsequentPlayback() QVERIFY(player.position() > 2000 && player.position() < 5000); } -void tst_QMediaPlayerBackend::surfaceTest_data() -{ - QTest::addColumn< QList<QVideoFrameFormat::PixelFormat> >("formatsList"); - - QList<QVideoFrameFormat::PixelFormat> formatsRGB; - formatsRGB << QVideoFrameFormat::Format_RGB32 - << QVideoFrameFormat::Format_ARGB32 - << QVideoFrameFormat::Format_BGR32 - << QVideoFrameFormat::Format_BGRA32; - - QList<QVideoFrameFormat::PixelFormat> formatsYUV; - formatsYUV << QVideoFrameFormat::Format_YUV420P - << QVideoFrameFormat::Format_YUV422P - << QVideoFrameFormat::Format_YV12 - << QVideoFrameFormat::Format_UYVY - << QVideoFrameFormat::Format_YUYV - << QVideoFrameFormat::Format_NV12 - << QVideoFrameFormat::Format_NV21; - - QTest::newRow("RGB formats") - << formatsRGB; - - QTest::newRow("YVU formats") - << formatsYUV; - - QTest::newRow("RGB & YUV formats") - << formatsRGB + formatsYUV; -} - void tst_QMediaPlayerBackend::surfaceTest() { // 25 fps video file if (localVideoFile.isEmpty()) QSKIP("No supported video file"); - QFETCH(QList<QVideoFrameFormat::PixelFormat>, formatsList); - TestVideoSink surface(false); QMediaPlayer player; player.setVideoOutput(&surface); diff --git a/tests/auto/integration/shared/mediafileselector.h b/tests/auto/integration/shared/mediafileselector.h index a0b8bc681..b12cb6525 100644 --- a/tests/auto/integration/shared/mediafileselector.h +++ b/tests/auto/integration/shared/mediafileselector.h @@ -43,13 +43,13 @@ static QUrl selectMediaFile(const QStringList& mediaCandidates) { QMediaPlayer player; - QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error))); + QSignalSpy errorSpy(&player, SIGNAL(errorOccurred(QMediaPlayer::Error, const QString&))); for (const QString &s : mediaCandidates) { QFileInfo mediaFile(s); if (!mediaFile.exists()) continue; - QUrl media = QUrl(QUrl::fromLocalFile(mediaFile.absoluteFilePath())); + QUrl media = QUrl::fromLocalFile(mediaFile.absoluteFilePath()); player.setSource(media); player.play(); |