summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2024-04-22 09:16:17 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-04-24 02:32:40 +0000
commit0e1ea2b48b12f988d516b54ef9190b03839ea57c (patch)
tree29eff97c2a6f1823f2c55a3e771c055a1017ebb7
parent7086c364b962b736ae117a26716233ec5164f342 (diff)
Tests: QMediaPlayer - fix playFromBuffer
`m_localVideoFile->toLocalFile()` didn't result in an QUrl that QFile could load, causing the playFromBuffer test to be skipped. So we need to build an url by hand. Pick-to: 6.5 Change-Id: I8ba1d7e39613aa8c20aaabe55650587e2ff7694a Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit 3e1bc1b76dae91d957fd1a1861d62ec79ca0a0db) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index fa1450571..dd404d345 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -37,6 +37,8 @@
QT_USE_NAMESPACE
+using namespace Qt::Literals;
+
namespace {
static qreal colorDifference(QRgb first, QRgb second)
{
@@ -2284,9 +2286,9 @@ void tst_QMediaPlayerBackend::playFromBuffer()
TestVideoSink surface(false);
QMediaPlayer player;
player.setVideoOutput(&surface);
- QFile file(m_localVideoFile->toLocalFile());
- if (!file.open(QIODevice::ReadOnly))
- QSKIP("Could not open file");
+ QFile file(u":"_s + m_localVideoFile->toEncoded(QUrl::RemoveScheme));
+ QVERIFY(file.open(QIODevice::ReadOnly));
+
player.setSourceDevice(&file, *m_localVideoFile);
player.play();
QTRY_VERIFY(player.position() >= 1000);