qtmobility/tests/auto/qpaintervideosurface/tst_qpaintervideosurface.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
    42 
    42 
    43 #include <qpaintervideosurface_p.h>
    43 #include <qpaintervideosurface_p.h>
    44 #include <QtTest/QtTest>
    44 #include <QtTest/QtTest>
    45 
    45 
    46 #include <QtGui/qapplication.h>
    46 #include <QtGui/qapplication.h>
    47 #include <QtMultimedia/qvideosurfaceformat.h>
    47 #include <qvideosurfaceformat.h>
    48 
    48 
    49 #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
    49 #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
    50 #include <QtOpenGL/qgl.h>
    50 #include <QtOpenGL/qgl.h>
    51 #include <QtOpenGL/qglframebufferobject.h>
    51 #include <QtOpenGL/qglframebufferobject.h>
    52 #endif
    52 #endif
   695     QTest::addColumn<QSize>("frameSize");
   695     QTest::addColumn<QSize>("frameSize");
   696     QTest::addColumn<bool>("supportedPixelFormat");
   696     QTest::addColumn<bool>("supportedPixelFormat");
   697     QTest::addColumn<bool>("supportedFormat");
   697     QTest::addColumn<bool>("supportedFormat");
   698 
   698 
   699     QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types;
   699     QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types;
       
   700 
       
   701 
   700 #ifndef QT_OPENGL_ES
   702 #ifndef QT_OPENGL_ES
   701     types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: "));
   703     types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: "));
   702 #endif
   704 #endif
   703     types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: "));
   705     types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: "));
   704 
   706 
   751                 << QAbstractVideoBuffer::NoHandle
   753                 << QAbstractVideoBuffer::NoHandle
   752                 << QVideoFrame::Format_RGB24
   754                 << QVideoFrame::Format_RGB24
   753                 << QSize(-1024, -768)
   755                 << QSize(-1024, -768)
   754                 << true
   756                 << true
   755                 << false;
   757                 << false;
       
   758 #ifndef Q_WS_MAC
   756         QTest::newRow((type.second + "YUV420P 640x480").constData())
   759         QTest::newRow((type.second + "YUV420P 640x480").constData())
   757                 << type.first
   760                 << type.first
   758                 << QAbstractVideoBuffer::NoHandle
   761                 << QAbstractVideoBuffer::NoHandle
   759                 << QVideoFrame::Format_YUV420P
   762                 << QVideoFrame::Format_YUV420P
   760                 << QSize(640, 480)
   763                 << QSize(640, 480)
   765                 << QAbstractVideoBuffer::NoHandle
   768                 << QAbstractVideoBuffer::NoHandle
   766                 << QVideoFrame::Format_YUV420P
   769                 << QVideoFrame::Format_YUV420P
   767                 << QSize(640, -480)
   770                 << QSize(640, -480)
   768                 << true
   771                 << true
   769                 << false;
   772                 << false;
       
   773 #endif
   770         QTest::newRow((type.second + "Y8 640x480").constData())
   774         QTest::newRow((type.second + "Y8 640x480").constData())
   771                 << type.first
   775                 << type.first
   772                 << QAbstractVideoBuffer::NoHandle
   776                 << QAbstractVideoBuffer::NoHandle
   773                 << QVideoFrame::Format_Y8
   777                 << QVideoFrame::Format_Y8
   774                 << QSize(640, 480)
   778                 << QSize(640, 480)
   786                 << QAbstractVideoBuffer::GLTextureHandle
   790                 << QAbstractVideoBuffer::GLTextureHandle
   787                 << QVideoFrame::Format_RGB32
   791                 << QVideoFrame::Format_RGB32
   788                 << QSize(-640, 480)
   792                 << QSize(-640, 480)
   789                 << true
   793                 << true
   790                 << false;
   794                 << false;
       
   795 #ifndef Q_WS_MAC
   791         QTest::newRow((type.second + "Texture: rgb565 32x32").constData())
   796         QTest::newRow((type.second + "Texture: rgb565 32x32").constData())
   792                 << type.first
   797                 << type.first
   793                 << QAbstractVideoBuffer::GLTextureHandle
   798                 << QAbstractVideoBuffer::GLTextureHandle
   794                 << QVideoFrame::Format_RGB565
   799                 << QVideoFrame::Format_RGB565
   795                 << QSize(32, 32)
   800                 << QSize(32, 32)
   800                 << QAbstractVideoBuffer::GLTextureHandle
   805                 << QAbstractVideoBuffer::GLTextureHandle
   801                 << QVideoFrame::Format_RGB565
   806                 << QVideoFrame::Format_RGB565
   802                 << QSize(0, 0)
   807                 << QSize(0, 0)
   803                 << false
   808                 << false
   804                 << false;
   809                 << false;
       
   810 #endif
   805         QTest::newRow((type.second + "Texture argb32 256x256").constData())
   811         QTest::newRow((type.second + "Texture argb32 256x256").constData())
   806                 << type.first
   812                 << type.first
   807                 << QAbstractVideoBuffer::GLTextureHandle
   813                 << QAbstractVideoBuffer::GLTextureHandle
   808                 << QVideoFrame::Format_ARGB32
   814                 << QVideoFrame::Format_ARGB32
   809                 << QSize(256, 256)
   815                 << QSize(256, 256)
   810                 << true
   816                 << true
   811                 << true;
   817                 << true;
       
   818 #ifndef Q_WS_MAC
   812         QTest::newRow((type.second + "Texture: rgb24 1024x768").constData())
   819         QTest::newRow((type.second + "Texture: rgb24 1024x768").constData())
   813                 << type.first
   820                 << type.first
   814                 << QAbstractVideoBuffer::GLTextureHandle
   821                 << QAbstractVideoBuffer::GLTextureHandle
   815                 << QVideoFrame::Format_RGB24
   822                 << QVideoFrame::Format_RGB24
   816                 << QSize(1024, 768)
   823                 << QSize(1024, 768)
   835                 << QAbstractVideoBuffer::GLTextureHandle
   842                 << QAbstractVideoBuffer::GLTextureHandle
   836                 << QVideoFrame::Format_YUV420P
   843                 << QVideoFrame::Format_YUV420P
   837                 << QSize(640, -480)
   844                 << QSize(640, -480)
   838                 << false
   845                 << false
   839                 << false;
   846                 << false;
       
   847 #endif
   840         QTest::newRow(type.second + "User Buffer: rgb32 256x256")
   848         QTest::newRow(type.second + "User Buffer: rgb32 256x256")
   841                 << type.first
   849                 << type.first
   842                 << QAbstractVideoBuffer::UserHandle
   850                 << QAbstractVideoBuffer::UserHandle
   843                 << QVideoFrame::Format_RGB32
   851                 << QVideoFrame::Format_RGB32
   844                 << QSize(256, 256)
   852                 << QSize(256, 256)
   925                 << QVideoFrame::Format_RGB565
   933                 << QVideoFrame::Format_RGB565
   926                 << QSize(2, 2)
   934                 << QSize(2, 2)
   927                 << static_cast<const uchar *>(rgb565ImageData)
   935                 << static_cast<const uchar *>(rgb565ImageData)
   928                 << int(sizeof(rgb565ImageData))
   936                 << int(sizeof(rgb565ImageData))
   929                 << 4;
   937                 << 4;
   930 
   938 #ifndef Q_WS_MAC
   931         QTest::newRow((type.second + "rgb32 -> yuv420p").constData())
   939         QTest::newRow((type.second + "rgb32 -> yuv420p").constData())
   932                 << type.first
   940                 << type.first
   933                 << QVideoFrame::Format_RGB32
   941                 << QVideoFrame::Format_RGB32
   934                 << QSize(2, 2)
   942                 << QSize(2, 2)
   935                 << static_cast<const uchar *>(rgb32ImageData)
   943                 << static_cast<const uchar *>(rgb32ImageData)
   951                 << QVideoFrame::Format_RGB32
   959                 << QVideoFrame::Format_RGB32
   952                 << QSize(2, 2)
   960                 << QSize(2, 2)
   953                 << static_cast<const uchar *>(rgb32ImageData)
   961                 << static_cast<const uchar *>(rgb32ImageData)
   954                 << int(sizeof(rgb32ImageData))
   962                 << int(sizeof(rgb32ImageData))
   955                 << 8;
   963                 << 8;
       
   964 #endif
   956     }
   965     }
   957 }
   966 }
   958 
   967 
   959 void tst_QPainterVideoSurface::shaderPresent()
   968 void tst_QPainterVideoSurface::shaderPresent()
   960 {
   969 {