diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2020-06-25 16:06:43 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2020-06-30 18:00:40 +0200 |
commit | d97efea0caaa9741f21e7e30b394d292ea80c9b0 (patch) | |
tree | a36086141204d8b49c660406fd185b07ac2b250b /tests/auto/unit/qvideoframe/tst_qvideoframe.cpp | |
parent | f3d9409a8afe0ba805060aaebf5389c866807e72 (diff) |
Don't map QMemoryVideoBuffer when there is no data inside
Pick-to: 5.15
Task-number: QTBUG-85202
Change-Id: If40af4af211af86311c0e04a8bdd0627dc34a939
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'tests/auto/unit/qvideoframe/tst_qvideoframe.cpp')
-rw-r--r-- | tests/auto/unit/qvideoframe/tst_qvideoframe.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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 <QtTest/QtTest> #include <qvideoframe.h> +#include "private/qmemoryvideobuffer_p.h" #include <QtGui/QImage> #include <QtCore/QPointer> #include <QtMultimedia/private/qtmultimedia-config_p.h> @@ -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" |