diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-07-22 02:42:34 (GMT) |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-07-22 02:42:34 (GMT) |
commit | 51cf737151c1c446a9ce77832774202b6bdb4ba2 (patch) | |
tree | 4f0eb2e1d3a5e6a516c7d085775a6ae2cf242d4c | |
parent | a1a3535cd45819bd54310791bdcc1cec43f38b63 (diff) | |
download | Qt-51cf737151c1c446a9ce77832774202b6bdb4ba2.zip Qt-51cf737151c1c446a9ce77832774202b6bdb4ba2.tar.gz Qt-51cf737151c1c446a9ce77832774202b6bdb4ba2.tar.bz2 |
Fixed QVideoSurfaceFormat::isValid()
Trivial fix, valid formats have pixel format != Invalid, not ==.
Task-number: QTBUG-12337
Reviewed-by: Andrew den Exter
-rw-r--r-- | src/multimedia/video/qvideosurfaceformat.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp | 27 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index 1fc13a6..3afbdc9 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -252,7 +252,7 @@ QVideoSurfaceFormat::~QVideoSurfaceFormat() bool QVideoSurfaceFormat::isValid() const { - return d->pixelFormat == QVideoFrame::Format_Invalid && d->frameSize.isValid(); + return d->pixelFormat != QVideoFrame::Format_Invalid && d->frameSize.isValid(); } /*! diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp index 8a4307e..a4bfb89 100644 --- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp +++ b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp @@ -127,16 +127,37 @@ void tst_QVideoSurfaceFormat::construct_data() QTest::addColumn<QSize>("frameSize"); QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat"); QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType"); + QTest::addColumn<bool>("valid"); QTest::newRow("32x32 rgb32 no handle") << QSize(32, 32) << QVideoFrame::Format_RGB32 - << QAbstractVideoBuffer::NoHandle; + << QAbstractVideoBuffer::NoHandle + << true; QTest::newRow("1024x768 YUV444 GL texture") << QSize(32, 32) << QVideoFrame::Format_YUV444 - << QAbstractVideoBuffer::GLTextureHandle; + << QAbstractVideoBuffer::GLTextureHandle + << true; + + QTest::newRow("32x32 invalid no handle") + << QSize(32, 32) + << QVideoFrame::Format_Invalid + << QAbstractVideoBuffer::NoHandle + << false; + + QTest::newRow("invalid size, rgb32 no handle") + << QSize() + << QVideoFrame::Format_RGB32 + << QAbstractVideoBuffer::NoHandle + << false; + + QTest::newRow("0x0 rgb32 no handle") + << QSize(0,0) + << QVideoFrame::Format_RGB32 + << QAbstractVideoBuffer::NoHandle + << true; } void tst_QVideoSurfaceFormat::construct() @@ -144,6 +165,7 @@ void tst_QVideoSurfaceFormat::construct() QFETCH(QSize, frameSize); QFETCH(QVideoFrame::PixelFormat, pixelFormat); QFETCH(QAbstractVideoBuffer::HandleType, handleType); + QFETCH(bool, valid); QRect viewport(QPoint(0, 0), frameSize); @@ -154,6 +176,7 @@ void tst_QVideoSurfaceFormat::construct() QCOMPARE(format.frameSize(), frameSize); QCOMPARE(format.frameWidth(), frameSize.width()); QCOMPARE(format.frameHeight(), frameSize.height()); + QCOMPARE(format.isValid(), valid); QCOMPARE(format.viewport(), viewport); QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); QCOMPARE(format.frameRate(), 0.0); |