summaryrefslogtreecommitdiffstats
path: root/tests/auto/unit
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2019-02-12 15:46:45 +0100
committerLiang Qi <liang.qi@qt.io>2019-02-14 07:23:25 +0000
commit7dc8468682e88dd218a6a7c424d666c3c834227c (patch)
tree420cdeee310cc842e627c0a1b67650e50872e682 /tests/auto/unit
parent0eef4ec9e306e4bdab5914d9c8ab3c2d12cc913c (diff)
Fix QPainterVideoSurface test to respect libGLES
To reproduce: set QT_OPENGL=angle Reverts d662241bfeffc3bc36ad812393cfc8bf706f863d and 0eef4ec9e306e4bdab5914d9c8ab3c2d12cc913c Task-number: QTBUG-73755 Change-Id: I403064b557b7c3650b9879b10241ac68b7457b27 Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests/auto/unit')
-rw-r--r--tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp86
1 files changed, 45 insertions, 41 deletions
diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
index 0bc3148d2..43dc52022 100644
--- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
@@ -74,6 +74,8 @@ private slots:
void shaderPresentGLFrame_data();
void shaderPresentGLFrame();
#endif
+private:
+ bool m_libGL = QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL;
};
Q_DECLARE_METATYPE(const uchar *)
@@ -212,9 +214,9 @@ void tst_QPainterVideoSurface::supportedFormat_data()
<< QAbstractVideoBuffer::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(1024, 768)
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
- << true
- << true;
+#if !defined(QT_OPENGL_ES)
+ << m_libGL
+ << m_libGL;
#else
<< false
<< false;
@@ -223,8 +225,8 @@ void tst_QPainterVideoSurface::supportedFormat_data()
<< QAbstractVideoBuffer::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(-1024, -768)
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
- << true
+#if !defined(QT_OPENGL_ES)
+ << m_libGL
#else
<< false
#endif
@@ -374,18 +376,19 @@ void tst_QPainterVideoSurface::present_data()
<< int(sizeof(argb32ImageData))
<< 8;
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
- QTest::newRow("rgb32 -> rgb24")
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8
- << QVideoFrame::Format_RGB24
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb24ImageData)
- << int(sizeof(rgb24ImageData))
- << 8;
+#if !defined(QT_OPENGL_ES)
+ if (m_libGL)
+ QTest::newRow("rgb32 -> rgb24")
+ << QVideoFrame::Format_RGB32
+ << QSize(2, 2)
+ << static_cast<const uchar *>(rgb32ImageData)
+ << int(sizeof(rgb32ImageData))
+ << 8
+ << QVideoFrame::Format_RGB24
+ << QSize(2, 2)
+ << static_cast<const uchar *>(rgb24ImageData)
+ << int(sizeof(rgb24ImageData))
+ << 8;
#endif
QTest::newRow("rgb32 -> rgb565")
@@ -400,18 +403,19 @@ void tst_QPainterVideoSurface::present_data()
<< int(sizeof(rgb565ImageData))
<< 4;
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
- QTest::newRow("rgb24 -> rgb565")
- << QVideoFrame::Format_RGB24
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb24ImageData)
- << int(sizeof(rgb24ImageData))
- << 8
- << QVideoFrame::Format_RGB565
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb565ImageData)
- << int(sizeof(rgb565ImageData))
- << 4;
+#if !defined(QT_OPENGL_ES)
+ if (m_libGL)
+ QTest::newRow("rgb24 -> rgb565")
+ << QVideoFrame::Format_RGB24
+ << QSize(2, 2)
+ << static_cast<const uchar *>(rgb24ImageData)
+ << int(sizeof(rgb24ImageData))
+ << 8
+ << QVideoFrame::Format_RGB565
+ << QSize(2, 2)
+ << static_cast<const uchar *>(rgb565ImageData)
+ << int(sizeof(rgb565ImageData))
+ << 4;
#endif
}
@@ -580,7 +584,7 @@ void tst_QPainterVideoSurface::shaderType()
QCOMPARE(spy.count(), 0);
}
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
+#if !defined(QT_OPENGL_ES)
if (surface.supportedShaderTypes() & QPainterVideoSurface::FragmentProgramShader) {
QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
@@ -625,7 +629,7 @@ void tst_QPainterVideoSurface::shaderType()
QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
QCOMPARE(spy.count(), 0);
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
+#if !defined(QT_OPENGL_ES)
surface.setShaderType(QPainterVideoSurface::FragmentProgramShader);
QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
QCOMPARE(spy.count(), 0);
@@ -641,7 +645,7 @@ void tst_QPainterVideoSurface::shaderTypeStarted_data()
{
QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
+#if !defined(QT_OPENGL_ES)
QTest::newRow("ARBfp")
<< QPainterVideoSurface::FragmentProgramShader;
#endif
@@ -729,7 +733,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types;
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
+#if !defined(QT_OPENGL_ES)
types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: "));
#endif
types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: "));
@@ -776,9 +780,9 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
<< QAbstractVideoBuffer::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(1024, 768)
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
- << true
- << true;
+#if !defined(QT_OPENGL_ES)
+ << m_libGL
+ << m_libGL;
#else
<< false
<< false;
@@ -788,8 +792,8 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
<< QAbstractVideoBuffer::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(-1024, -768)
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
- << true
+#if !defined(QT_OPENGL_ES)
+ << m_libGL
#else
<< false
#endif
@@ -949,7 +953,7 @@ void tst_QPainterVideoSurface::shaderPresent_data()
QTest::addColumn<int>("bytesPerLineB");
QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types;
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
+#if !defined(QT_OPENGL_ES)
types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: "));
#endif
types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: "));
@@ -1149,7 +1153,7 @@ void tst_QPainterVideoSurface::shaderPresentOpaqueFrame_data()
{
QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
+#if !defined(QT_OPENGL_ES)
QTest::newRow("ARBfp")
<< QPainterVideoSurface::FragmentProgramShader;
#endif
@@ -1203,7 +1207,7 @@ void tst_QPainterVideoSurface::shaderPresentGLFrame_data()
{
QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
-#if !defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2)
+#if !defined(QT_OPENGL_ES)
QTest::newRow("ARBfp")
<< QPainterVideoSurface::FragmentProgramShader;
#endif