Declare more metatypes and debug operators.

Nearly all of the multimedia metatypes used in the auto tests are
now declared properly, and a large number of the types have debug
operators as well.

Removed the superfluous decls as well.

Change-Id: I42cfe37562db0c71d9811b4577fc326a3326ccc9
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
This commit is contained in:
Michael Goddard
2011-11-01 12:46:48 +10:00
committed by Qt by Nokia
parent 6a3a442ea6
commit 7dfb883df6
30 changed files with 720 additions and 168 deletions

View File

@@ -47,6 +47,13 @@
#include <QtGui/QImage>
#include <QtCore/QPointer>
// Adds an enum, and the stringized version
#define ADD_ENUM_TEST(x) \
QTest::newRow(#x) \
<< QVideoFrame::x \
<< QString(QLatin1String(#x));
class tst_QVideoFrame : public QObject
{
Q_OBJECT
@@ -84,13 +91,21 @@ private slots:
void formatConversion_data();
void formatConversion();
void debugType_data();
void debugType();
void debug_data();
void debug();
void debugFormat_data();
void debugFormat();
void isMapped();
void isReadable();
void isWritable();
};
Q_DECLARE_METATYPE(QImage::Format)
Q_DECLARE_METATYPE(QVideoFrame)
class QtTestVideoBuffer : public QObject, public QAbstractVideoBuffer
{
@@ -963,6 +978,148 @@ void tst_QVideoFrame::isWritable()
frame.unmap();
}
void tst_QVideoFrame::debugType_data()
{
QTest::addColumn<QVideoFrame::FieldType>("fieldType");
QTest::addColumn<QString>("stringized");
ADD_ENUM_TEST(ProgressiveFrame);
ADD_ENUM_TEST(InterlacedFrame);
ADD_ENUM_TEST(TopField);
ADD_ENUM_TEST(BottomField);
}
void tst_QVideoFrame::debugType()
{
QFETCH(QVideoFrame::FieldType, fieldType);
QFETCH(QString, stringized);
QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
qDebug() << fieldType;
}
void tst_QVideoFrame::debug_data()
{
QTest::addColumn<QVideoFrame>("frame");
QTest::addColumn<QString>("stringized");
QVideoFrame f;
QTest::newRow("default") << f << QString::fromLatin1("QVideoFrame( QSize(-1, -1) , Format_Invalid, NoHandle, NotMapped, [no timestamp])");
QVideoFrame f2;
f2.setStartTime(12345);
f2.setEndTime(8000000000LL);
QTest::newRow("times") << f2 << QString::fromLatin1("QVideoFrame( QSize(-1, -1) , Format_Invalid, NoHandle, NotMapped, 0:00:00.12345 - 2:13:20.00)");
QVideoFrame f3;
f3.setFieldType(QVideoFrame::ProgressiveFrame);
QTest::newRow("times prog") << f3 << QString::fromLatin1("QVideoFrame( QSize(-1, -1) , Format_Invalid, NoHandle, NotMapped, [no timestamp])");
QVideoFrame f4;
f4.setFieldType(QVideoFrame::TopField);
QTest::newRow("times top") << f4 << QString::fromLatin1("QVideoFrame( QSize(-1, -1) , Format_Invalid, NoHandle, NotMapped, [no timestamp])");
QVideoFrame f5;
f5.setFieldType(QVideoFrame::TopField);
f5.setEndTime(90000000000LL);
QTest::newRow("end but no start") << f5 << QString::fromLatin1("QVideoFrame( QSize(-1, -1) , Format_Invalid, NoHandle, NotMapped, [no timestamp])");
QVideoFrame f6;
f6.setStartTime(12345000000LL);
f6.setEndTime(80000000000LL);
QTest::newRow("times big") << f6 << QString::fromLatin1("QVideoFrame( QSize(-1, -1) , Format_Invalid, NoHandle, NotMapped, 3:25:45.00 - 22:13:20.00)");
QVideoFrame g(0, QSize(320,240), 640, QVideoFrame::Format_ARGB32);
QTest::newRow("more valid") << g << QString::fromLatin1("QVideoFrame( QSize(320, 240) , Format_ARGB32, NoHandle, NotMapped, [no timestamp])");
QVideoFrame g2(0, QSize(320,240), 640, QVideoFrame::Format_ARGB32);
g2.setStartTime(9000000000LL);
g2.setEndTime(9000000000LL);
QTest::newRow("more valid") << g2 << QString::fromLatin1("QVideoFrame( QSize(320, 240) , Format_ARGB32, NoHandle, NotMapped, @2:30:00.00)");
QVideoFrame g3(0, QSize(320,240), 640, QVideoFrame::Format_ARGB32);
g3.setStartTime(900000LL);
g3.setEndTime(900000LL);
QTest::newRow("more valid single timestamp") << g3 << QString::fromLatin1("QVideoFrame( QSize(320, 240) , Format_ARGB32, NoHandle, NotMapped, @00:00.900000)");
QVideoFrame g4(0, QSize(320,240), 640, QVideoFrame::Format_ARGB32);
g4.setStartTime(200000000LL);
g4.setEndTime(300000000LL);
QTest::newRow("more valid") << g4 << QString::fromLatin1("QVideoFrame( QSize(320, 240) , Format_ARGB32, NoHandle, NotMapped, 03:20.00 - 05:00.00)");
QVideoFrame g5(0, QSize(320,240), 640, QVideoFrame::Format_ARGB32);
g5.setStartTime(200000000LL);
QTest::newRow("more valid until forever") << g5 << QString::fromLatin1("QVideoFrame( QSize(320, 240) , Format_ARGB32, NoHandle, NotMapped, 03:20.00 - forever)");
QVideoFrame g6(0, QSize(320,240), 640, QVideoFrame::Format_ARGB32);
g6.setStartTime(9000000000LL);
QTest::newRow("more valid for long forever") << g6 << QString::fromLatin1("QVideoFrame( QSize(320, 240) , Format_ARGB32, NoHandle, NotMapped, 2:30:00.00 - forever)");
}
void tst_QVideoFrame::debug()
{
QFETCH(QVideoFrame, frame);
QFETCH(QString, stringized);
QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
qDebug() << frame;
}
void tst_QVideoFrame::debugFormat_data()
{
QTest::addColumn<QVideoFrame::PixelFormat>("format");
QTest::addColumn<QString>("stringized");
ADD_ENUM_TEST(Format_Invalid);
ADD_ENUM_TEST(Format_ARGB32);
ADD_ENUM_TEST(Format_ARGB32_Premultiplied);
ADD_ENUM_TEST(Format_RGB32);
ADD_ENUM_TEST(Format_RGB24);
ADD_ENUM_TEST(Format_RGB565);
ADD_ENUM_TEST(Format_RGB555);
ADD_ENUM_TEST(Format_ARGB8565_Premultiplied);
ADD_ENUM_TEST(Format_BGRA32);
ADD_ENUM_TEST(Format_BGRA32_Premultiplied);
ADD_ENUM_TEST(Format_BGR32);
ADD_ENUM_TEST(Format_BGR24);
ADD_ENUM_TEST(Format_BGR565);
ADD_ENUM_TEST(Format_BGR555);
ADD_ENUM_TEST(Format_BGRA5658_Premultiplied);
ADD_ENUM_TEST(Format_AYUV444);
ADD_ENUM_TEST(Format_AYUV444_Premultiplied);
ADD_ENUM_TEST(Format_YUV444);
ADD_ENUM_TEST(Format_YUV420P);
ADD_ENUM_TEST(Format_YV12);
ADD_ENUM_TEST(Format_UYVY);
ADD_ENUM_TEST(Format_YUYV);
ADD_ENUM_TEST(Format_NV12);
ADD_ENUM_TEST(Format_NV21);
ADD_ENUM_TEST(Format_IMC1);
ADD_ENUM_TEST(Format_IMC2);
ADD_ENUM_TEST(Format_IMC3);
ADD_ENUM_TEST(Format_IMC4);
ADD_ENUM_TEST(Format_Y8);
ADD_ENUM_TEST(Format_Y16);
ADD_ENUM_TEST(Format_Jpeg);
ADD_ENUM_TEST(Format_CameraRaw);
ADD_ENUM_TEST(Format_AdobeDng);
// User enums are formatted differently
QTest::newRow("user 1000") << QVideoFrame::Format_User << QString::fromLatin1("UserType(1000)");
QTest::newRow("user 1005") << QVideoFrame::PixelFormat(QVideoFrame::Format_User + 5) << QString::fromLatin1("UserType(1005)");
}
void tst_QVideoFrame::debugFormat()
{
QFETCH(QVideoFrame::PixelFormat, format);
QFETCH(QString, stringized);
QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
qDebug() << format;
}
QTEST_MAIN(tst_QVideoFrame)