diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-23 13:24:34 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-23 13:24:34 (GMT) |
commit | f6835920b5497f228e2aa3ba397437af30a0bfe9 (patch) | |
tree | bd55bc7c13302c8e91691e65caf95081c92e5151 | |
parent | 72c8900e421ab4afd65b3752551a7fb857ca540f (diff) | |
parent | 66da996c11d2f630255650e6e88fc1a08a393b27 (diff) | |
download | Qt-f6835920b5497f228e2aa3ba397437af30a0bfe9.zip Qt-f6835920b5497f228e2aa3ba397437af30a0bfe9.tar.gz Qt-f6835920b5497f228e2aa3ba397437af30a0bfe9.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging:
Fix missing QImage::Format to QVideoFrame::PixelFormat conversion.
-rw-r--r-- | src/multimedia/video/qvideoframe.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qvideoframe/tst_qvideoframe.cpp | 128 |
2 files changed, 129 insertions, 0 deletions
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp index 2d66d9e..cd38f5e 100644 --- a/src/multimedia/video/qvideoframe.cpp +++ b/src/multimedia/video/qvideoframe.cpp @@ -665,6 +665,7 @@ QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format case QImage::Format_RGB16: return Format_RGB565; case QImage::Format_ARGB8565_Premultiplied: + return Format_ARGB8565_Premultiplied; case QImage::Format_RGB666: case QImage::Format_ARGB6666_Premultiplied: return Format_Invalid; diff --git a/tests/auto/qvideoframe/tst_qvideoframe.cpp b/tests/auto/qvideoframe/tst_qvideoframe.cpp index 944bb59..3176af0 100644 --- a/tests/auto/qvideoframe/tst_qvideoframe.cpp +++ b/tests/auto/qvideoframe/tst_qvideoframe.cpp @@ -79,6 +79,8 @@ private slots: void mapImage_data(); void mapImage(); void imageDetach(); + void formatConversion_data(); + void formatConversion(); }; Q_DECLARE_METATYPE(QImage::Format) @@ -658,6 +660,132 @@ void tst_QVideoFrame::imageDetach() QCOMPARE(image.pixel(4, 4), red); } +void tst_QVideoFrame::formatConversion_data() +{ + QTest::addColumn<QImage::Format>("imageFormat"); + QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat"); + + QTest::newRow("QImage::Format_RGB32 | QVideoFrame::Format_RGB32") + << QImage::Format_RGB32 + << QVideoFrame::Format_RGB32; + QTest::newRow("QImage::Format_ARGB32 | QVideoFrame::Format_ARGB32") + << QImage::Format_ARGB32 + << QVideoFrame::Format_ARGB32; + QTest::newRow("QImage::Format_ARGB32_Premultiplied | QVideoFrame::Format_ARGB32_Premultiplied") + << QImage::Format_ARGB32_Premultiplied + << QVideoFrame::Format_ARGB32_Premultiplied; + QTest::newRow("QImage::Format_RGB16 | QVideoFrame::Format_RGB565") + << QImage::Format_RGB16 + << QVideoFrame::Format_RGB565; + QTest::newRow("QImage::Format_ARGB8565_Premultiplied | QVideoFrame::Format_ARGB8565_Premultiplied") + << QImage::Format_ARGB8565_Premultiplied + << QVideoFrame::Format_ARGB8565_Premultiplied; + QTest::newRow("QImage::Format_RGB555 | QVideoFrame::Format_RGB555") + << QImage::Format_RGB555 + << QVideoFrame::Format_RGB555; + QTest::newRow("QImage::Format_RGB888 | QVideoFrame::Format_RGB24") + << QImage::Format_RGB888 + << QVideoFrame::Format_RGB24; + + QTest::newRow("QImage::Format_MonoLSB") + << QImage::Format_MonoLSB + << QVideoFrame::Format_Invalid; + QTest::newRow("QImage::Format_Indexed8") + << QImage::Format_Indexed8 + << QVideoFrame::Format_Invalid; + QTest::newRow("QImage::Format_ARGB6666_Premultiplied") + << QImage::Format_ARGB6666_Premultiplied + << QVideoFrame::Format_Invalid; + QTest::newRow("QImage::Format_ARGB8555_Premultiplied") + << QImage::Format_ARGB8555_Premultiplied + << QVideoFrame::Format_Invalid; + QTest::newRow("QImage::Format_RGB666") + << QImage::Format_RGB666 + << QVideoFrame::Format_Invalid; + QTest::newRow("QImage::Format_RGB444") + << QImage::Format_RGB444 + << QVideoFrame::Format_Invalid; + QTest::newRow("QImage::Format_ARGB4444_Premultiplied") + << QImage::Format_ARGB4444_Premultiplied + << QVideoFrame::Format_Invalid; + + QTest::newRow("QVideoFrame::Format_BGRA32") + << QImage::Format_Invalid + << QVideoFrame::Format_BGRA32; + QTest::newRow("QVideoFrame::Format_BGRA32_Premultiplied") + << QImage::Format_Invalid + << QVideoFrame::Format_BGRA32_Premultiplied; + QTest::newRow("QVideoFrame::Format_BGR32") + << QImage::Format_Invalid + << QVideoFrame::Format_BGR32; + QTest::newRow("QVideoFrame::Format_BGR24") + << QImage::Format_Invalid + << QVideoFrame::Format_BGR24; + QTest::newRow("QVideoFrame::Format_BGR565") + << QImage::Format_Invalid + << QVideoFrame::Format_BGR565; + QTest::newRow("QVideoFrame::Format_BGR555") + << QImage::Format_Invalid + << QVideoFrame::Format_BGR555; + QTest::newRow("QVideoFrame::Format_BGRA5658_Premultiplied") + << QImage::Format_Invalid + << QVideoFrame::Format_BGRA5658_Premultiplied; + QTest::newRow("QVideoFrame::Format_AYUV444") + << QImage::Format_Invalid + << QVideoFrame::Format_AYUV444; + QTest::newRow("QVideoFrame::Format_AYUV444_Premultiplied") + << QImage::Format_Invalid + << QVideoFrame::Format_AYUV444_Premultiplied; + QTest::newRow("QVideoFrame::Format_YUV444") + << QImage::Format_Invalid + << QVideoFrame::Format_YUV420P; + QTest::newRow("QVideoFrame::Format_YV12") + << QImage::Format_Invalid + << QVideoFrame::Format_YV12; + QTest::newRow("QVideoFrame::Format_UYVY") + << QImage::Format_Invalid + << QVideoFrame::Format_UYVY; + QTest::newRow("QVideoFrame::Format_YUYV") + << QImage::Format_Invalid + << QVideoFrame::Format_YUYV; + QTest::newRow("QVideoFrame::Format_NV12") + << QImage::Format_Invalid + << QVideoFrame::Format_NV12; + QTest::newRow("QVideoFrame::Format_NV21") + << QImage::Format_Invalid + << QVideoFrame::Format_NV21; + QTest::newRow("QVideoFrame::Format_IMC1") + << QImage::Format_Invalid + << QVideoFrame::Format_IMC1; + QTest::newRow("QVideoFrame::Format_IMC2") + << QImage::Format_Invalid + << QVideoFrame::Format_IMC2; + QTest::newRow("QVideoFrame::Format_IMC3") + << QImage::Format_Invalid + << QVideoFrame::Format_IMC3; + QTest::newRow("QVideoFrame::Format_IMC4") + << QImage::Format_Invalid + << QVideoFrame::Format_IMC4; + QTest::newRow("QVideoFrame::Format_Y8") + << QImage::Format_Invalid + << QVideoFrame::Format_Y8; + QTest::newRow("QVideoFrame::Format_Y16") + << QImage::Format_Invalid + << QVideoFrame::Format_Y16; +} + +void tst_QVideoFrame::formatConversion() +{ + QFETCH(QImage::Format, imageFormat); + QFETCH(QVideoFrame::PixelFormat, pixelFormat); + + QCOMPARE(QVideoFrame::pixelFormatFromImageFormat(imageFormat) == pixelFormat, + imageFormat != QImage::Format_Invalid); + + QCOMPARE(QVideoFrame::imageFormatFromPixelFormat(pixelFormat) == imageFormat, + pixelFormat != QVideoFrame::Format_Invalid); +} + QTEST_MAIN(tst_QVideoFrame) #include "tst_qvideoframe.moc" |