diff options
author | Tim Blechmann <tim@klingt.org> | 2024-04-17 10:31:35 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-04-18 12:43:23 +0000 |
commit | bf4c3120763b8f0a1fce2cf4cf08161ce1964dfd (patch) | |
tree | 41695a8d739d84fee17d9ebc9802908888578006 | |
parent | 80554e1309546bd99ef72b33fd220c8c2f66bb76 (diff) |
Tests: improve mediabackendutils.h
some quality of life improvements
Pick-to: 6.5
Change-Id: I8cee3f6f59584b95a09569d5a92a2381a5796bfd
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit 4e5581dc0c6c0e606db01fa16779220846d5244b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp | 2 | ||||
-rw-r--r-- | tests/auto/integration/shared/mediabackendutils.h | 37 |
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 1857803da..0a6794415 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 |