diff --git a/tests/auto/integration/multimedia.pro b/tests/auto/integration/multimedia.pro index de152d942c33f38d8bc7cac99166fa2888449630..88960ec03e2894b5599adfddcb4eba02165ed727 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 8b6712728a1156e0981a6a381c2e8de814d05fb1..316c5a0830d6c3f327c462cd13332b448c6e9a15 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 7464a8aa201bd425892fa3f448e426f698421050..672bcfa6a2f195b07c43514e641299cfcee796cd 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 2af06b46cf7f713a25920d97db00d0f415522d4f..1e582d14bc0d126827baaa1111a855a28dec3c6a 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 4f8656e0a52724e4e9532138bd5da7d00e5c6606..8aa6228812140437b083e56584662a4b23f0fa7f 100644 --- a/tests/auto/integration/qmediaplayerbackend/BLACKLIST +++ b/tests/auto/integration/qmediaplayerbackend/BLACKLIST @@ -9,13 +9,9 @@ opensuse-13.1 64bit [loadMedia] windows 64bit developer-build -# QTBUG-60268 -b2qt [unloadMedia] windows 64bit developer-build -# QTBUG-60268 -b2qt [playPauseStop] linux @@ -23,18 +19,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 @@ -53,7 +43,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 87637fadcd3af898b62c9c0c3c73e459e4772c12..b9417f7c284e58b10dcadc767eb82fa17e0e5e1a 100644 --- a/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro +++ b/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro @@ -9,4 +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 fb72a239cdfcb7dfbc17fe8798243a74d63473b7..8e45a2ccb5c9ef4ad157e3a05bc43dc620e3b97c 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 @@ -78,7 +79,7 @@ private slots: private: QMediaContent selectVideoFile(const QStringList& mediaCandidates); - QMediaContent selectMediaFile(const QStringList& mediaCandidates); + bool isWavSupported(); //one second local wav file QMediaContent localWavFile; @@ -170,31 +171,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() @@ -203,33 +186,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"); - localVideoFile = selectMediaFile(mediaCandidates); +#endif + 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); } @@ -246,7 +220,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); @@ -278,6 +256,9 @@ void tst_QMediaPlayerBackend::loadMedia() void tst_QMediaPlayerBackend::unloadMedia() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; player.setNotifyInterval(50); @@ -326,6 +307,9 @@ void tst_QMediaPlayerBackend::unloadMedia() void tst_QMediaPlayerBackend::playPauseStop() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; player.setNotifyInterval(50); @@ -478,6 +462,9 @@ void tst_QMediaPlayerBackend::playPauseStop() void tst_QMediaPlayerBackend::processEOS() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + QMediaPlayer player; player.setNotifyInterval(50); @@ -610,6 +597,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); @@ -734,6 +724,9 @@ void tst_QMediaPlayerBackend::volumeAcrossFiles() void tst_QMediaPlayerBackend::initialVolume() { + if (!isWavSupported()) + QSKIP("Sound format is not supported"); + { QMediaPlayer player; player.setVolume(1); @@ -1193,6 +1186,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))); diff --git a/tests/auto/integration/shared/mediafileselector.h b/tests/auto/integration/shared/mediafileselector.h new file mode 100644 index 0000000000000000000000000000000000000000..8b88d14a4169e47fae40233b964741d7b55b944d --- /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 + diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp index 4b2136a5c3e617ad73ed1ebd110f2f13abc0017c..c2f18d2a4297eb59a9fda83b72de53a7c30e56f5 100644 --- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp +++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp @@ -557,6 +557,11 @@ void tst_QPainterVideoSurface::shaderType() { QPainterVideoSurface surface; QGLWidget widget; + if (!widget.context() + || !widget.context()->isValid()) { + QSKIP("Platform does not support GLContext"); + } + widget.show(); QTest::qWaitForWindowExposed(&widget); widget.makeCurrent(); @@ -649,6 +654,11 @@ void tst_QPainterVideoSurface::shaderTypeStarted() QFETCH(QPainterVideoSurface::ShaderType, shaderType); QGLWidget widget; + if (!widget.context() + || !widget.context()->isValid()) { + QSKIP("Platform does not support GLContext"); + } + widget.show(); QTest::qWaitForWindowExposed(&widget); widget.makeCurrent(); @@ -894,6 +904,11 @@ void tst_QPainterVideoSurface::shaderSupportedFormat() QFETCH(bool, supportedFormat); QGLWidget widget; + if (!widget.context() + || !widget.context()->isValid()) { + QSKIP("Platform does not support GLContext"); + } + widget.show(); QTest::qWaitForWindowExposed(&widget); widget.makeCurrent(); @@ -1011,6 +1026,11 @@ void tst_QPainterVideoSurface::shaderPresent() QFETCH(int, bytesPerLineB); QGLWidget widget; + if (!widget.context() + || !widget.context()->isValid()) { + QSKIP("Platform does not support GLContext"); + } + widget.show(); QTest::qWaitForWindowExposed(&widget); widget.makeCurrent(); @@ -1142,6 +1162,11 @@ void tst_QPainterVideoSurface::shaderPresentOpaqueFrame() QFETCH(QPainterVideoSurface::ShaderType, shaderType); QGLWidget widget; + if (!widget.context() + || !widget.context()->isValid()) { + QSKIP("Platform does not support GLContext"); + } + widget.show(); QTest::qWaitForWindowExposed(&widget); widget.makeCurrent(); @@ -1191,6 +1216,11 @@ void tst_QPainterVideoSurface::shaderPresentGLFrame() QFETCH(QPainterVideoSurface::ShaderType, shaderType); QGLWidget widget; + if (!widget.context() + || !widget.context()->isValid()) { + QSKIP("Platform does not support GLContext"); + } + widget.show(); QTest::qWaitForWindowExposed(&widget); widget.makeCurrent();