tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   125 void tst_QVideoSurfaceFormat::construct_data()
   125 void tst_QVideoSurfaceFormat::construct_data()
   126 {
   126 {
   127     QTest::addColumn<QSize>("frameSize");
   127     QTest::addColumn<QSize>("frameSize");
   128     QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
   128     QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
   129     QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
   129     QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
       
   130     QTest::addColumn<bool>("valid");
   130 
   131 
   131     QTest::newRow("32x32 rgb32 no handle")
   132     QTest::newRow("32x32 rgb32 no handle")
   132             << QSize(32, 32)
   133             << QSize(32, 32)
   133             << QVideoFrame::Format_RGB32
   134             << QVideoFrame::Format_RGB32
   134             << QAbstractVideoBuffer::NoHandle;
   135             << QAbstractVideoBuffer::NoHandle
       
   136             << true;
   135 
   137 
   136     QTest::newRow("1024x768 YUV444 GL texture")
   138     QTest::newRow("1024x768 YUV444 GL texture")
   137             << QSize(32, 32)
   139             << QSize(32, 32)
   138             << QVideoFrame::Format_YUV444
   140             << QVideoFrame::Format_YUV444
   139             << QAbstractVideoBuffer::GLTextureHandle;
   141             << QAbstractVideoBuffer::GLTextureHandle
       
   142             << true;
       
   143 
       
   144     QTest::newRow("32x32 invalid no handle")
       
   145             << QSize(32, 32)
       
   146             << QVideoFrame::Format_Invalid
       
   147             << QAbstractVideoBuffer::NoHandle
       
   148             << false;
       
   149 
       
   150     QTest::newRow("invalid size, rgb32 no handle")
       
   151             << QSize()
       
   152             << QVideoFrame::Format_RGB32
       
   153             << QAbstractVideoBuffer::NoHandle
       
   154             << false;
       
   155 
       
   156     QTest::newRow("0x0 rgb32 no handle")
       
   157             << QSize(0,0)
       
   158             << QVideoFrame::Format_RGB32
       
   159             << QAbstractVideoBuffer::NoHandle
       
   160             << true;
   140 }
   161 }
   141 
   162 
   142 void tst_QVideoSurfaceFormat::construct()
   163 void tst_QVideoSurfaceFormat::construct()
   143 {
   164 {
   144     QFETCH(QSize, frameSize);
   165     QFETCH(QSize, frameSize);
   145     QFETCH(QVideoFrame::PixelFormat, pixelFormat);
   166     QFETCH(QVideoFrame::PixelFormat, pixelFormat);
   146     QFETCH(QAbstractVideoBuffer::HandleType, handleType);
   167     QFETCH(QAbstractVideoBuffer::HandleType, handleType);
       
   168     QFETCH(bool, valid);
   147 
   169 
   148     QRect viewport(QPoint(0, 0), frameSize);
   170     QRect viewport(QPoint(0, 0), frameSize);
   149 
   171 
   150     QVideoSurfaceFormat format(frameSize, pixelFormat, handleType);
   172     QVideoSurfaceFormat format(frameSize, pixelFormat, handleType);
   151 
   173 
   152     QCOMPARE(format.handleType(), handleType);
   174     QCOMPARE(format.handleType(), handleType);
   153     QCOMPARE(format.pixelFormat(), pixelFormat);
   175     QCOMPARE(format.pixelFormat(), pixelFormat);
   154     QCOMPARE(format.frameSize(), frameSize);
   176     QCOMPARE(format.frameSize(), frameSize);
   155     QCOMPARE(format.frameWidth(), frameSize.width());
   177     QCOMPARE(format.frameWidth(), frameSize.width());
   156     QCOMPARE(format.frameHeight(), frameSize.height());
   178     QCOMPARE(format.frameHeight(), frameSize.height());
       
   179     QCOMPARE(format.isValid(), valid);
   157     QCOMPARE(format.viewport(), viewport);
   180     QCOMPARE(format.viewport(), viewport);
   158     QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
   181     QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
   159     QCOMPARE(format.frameRate(), 0.0);
   182     QCOMPARE(format.frameRate(), 0.0);
   160     QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
   183     QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
   161     QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
   184     QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);