From 0377d99f1c2a7f988c5cae4ae5d91fa411e6194a Mon Sep 17 00:00:00 2001 From: VaL Doroshchuk Date: Thu, 25 Jun 2020 16:06:43 +0200 Subject: Don't map QMemoryVideoBuffer when there is no data inside Task-number: QTBUG-85202 Change-Id: If40af4af211af86311c0e04a8bdd0627dc34a939 Reviewed-by: Andy Shaw (cherry picked from commit d97efea0caaa9741f21e7e30b394d292ea80c9b0) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/unit/qvideoframe/tst_qvideoframe.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/unit/qvideoframe') diff --git a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp index bb77b7cca..e99c4bf77 100644 --- a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp +++ b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp @@ -31,6 +31,7 @@ #include #include +#include "private/qmemoryvideobuffer_p.h" #include #include #include @@ -89,6 +90,8 @@ private slots: void image_data(); void image(); + + void emptyData(); }; Q_DECLARE_METATYPE(QImage::Format) @@ -1299,6 +1302,15 @@ void tst_QVideoFrame::image() QCOMPARE(img.bytesPerLine(), bytesPerLine); } +void tst_QVideoFrame::emptyData() +{ + QByteArray data(nullptr, 0); + QVideoFrame f(new QMemoryVideoBuffer(data, 600), + QSize(800, 600), + QVideoFrame::Format_ARGB32); + QVERIFY(!f.map(QAbstractVideoBuffer::ReadOnly)); +} + QTEST_MAIN(tst_QVideoFrame) #include "tst_qvideoframe.moc" -- cgit v1.2.3