summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2024-04-22 09:58:24 +0800
committerTim Blechmann <tim@klingt.org>2024-04-23 15:42:48 +0800
commitd1c9a54418b85cf31f93828cc06073216bd3aa0e (patch)
tree89f8d2ae36bda50ab46a256b750c9b63b4fc80c2
parent867611dcf5bb41090316facca6aab21be9fe49c9 (diff)
QMediaPlayer: tweak test for negative playback rates
Some backends support negative playback rates, others don't. The tests should reflect that. Pick-to: 6.5 6.7 Change-Id: I15eaa863fc6d082c4fd9597cb5d54b880d927812 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp12
-rw-r--r--tests/auto/integration/shared/mediabackendutils.h10
2 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index d6466e7e0..4c5c16624 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -1219,9 +1219,17 @@ void tst_QMediaPlayerBackend::setPlaybackRate_changesPlaybackRateAndEmitsSignal_
QTest::addRow("Increase") << 1.0f << 2.0f << 2.0f << true;
QTest::addRow("Decrease") << 1.0f << 0.5f << 0.5f << true;
QTest::addRow("Keep") << 0.5f << 0.5f << 0.5f << false;
- QTest::addRow("DecreaseBelowZero") << 0.5f << -0.5f << 0.0f << true;
- QTest::addRow("KeepDecreasingBelowZero") << -0.5f << -0.6f << 0.0f << false;
+ bool backendSupportsNegativePlayback =
+ isWindowsPlatform() || isDarwinPlatform() || isGStreamerPlatform();
+
+ if (backendSupportsNegativePlayback) {
+ QTest::addRow("DecreaseBelowZero") << 0.5f << -0.5f << -0.5f << true;
+ QTest::addRow("KeepDecreasingBelowZero") << -0.5f << -0.6f << -0.6f << true;
+ } else {
+ QTest::addRow("DecreaseBelowZero") << 0.5f << -0.5f << 0.0f << true;
+ QTest::addRow("KeepDecreasingBelowZero") << -0.5f << -0.6f << 0.0f << false;
+ }
}
void tst_QMediaPlayerBackend::setPlaybackRate_changesPlaybackRateAndEmitsSignal()
diff --git a/tests/auto/integration/shared/mediabackendutils.h b/tests/auto/integration/shared/mediabackendutils.h
index f146eddb4..6c538d7de 100644
--- a/tests/auto/integration/shared/mediabackendutils.h
+++ b/tests/auto/integration/shared/mediabackendutils.h
@@ -22,6 +22,16 @@ inline bool isAndroidPlatform()
return QPlatformMediaIntegration::instance()->name() == "android";
}
+inline bool isFFMPEGPlatform()
+{
+ return QPlatformMediaIntegration::instance()->name() == "ffmpeg";
+}
+
+inline bool isWindowsPlatform()
+{
+ return QPlatformMediaIntegration::instance()->name() == "windows";
+}
+
#define QSKIP_GSTREAMER(message) \
do { \
if (isGStreamerPlatform()) \