4#ifndef MEDIABACKENDUTILS_H
5#define MEDIABACKENDUTILS_H
18#include <QtTest/qtestcase.h>
19#include <private/qplatformmediaintegration_p.h>
20#include <QtGui/private/qguiapplication_p.h>
21#include <QtGui/qpa/qplatformintegration.h>
29 return QPlatformMediaIntegration::instance()->name() ==
"gstreamer"_L1;
34 return QPlatformMediaIntegration::instance()->name() ==
"qnx"_L1;
39 return QPlatformMediaIntegration::instance()->name() ==
"darwin"_L1;
44 return QPlatformMediaIntegration::instance()->name() ==
"android"_L1;
49 return QPlatformMediaIntegration::instance()->name() ==
"ohos"_L1;
54 return QPlatformMediaIntegration::instance()->name() ==
"ffmpeg"_L1;
59 return QPlatformMediaIntegration::instance()->name() ==
"windows"_L1;
64 return QPlatformMediaIntegration::instance()->name() !=
"fallback"_L1;
69 QString backend = qEnvironmentVariable(
"QT_MEDIA_BACKEND");
70 if (backend.isEmpty())
71 backend = QPlatformMediaIntegration::defaultBackend();
72 QPlatformMediaIntegration::setBackend(backend);
82 "No media backend plugin was loaded; the fallback integration was used. "
83 "Integration tests require a real backend plugin.");
85 return !QTest::currentTestFailed();
90 return QGuiApplicationPrivate::platformIntegration()->hasCapability(
91 QPlatformIntegration::RhiBasedRendering);
96 return QGuiApplicationPrivate::platformIntegration()->hasCapability(
97 QPlatformIntegration::OpenGL);
102 return qEnvironmentVariable(
"QTEST_ENVIRONMENT").toLower().split(u' ').contains(u"ci"_s);
109#define QSKIP_IF(checker, defaultMessage, ...)
112 QSKIP(strlen(__VA_ARGS__ "") ? __VA_ARGS__ "" : defaultMessage);
115#define QSKIP_GSTREAMER(...)
116 QSKIP_IF(isGStreamerPlatform(), "The feature is not supported on GStreamer", __VA_ARGS__)
118#define QSKIP_IF_NOT_FFMPEG(...)
119 QSKIP_IF(!isFFMPEGPlatform(), "The feature is only supported on FFmpeg", __VA_ARGS__)
121#define QSKIP_FFMPEG(...)
122 QSKIP_IF(isFFMPEGPlatform(), "The feature is not supported on FFmpeg", __VA_ARGS__)
124#define QSKIP_DARWIN(...)
125 QSKIP_IF(isDarwinPlatform(), "The feature is not supported on Darwin", __VA_ARGS__)
127#define QSKIP_OHOS(...)
128 QSKIP_IF(isOhosPlatform(), "The feature is not supported on HarmonyOS", __VA_ARGS__)
130#define QEXPECT_FAIL_GSTREAMER(dataIndex, comment, mode)
132 if (isGStreamerPlatform())
133 QEXPECT_FAIL(dataIndex, comment, mode);
bool isMediaBackendPluginLoaded()
bool isGStreamerPlatform()
bool initIntegrationTestCase()
bool isRhiRenderingSupported()
void initIntegrationTestMain()