summaryrefslogtreecommitdiffstats
path: root/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp')
-rw-r--r--tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp108
1 files changed, 68 insertions, 40 deletions
diff --git a/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp b/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp
index e2ab89a41..41d54de0d 100644
--- a/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp
+++ b/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp
@@ -1,32 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QtTest>
@@ -57,6 +30,8 @@ private slots:
void construct();
void frameSize_data();
void frameSize();
+ void planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat_data() const;
+ void planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat() const;
void viewport_data();
void viewport();
void scanLineDirection_data();
@@ -109,7 +84,7 @@ void tst_QVideoFrameFormat::constructNull()
QCOMPARE(format.frameHeight(), -1);
QCOMPARE(format.viewport(), QRect());
QCOMPARE(format.scanLineDirection(), QVideoFrameFormat::TopToBottom);
- QCOMPARE(format.frameRate(), 0.0);
+ QCOMPARE(format.streamFrameRate(), 0.0);
QCOMPARE(format.colorSpace(), QVideoFrameFormat::ColorSpace_Undefined);
}
@@ -157,7 +132,7 @@ void tst_QVideoFrameFormat::construct()
QCOMPARE(format.isValid(), valid);
QCOMPARE(format.viewport(), viewport);
QCOMPARE(format.scanLineDirection(), QVideoFrameFormat::TopToBottom);
- QCOMPARE(format.frameRate(), 0.0);
+ QCOMPARE(format.streamFrameRate(), 0.0);
QCOMPARE(format.colorSpace(), QVideoFrameFormat::ColorSpace_Undefined);
}
@@ -191,6 +166,59 @@ void tst_QVideoFrameFormat::frameSize()
QCOMPARE(format.frameHeight(), newSize.height());
}
+void tst_QVideoFrameFormat::planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat_data() const {
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<int>("colorPlanes"); // Number of planes as specified by QVideoFrameFormat::PixelFormat documentation
+
+ QTest::newRow("ARGB8888") << QVideoFrameFormat::Format_ARGB8888 << 1;
+ QTest::newRow("ARGB8888_Premultiplied") << QVideoFrameFormat::Format_ARGB8888_Premultiplied << 1;
+ QTest::newRow("XRGB8888") << QVideoFrameFormat::Format_XRGB8888 << 1;
+ QTest::newRow("BGRA8888") << QVideoFrameFormat::Format_BGRA8888 << 1;
+ QTest::newRow("BGRA8888_Premultiplied") << QVideoFrameFormat::Format_BGRA8888_Premultiplied << 1;
+ QTest::newRow("BGRX8888") << QVideoFrameFormat::Format_BGRX8888 << 1;
+ QTest::newRow("ABGR8888") << QVideoFrameFormat::Format_ABGR8888 << 1;
+ QTest::newRow("XBGR8888") << QVideoFrameFormat::Format_XBGR8888 << 1;
+ QTest::newRow("RGBA8888") << QVideoFrameFormat::Format_RGBA8888 << 1;
+ QTest::newRow("RGBX8888") << QVideoFrameFormat::Format_RGBX8888 << 1;
+
+ QTest::newRow("AUYVY") << QVideoFrameFormat::Format_AYUV << 1;
+ QTest::newRow("AYUV_Premultiplied") << QVideoFrameFormat::Format_AYUV_Premultiplied << 1;
+ QTest::newRow("YUV420P") << QVideoFrameFormat::Format_YUV420P << 3;
+ QTest::newRow("YUV422P") << QVideoFrameFormat::Format_YUV422P << 3;
+ QTest::newRow("YV12") << QVideoFrameFormat::Format_YV12 << 3;
+
+ QTest::newRow("UYVY") << QVideoFrameFormat::Format_UYVY << 1;
+ QTest::newRow("YUYV") << QVideoFrameFormat::Format_YUYV << 1;
+ QTest::newRow("NV12") << QVideoFrameFormat::Format_NV12 << 2;
+ QTest::newRow("NV21") << QVideoFrameFormat::Format_NV21 << 2;
+
+ QTest::newRow("IMC1") << QVideoFrameFormat::Format_IMC1 << 3;
+ QTest::newRow("IMC2") << QVideoFrameFormat::Format_IMC2 << 2;
+ QTest::newRow("IMC3") << QVideoFrameFormat::Format_IMC3 << 3;
+ QTest::newRow("IMC4") << QVideoFrameFormat::Format_IMC4 << 2;
+
+ QTest::newRow("Y8") << QVideoFrameFormat::Format_Y8 << 1;
+ QTest::newRow("Y16") << QVideoFrameFormat::Format_Y16 << 1;
+
+ QTest::newRow("P010") << QVideoFrameFormat::Format_P010 << 2;
+ QTest::newRow("P016") << QVideoFrameFormat::Format_P016 << 2;
+
+ QTest::newRow("SamplerExternalOES") << QVideoFrameFormat::Format_SamplerExternalOES << 1;
+ QTest::newRow("Jpeg") << QVideoFrameFormat::Format_Jpeg << 1;
+ QTest::newRow("SamplerRect") << QVideoFrameFormat::Format_SamplerRect << 1;
+
+ QTest::newRow("YUV420P10") << QVideoFrameFormat::Format_YUV420P10 << 3;
+}
+
+void tst_QVideoFrameFormat::planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat() const {
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(int, colorPlanes);
+
+ const QVideoFrameFormat frameFormat = QVideoFrameFormat({}, pixelFormat);
+
+ QCOMPARE_EQ(frameFormat.planeCount(), colorPlanes);
+}
+
void tst_QVideoFrameFormat::viewport_data()
{
QTest::addColumn<QSize>("initialSize");
@@ -307,9 +335,9 @@ void tst_QVideoFrameFormat::frameRate()
QVideoFrameFormat format(QSize(64, 64), QVideoFrameFormat::Format_XRGB8888);
- format.setFrameRate(frameRate);
+ format.setStreamFrameRate(frameRate);
- QCOMPARE(format.frameRate(), frameRate);
+ QCOMPARE(format.streamFrameRate(), frameRate);
}
void tst_QVideoFrameFormat::compare()
@@ -367,13 +395,13 @@ void tst_QVideoFrameFormat::compare()
QCOMPARE(format1 == format2, true);
QCOMPARE(format1 != format2, false);
- format1.setFrameRate(7.5);
+ format1.setStreamFrameRate(7.5);
// Not equal frame rate differs.
QCOMPARE(format1 == format2, false);
QCOMPARE(format1 != format2, true);
- format2.setFrameRate(qreal(7.50001));
+ format2.setStreamFrameRate(qreal(7.50001));
// Equal.
QCOMPARE(format1 == format2, true);
@@ -478,7 +506,7 @@ void tst_QVideoFrameFormat::copyAllParameters()
original.setScanLineDirection(QVideoFrameFormat::BottomToTop);
original.setViewport(QRect(0, 0, 1024, 1024));
- original.setFrameRate(qreal(15.0));
+ original.setStreamFrameRate(qreal(15.0));
original.setColorSpace(QVideoFrameFormat::ColorSpace_BT709);
/* Copy the original instance to copy and verify if both the instances
@@ -489,7 +517,7 @@ void tst_QVideoFrameFormat::copyAllParameters()
QCOMPARE(copy.frameSize(), QSize(1024, 768));
QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::BottomToTop);
QCOMPARE(copy.viewport(), QRect(0, 0, 1024, 1024));
- QCOMPARE(copy.frameRate(), qreal(15.0));
+ QCOMPARE(copy.streamFrameRate(), qreal(15.0));
QCOMPARE(copy.colorSpace(), QVideoFrameFormat::ColorSpace_BT709);
/* Verify if both the instances are eqaul */
@@ -505,7 +533,7 @@ void tst_QVideoFrameFormat::assignAllParameters()
QSize(64, 64), QVideoFrameFormat::Format_AYUV);
copy.setScanLineDirection(QVideoFrameFormat::TopToBottom);
copy.setViewport(QRect(0, 0, 640, 320));
- copy.setFrameRate(qreal(7.5));
+ copy.setStreamFrameRate(qreal(7.5));
copy.setColorSpace(QVideoFrameFormat::ColorSpace_BT601);
/* Create the instance and set all the parameters. */
@@ -513,7 +541,7 @@ void tst_QVideoFrameFormat::assignAllParameters()
QSize(1024, 768), QVideoFrameFormat::Format_ARGB8888);
original.setScanLineDirection(QVideoFrameFormat::BottomToTop);
original.setViewport(QRect(0, 0, 1024, 1024));
- original.setFrameRate(qreal(15.0));
+ original.setStreamFrameRate(qreal(15.0));
original.setColorSpace(QVideoFrameFormat::ColorSpace_BT709);
/* Assign the original instance to copy and verify if both the instancess
@@ -524,7 +552,7 @@ void tst_QVideoFrameFormat::assignAllParameters()
QCOMPARE(copy.frameSize(), QSize(1024, 768));
QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::BottomToTop);
QCOMPARE(copy.viewport(), QRect(0, 0, 1024, 1024));
- QCOMPARE(copy.frameRate(), qreal(15.0));
+ QCOMPARE(copy.streamFrameRate(), qreal(15.0));
QCOMPARE(copy.colorSpace(), QVideoFrameFormat::ColorSpace_BT709);
/* Verify if both the instances are eqaul */