diff options
Diffstat (limited to 'tests/auto/integration')
8 files changed, 168 insertions, 70 deletions
diff --git a/tests/auto/integration/multimedia.pro b/tests/auto/integration/multimedia.pro index de152d942..88960ec03 100644 --- a/tests/auto/integration/multimedia.pro +++ b/tests/auto/integration/multimedia.pro @@ -17,6 +17,3 @@ qtHaveModule(quick) { } !qtHaveModule(widgets): SUBDIRS -= qcamerabackend - -# QTBUG-60268 -boot2qt: SUBDIRS -= qdeclarativevideooutput_window diff --git a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST b/tests/auto/integration/qaudiodecoderbackend/BLACKLIST index 8b6712728..316c5a083 100644 --- a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST +++ b/tests/auto/integration/qaudiodecoderbackend/BLACKLIST @@ -1,10 +1,2 @@ # QTBUG-56796 windows - -[fileTest] -# QTBUG-60268 -b2qt - -[deviceTest] -# QTBUG-60268 -b2qt diff --git a/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro b/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro index 7464a8aa2..672bcfa6a 100644 --- a/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro +++ b/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro @@ -9,5 +9,13 @@ TESTDATA += testdata/* INCLUDEPATH += \ ../../../../src/multimedia/audio +HEADERS += \ + ../shared/mediafileselector.h + SOURCES += \ tst_qaudiodecoderbackend.cpp + +boot2qt: { + # Yocto sysroot does not have gstreamer/wav + QMAKE_CXXFLAGS += -DWAV_SUPPORT_NOT_FORCED +} diff --git a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp index 2af06b46c..1e582d14b 100644 --- a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp +++ b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp @@ -30,6 +30,8 @@ #include <QDebug> #include "qaudiodecoder.h" +#include "../shared/mediafileselector.h" + #define TEST_FILE_NAME "testdata/test.wav" #define TEST_UNSUPPORTED_FILE_NAME "testdata/test-unsupported.avi" #define TEST_CORRUPTED_FILE_NAME "testdata/test-corrupted.wav" @@ -56,6 +58,9 @@ private slots: void unsupportedFileTest(); void corruptedFileTest(); void deviceTest(); + +private: + bool isWavSupported(); }; void tst_QAudioDecoderBackend::init() @@ -67,14 +72,28 @@ void tst_QAudioDecoderBackend::initTestCase() QAudioDecoder d; if (!d.isAvailable()) QSKIP("Audio decoder service is not available"); + + qRegisterMetaType<QMediaContent>(); } void tst_QAudioDecoderBackend::cleanup() { } +bool tst_QAudioDecoderBackend::isWavSupported() +{ +#ifdef WAV_SUPPORT_NOT_FORCED + return !MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA(TEST_FILE_NAME)).isNull(); +#else + return true; +#endif +} + void tst_QAudioDecoderBackend::fileTest() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QAudioDecoder d; if (d.error() == QAudioDecoder::ServiceMissingError) QSKIP("There is no audio decoding support on this platform."); @@ -411,6 +430,9 @@ void tst_QAudioDecoderBackend::corruptedFileTest() void tst_QAudioDecoderBackend::deviceTest() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QAudioDecoder d; if (d.error() == QAudioDecoder::ServiceMissingError) QSKIP("There is no audio decoding support on this platform."); diff --git a/tests/auto/integration/qmediaplayerbackend/BLACKLIST b/tests/auto/integration/qmediaplayerbackend/BLACKLIST index 68660a39b..0a88eef9e 100644 --- a/tests/auto/integration/qmediaplayerbackend/BLACKLIST +++ b/tests/auto/integration/qmediaplayerbackend/BLACKLIST @@ -8,13 +8,9 @@ opensuse-13.1 64bit [loadMedia] windows 64bit developer-build -# QTBUG-60268 -b2qt [unloadMedia] windows 64bit developer-build -# QTBUG-60268 -b2qt [playPauseStop] linux @@ -22,18 +18,12 @@ windows 64bit developer-build [processEOS] windows 64bit developer-build -# QTBUG-60268 -b2qt [deleteLaterAtEOS] windows 64bit developer-build -# QTBUG-60268 -b2qt [initialVolume] windows 64bit developer-build -# QTBUG-60268 -b2qt [playlist] redhatenterpriselinuxworkstation-6.6 @@ -52,7 +42,3 @@ redhatenterpriselinuxworkstation-6.6 [surfaceTest] redhatenterpriselinuxworkstation-6.6 - -[playlistObject] -# QTBUG-60268 -b2qt diff --git a/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro b/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro index 919fae91d..b9417f7c2 100644 --- a/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro +++ b/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro @@ -9,9 +9,14 @@ CONFIG += testcase SOURCES += \ tst_qmediaplayerbackend.cpp +HEADERS += \ + ../shared/mediafileselector.h + TESTDATA += testdata/* boot2qt: { + # Yocto sysroot does not have gstreamer/wav + QMAKE_CXXFLAGS += -DWAV_SUPPORT_NOT_FORCED # OGV testing is unstable with qemu QMAKE_CXXFLAGS += -DSKIP_OGV_TEST } diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp index 9fe0a39ec..b68bc030a 100644 --- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp +++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp @@ -36,6 +36,7 @@ #include <qmediaplaylist.h> #include <qmediametadata.h> +#include "../shared/mediafileselector.h" //TESTED_COMPONENT=src/multimedia QT_USE_NAMESPACE @@ -76,10 +77,11 @@ private slots: void surfaceTest_data(); void surfaceTest(); void metadata(); + void playerStateAtEOS(); private: QMediaContent selectVideoFile(const QStringList& mediaCandidates); - QMediaContent selectMediaFile(const QStringList& mediaCandidates); + bool isWavSupported(); //one second local wav file QMediaContent localWavFile; @@ -171,31 +173,13 @@ QMediaContent tst_QMediaPlayerBackend::selectVideoFile(const QStringList& mediaC return QMediaContent(); } -QMediaContent tst_QMediaPlayerBackend::selectMediaFile(const QStringList& mediaCandidates) +bool tst_QMediaPlayerBackend::isWavSupported() { - QMediaPlayer player; - - QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error))); - - foreach (QString s, mediaCandidates) { - QFileInfo mediaFile(s); - if (!mediaFile.exists()) - continue; - QMediaContent media = QMediaContent(QUrl::fromLocalFile(mediaFile.absoluteFilePath())); - player.setMedia(media); - player.play(); - - for (int i = 0; i < 2000 && player.mediaStatus() != QMediaPlayer::BufferedMedia && errorSpy.isEmpty(); i+=50) { - QTest::qWait(50); - } - - if (player.mediaStatus() == QMediaPlayer::BufferedMedia && errorSpy.isEmpty()) { - return media; - } - errorSpy.clear(); - } - - return QMediaContent(); +#ifdef WAV_SUPPORT_NOT_FORCED + return !localWavFile.isNull(); +#else + return true; +#endif } void tst_QMediaPlayerBackend::initTestCase() @@ -204,35 +188,24 @@ void tst_QMediaPlayerBackend::initTestCase() if (!player.isAvailable()) QSKIP("Media player service is not available"); - const QString testFileName = QFINDTESTDATA("testdata/test.wav"); - QFileInfo wavFile(testFileName); - - QVERIFY(wavFile.exists()); - - localWavFile = QMediaContent(QUrl::fromLocalFile(wavFile.absoluteFilePath())); - - const QString testFileName2 = QFINDTESTDATA("testdata/_test.wav"); - QFileInfo wavFile2(testFileName2); - - QVERIFY(wavFile2.exists()); - - localWavFile2 = QMediaContent(QUrl::fromLocalFile(wavFile2.absoluteFilePath())); - qRegisterMetaType<QMediaContent>(); + localWavFile = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/test.wav")); + localWavFile2 = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/_test.wav"));; + QStringList mediaCandidates; mediaCandidates << QFINDTESTDATA("testdata/colors.mp4"); #ifndef SKIP_OGV_TEST mediaCandidates << QFINDTESTDATA("testdata/colors.ogv"); #endif - localVideoFile = selectMediaFile(mediaCandidates); + localVideoFile = MediaFileSelector::selectMediaFile(mediaCandidates); mediaCandidates.clear(); mediaCandidates << QFINDTESTDATA("testdata/nokia-tune.mp3"); mediaCandidates << QFINDTESTDATA("testdata/nokia-tune.mkv"); - localCompressedSoundFile = selectMediaFile(mediaCandidates); + localCompressedSoundFile = MediaFileSelector::selectMediaFile(mediaCandidates); - localFileWithMetadata = selectMediaFile(QStringList() << QFINDTESTDATA("testdata/nokia-tune.mp3")); + localFileWithMetadata = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/nokia-tune.mp3")); qgetenv("QT_TEST_CI").toInt(&m_inCISystem,10); } @@ -249,7 +222,11 @@ void tst_QMediaPlayerBackend::construction() void tst_QMediaPlayerBackend::loadMedia() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; + QCOMPARE(player.state(), QMediaPlayer::StoppedState); QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia); @@ -281,6 +258,9 @@ void tst_QMediaPlayerBackend::loadMedia() void tst_QMediaPlayerBackend::unloadMedia() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; player.setNotifyInterval(50); @@ -339,6 +319,9 @@ void tst_QMediaPlayerBackend::loadMediaInLoadingState() void tst_QMediaPlayerBackend::playPauseStop() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; player.setNotifyInterval(50); @@ -491,6 +474,9 @@ void tst_QMediaPlayerBackend::playPauseStop() void tst_QMediaPlayerBackend::processEOS() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; player.setNotifyInterval(50); @@ -623,6 +609,9 @@ private: // QTBUG-24927 - deleteLater() called to QMediaPlayer from its signal handler does not work as expected void tst_QMediaPlayerBackend::deleteLaterAtEOS() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QPointer<QMediaPlayer> player(new QMediaPlayer); DeleteLaterAtEos deleter(player); player->setMedia(localWavFile); @@ -747,6 +736,9 @@ void tst_QMediaPlayerBackend::volumeAcrossFiles() void tst_QMediaPlayerBackend::initialVolume() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + { QMediaPlayer player; player.setVolume(1); @@ -1206,6 +1198,9 @@ void tst_QMediaPlayerBackend::playlist() void tst_QMediaPlayerBackend::playlistObject() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent))); @@ -1263,7 +1258,7 @@ void tst_QMediaPlayerBackend::playlistObject() QCOMPARE(errorSpy.count(), 0); QCOMPARE(mediaStatusSpy.count(), 7); // 2 x (LoadingMedia -> BufferedMedia -> EndOfMedia) + NoMedia - player.setPlaylist(Q_NULLPTR); + player.setPlaylist(nullptr); mediaSpy.clear(); currentMediaSpy.clear(); @@ -1288,7 +1283,7 @@ void tst_QMediaPlayerBackend::playlistObject() QCOMPARE(errorSpy.count(), 0); QCOMPARE(mediaStatusSpy.count(), 13); // 4 x (LoadingMedia -> BufferedMedia -> EndOfMedia) + NoMedia - player.setPlaylist(Q_NULLPTR); + player.setPlaylist(nullptr); mediaSpy.clear(); currentMediaSpy.clear(); @@ -1312,7 +1307,7 @@ void tst_QMediaPlayerBackend::playlistObject() QCOMPARE(errorSpy.count(), 1); QCOMPARE(mediaStatusSpy.count(), 6); // Loading -> Invalid -> Loading -> Buffered -> EndOfMedia -> NoMedia - player.setPlaylist(Q_NULLPTR); + player.setPlaylist(nullptr); mediaSpy.clear(); currentMediaSpy.clear(); @@ -1418,6 +1413,28 @@ void tst_QMediaPlayerBackend::metadata() QVERIFY(player.availableMetaData().isEmpty()); } +void tst_QMediaPlayerBackend::playerStateAtEOS() +{ + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + + QMediaPlayer player; + + bool endOfMediaReceived = false; + connect(&player, &QMediaPlayer::mediaStatusChanged, [&](QMediaPlayer::MediaStatus status) { + if (status == QMediaPlayer::EndOfMedia) { + QCOMPARE(player.state(), QMediaPlayer::StoppedState); + endOfMediaReceived = true; + } + }); + + player.setMedia(localWavFile); + player.play(); + + QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::EndOfMedia); + QVERIFY(endOfMediaReceived); +} + TestVideoSurface::TestVideoSurface(bool storeFrames): m_totalFrames(0), m_storeFrames(storeFrames) diff --git a/tests/auto/integration/shared/mediafileselector.h b/tests/auto/integration/shared/mediafileselector.h new file mode 100644 index 000000000..8b88d14a4 --- /dev/null +++ b/tests/auto/integration/shared/mediafileselector.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MEDIAFILESELECTOR_H +#define MEDIAFILESELECTOR_H + +#include <QMediaContent> +#include <QMediaPlayer> + +QT_BEGIN_NAMESPACE + +namespace MediaFileSelector { + +static QMediaContent selectMediaFile(const QStringList& mediaCandidates) +{ + QMediaPlayer player; + + QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error))); + + foreach (QString s, mediaCandidates) { + QFileInfo mediaFile(s); + if (!mediaFile.exists()) + continue; + QMediaContent media = QMediaContent(QUrl::fromLocalFile(mediaFile.absoluteFilePath())); + player.setMedia(media); + player.play(); + + for (int i = 0; i < 2000 && player.mediaStatus() != QMediaPlayer::BufferedMedia && errorSpy.isEmpty(); i+=50) { + QTest::qWait(50); + } + + if (player.mediaStatus() == QMediaPlayer::BufferedMedia && errorSpy.isEmpty()) { + return media; + } + errorSpy.clear(); + } + + return QMediaContent(); +} + +} // MediaFileSelector namespace + +QT_END_NAMESPACE + +#endif + |