summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2024-04-17 10:31:35 +0800
committerTim Blechmann <tim@klingt.org>2024-04-18 19:10:57 +0800
commit4e5581dc0c6c0e606db01fa16779220846d5244b (patch)
tree63ad32450d1c4e691f728661831c7b49dfc1f2b0
parent8e4829e2e95df83f9d5518ff634e9e6d055000a0 (diff)
Tests: improve mediabackendutils.h
some quality of life improvements Pick-to: 6.5 6.7 Change-Id: I8cee3f6f59584b95a09569d5a92a2381a5796bfd Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
-rw-r--r--tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp2
-rw-r--r--tests/auto/integration/shared/mediabackendutils.h37
2 files changed, 27 insertions, 12 deletions
diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
index a7d3d6932..43e1a9a31 100644
--- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
+++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
@@ -678,7 +678,7 @@ void tst_QCameraBackend::testNativeMetadata()
QTRY_VERIFY(recorder.recorderState() == QMediaRecorder::RecorderState::StoppedState);
QVERIFY(errorSignal.isEmpty());
- if (QPlatformMediaIntegration::instance()->name() != "gstreamer") {
+ if (!isGStreamerPlatform()) {
// https://bugreports.qt.io/browse/QTBUG-124183
QVERIFY(recorderErrorSignal.isEmpty());
}
diff --git a/tests/auto/integration/shared/mediabackendutils.h b/tests/auto/integration/shared/mediabackendutils.h
index f15975c18..f146eddb4 100644
--- a/tests/auto/integration/shared/mediabackendutils.h
+++ b/tests/auto/integration/shared/mediabackendutils.h
@@ -7,16 +7,31 @@
#include <QtTest/qtestcase.h>
#include <private/qplatformmediaintegration_p.h>
-#define QSKIP_GSTREAMER(message) \
- do { \
- if (QPlatformMediaIntegration::instance()->name() == "gstreamer") \
- QSKIP(message); \
- } while (0)
-
-#define QEXPECT_FAIL_GSTREAMER(dataIndex, comment, mode) \
- do { \
- if (QPlatformMediaIntegration::instance()->name() == "gstreamer") \
- QEXPECT_FAIL(dataIndex, comment, mode); \
- } while (0)
+inline bool isGStreamerPlatform()
+{
+ return QPlatformMediaIntegration::instance()->name() == "gstreamer";
+}
+
+inline bool isDarwinPlatform()
+{
+ return QPlatformMediaIntegration::instance()->name() == "darwin";
+}
+
+inline bool isAndroidPlatform()
+{
+ return QPlatformMediaIntegration::instance()->name() == "android";
+}
+
+#define QSKIP_GSTREAMER(message) \
+ do { \
+ if (isGStreamerPlatform()) \
+ QSKIP(message); \
+ } while (0)
+
+#define QEXPECT_FAIL_GSTREAMER(dataIndex, comment, mode) \
+ do { \
+ if (isGStreamerPlatform()) \
+ QEXPECT_FAIL(dataIndex, comment, mode); \
+ } while (0)
#endif // MEDIABACKENDUTILS_H