diff options
Diffstat (limited to 'tests/auto/integration/backends/tst_backends.cpp')
-rw-r--r-- | tests/auto/integration/backends/tst_backends.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/integration/backends/tst_backends.cpp b/tests/auto/integration/backends/tst_backends.cpp new file mode 100644 index 000000000..2cc1df256 --- /dev/null +++ b/tests/auto/integration/backends/tst_backends.cpp @@ -0,0 +1,60 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtTest/QtTest> +#include <QDebug> +#include <QtCore/qsysinfo.h> +#include <private/qplatformmediaintegration_p.h> + +QT_USE_NAMESPACE + +class tst_backends : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase() + { + // Log operating system name and currently supported backends + qDebug() << QSysInfo::prettyProductName() << "supports backends" + << QPlatformMediaIntegration::availableBackends().join(", "); + } + +private slots: + void availableBackends_returns_expectedBackends_data() + { + QTest::addColumn<QStringList>("expectedBackends"); + QStringList backends; + +#if defined(Q_OS_WIN) + backends << "windows"; + if (QSysInfo::currentCpuArchitecture() == "x86_64") + backends << "ffmpeg"; +#elif defined(Q_OS_ANDROID) + backends << "android" << "ffmpeg"; +#elif defined(Q_OS_DARWIN) + backends << "darwin" << "ffmpeg"; +#elif defined(Q_OS_WASM) + backends << "wasm"; +#elif defined(Q_OS_QNX) + backends << "qnx"; +#else + backends << "ffmpeg" << "gstreamer"; +#endif + + QTest::addRow("backends") << backends; + } + + void availableBackends_returns_expectedBackends() + { + QFETCH(QStringList, expectedBackends); + QStringList actualBackends = QPlatformMediaIntegration::availableBackends(); + for (const auto &expectedBackend : expectedBackends) { + QVERIFY(actualBackends.contains(expectedBackend)); + } + } +}; + +QTEST_MAIN(tst_backends) + +#include "tst_backends.moc" |