diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-01-12 09:37:27 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-01-22 07:02:21 +0000 |
commit | bf1eb37ac8e569ab929c0c2ab8655f07594ef4e9 (patch) | |
tree | a1d47d5790dabbefbcbf3d2d0ba3a08bd844e559 /tests | |
parent | 778886e93e7525ad3b485c15a1a2cc84ca80b016 (diff) |
Get rid of the QMediaServiceFeaturesInterface
Replace it by one virtual method in the media player control.
Change-Id: I18778d2f56b9af8a16418c30c75c973e54b6add8
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
5 files changed, 10 insertions, 49 deletions
diff --git a/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp index a05fee67b..c98d2a9e5 100644 --- a/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp +++ b/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp @@ -839,7 +839,7 @@ void tst_QMediaPlayer::debugEnums() void tst_QMediaPlayer::testSupportedMimeTypes() { - QStringList mimeList = QMediaPlayer::supportedMimeTypes(QMediaPlayer::LowLatency); + QStringList mimeList = QMediaPlayer::supportedMimeTypes(); // This is empty on some platforms, and not on others, so can't test something here at the moment. } @@ -850,7 +850,6 @@ void tst_QMediaPlayer::testQrc_data() QTest::addColumn<QMediaPlayer::MediaStatus>("status"); QTest::addColumn<QMediaPlayer::Error>("error"); QTest::addColumn<int>("errorCount"); - QTest::addColumn<bool>("hasStreamFeature"); QTest::addColumn<QString>("backendMediaContentScheme"); QTest::addColumn<bool>("backendHasStream"); @@ -858,7 +857,6 @@ void tst_QMediaPlayer::testQrc_data() << QMediaPlayer::InvalidMedia << QMediaPlayer::ResourceError << 1 // error count - << false // No StreamPlayback support << QString() // backend should not have got any media (empty URL scheme) << false; // backend should not have got any stream @@ -866,7 +864,6 @@ void tst_QMediaPlayer::testQrc_data() << QMediaPlayer::LoadingMedia << QMediaPlayer::NoError << 0 // error count - << false // No StreamPlayback support << QStringLiteral("file") // backend should have a got a temporary file << false; // backend should not have got any stream @@ -874,7 +871,6 @@ void tst_QMediaPlayer::testQrc_data() << QMediaPlayer::LoadingMedia << QMediaPlayer::NoError << 0 // error count - << true // StreamPlayback support << QStringLiteral("qrc") << true; // backend should have got a stream (QFile opened from the resource) } @@ -885,13 +881,9 @@ void tst_QMediaPlayer::testQrc() QFETCH(QMediaPlayer::MediaStatus, status); QFETCH(QMediaPlayer::Error, error); QFETCH(int, errorCount); - QFETCH(bool, hasStreamFeature); QFETCH(QString, backendMediaContentScheme); QFETCH(bool, backendHasStream); - if (hasStreamFeature) - mockProvider->setSupportedFeatures(QMediaServiceFeaturesInterface::StreamPlayback); - QMediaPlayer player; mockService->setState(QMediaPlayer::PlayingState, QMediaPlayer::NoMedia); diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp index a0e9f61ab..89a14f82c 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp @@ -31,12 +31,10 @@ #include "../mockservice.h" class MockServicePlugin2 : public QMediaServiceProviderPlugin, - public QMediaServiceSupportedFormatsInterface, - public QMediaServiceFeaturesInterface + public QMediaServiceSupportedFormatsInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedFormatsInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mockserviceplugin2.json") public: [[nodiscard]] QStringList keys() const @@ -71,14 +69,6 @@ public: { return QStringList("audio/wav"); } - - [[nodiscard]] QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override - { - QMediaServiceFeaturesInterface::Features result; - if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)) - result |= QMediaServiceFeaturesInterface::LowLatencyPlayback; - return result; - } }; #include "mockserviceplugin2.moc" diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp index e56667550..4873b74e2 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp @@ -31,12 +31,10 @@ #include "../mockservice.h" class MockServicePlugin4 : public QMediaServiceProviderPlugin, - public QMediaServiceSupportedFormatsInterface, - public QMediaServiceFeaturesInterface + public QMediaServiceSupportedFormatsInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedFormatsInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mockserviceplugin4.json") public: [[nodiscard]] QStringList keys() const @@ -72,14 +70,6 @@ public: { return QStringList() << "video/mp4" << "video/quicktime"; } - - [[nodiscard]] QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override - { - QMediaServiceFeaturesInterface::Features result; - if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)) - result |= QMediaServiceFeaturesInterface::StreamPlayback; - return result; - } }; #include "mockserviceplugin4.moc" diff --git a/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp b/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp index e94a9d7b1..2323bd990 100644 --- a/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp +++ b/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp @@ -142,30 +142,30 @@ void tst_QMediaServiceProvider::testHasSupport() QCOMPARE(QMediaPlayer::hasSupport("audio/wav"), QMultimedia::ProbablySupported); //test low latency flag support - QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::LowLatency), + QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList()), QMultimedia::ProbablySupported); //plugin1 probably supports audio/ogg, it checked because it doesn't provide features iface - QCOMPARE(QMediaPlayer::hasSupport("audio/ogg", QStringList(), QMediaPlayer::LowLatency), + QCOMPARE(QMediaPlayer::hasSupport("audio/ogg", QStringList()), QMultimedia::ProbablySupported); //Plugin4 is not checked here, sine it's known not support low latency - QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::LowLatency), + QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList()), QMultimedia::MaybeSupported); //test streaming flag support - QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::StreamPlayback), + QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList()), QMultimedia::ProbablySupported); //Plugin2 is not checked here, sine it's known not support streaming - QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::StreamPlayback), + QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList()), QMultimedia::MaybeSupported); //ensure the correct media player plugin is chosen for mime type - QMediaPlayer simplePlayer(nullptr, QMediaPlayer::LowLatency); + QMediaPlayer simplePlayer(nullptr); QCOMPARE(simplePlayer.service()->objectName(), QLatin1String("MockServicePlugin2")); QMediaPlayer mediaPlayer; QVERIFY(mediaPlayer.service()->objectName() != QLatin1String("MockServicePlugin2")); - QMediaPlayer streamPlayer(nullptr, QMediaPlayer::StreamPlayback); + QMediaPlayer streamPlayer(nullptr); QCOMPARE(streamPlayer.service()->objectName(), QLatin1String("MockServicePlugin4")); } diff --git a/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h b/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h index 7be88a9fa..1683a3654 100644 --- a/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h +++ b/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h @@ -55,16 +55,6 @@ public: } } - QMediaServiceFeaturesInterface::Features supportedFeatures(const QMediaService *) const - { - return features; - } - - void setSupportedFeatures(QMediaServiceFeaturesInterface::Features f) - { - features = f; - } - QByteArray defaultDevice(const QByteArray &serviceType) const { if (serviceType == Q_MEDIASERVICE_CAMERA) @@ -91,7 +81,6 @@ public: QMediaService *service; bool deleteServiceOnRelease; - QMediaServiceFeaturesInterface::Features features; }; #endif // MOCKMEDIASERVICEPROVIDER_H |