summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/lancelot/tst_lancelot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/other/lancelot/tst_lancelot.cpp')
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp66
1 files changed, 63 insertions, 3 deletions
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index 8fc0521102..63c62bab86 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -53,7 +53,7 @@ private:
};
void setupTestSuite(const QStringList& blacklist = QStringList());
- void runTestSuite(GraphicsEngine engine, QImage::Format format);
+ void runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat = QSurfaceFormat());
void paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath);
QStringList qpsFiles;
@@ -69,6 +69,8 @@ private slots:
void testRasterARGB32PM();
void testRasterRGB32_data();
void testRasterRGB32();
+ void testRasterARGB32_data();
+ void testRasterARGB32();
void testRasterRGB16_data();
void testRasterRGB16();
void testRasterA2RGB30PM_data();
@@ -83,8 +85,11 @@ private slots:
#ifndef QT_NO_OPENGL
void testOpenGL_data();
void testOpenGL();
+ void testCoreOpenGL_data();
+ void testCoreOpenGL();
private:
bool checkSystemGLSupport();
+ bool checkSystemCoreGLSupport();
#endif
};
@@ -134,6 +139,17 @@ void tst_Lancelot::testRasterARGB32PM()
}
+void tst_Lancelot::testRasterARGB32_data()
+{
+ setupTestSuite();
+}
+
+void tst_Lancelot::testRasterARGB32()
+{
+ runTestSuite(Raster, QImage::Format_ARGB32);
+}
+
+
void tst_Lancelot::testRasterRGB32_data()
{
setupTestSuite();
@@ -223,6 +239,32 @@ bool tst_Lancelot::checkSystemGLSupport()
return true;
}
+bool tst_Lancelot::checkSystemCoreGLSupport()
+{
+ if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL)
+ return false;
+
+ QSurfaceFormat coreFormat;
+ coreFormat.setVersion(3, 2);
+ coreFormat.setProfile(QSurfaceFormat::CoreProfile);
+ QWindow win;
+ win.setSurfaceType(QSurface::OpenGLSurface);
+ win.setFormat(coreFormat);
+ win.create();
+ QOpenGLFramebufferObjectFormat fmt;
+ fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
+ fmt.setSamples(4);
+ QOpenGLContext ctx;
+ ctx.setFormat(coreFormat);
+ if (!ctx.create() || !ctx.makeCurrent(&win))
+ return false;
+ QOpenGLFramebufferObject fbo(800, 800, fmt);
+ if (!fbo.isValid() || !fbo.bind())
+ return false;
+
+ return true;
+}
+
void tst_Lancelot::testOpenGL_data()
{
if (!checkSystemGLSupport())
@@ -236,6 +278,22 @@ void tst_Lancelot::testOpenGL()
{
runTestSuite(OpenGL, QImage::Format_RGB32);
}
+
+void tst_Lancelot::testCoreOpenGL_data()
+{
+ if (!checkSystemCoreGLSupport())
+ QSKIP("System under test does not meet preconditions for Core Profile GL testing. Skipping.");
+ QStringList localBlacklist = QStringList() << QLatin1String("rasterops.qps");
+ setupTestSuite(localBlacklist);
+}
+
+void tst_Lancelot::testCoreOpenGL()
+{
+ QSurfaceFormat coreFormat;
+ coreFormat.setVersion(3, 2);
+ coreFormat.setProfile(QSurfaceFormat::CoreProfile);
+ runTestSuite(OpenGL, QImage::Format_RGB32, coreFormat);
+}
#endif
@@ -250,7 +308,7 @@ void tst_Lancelot::setupTestSuite(const QStringList& blacklist)
}
-void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format)
+void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat)
{
QFETCH(QString, qpsFile);
@@ -266,11 +324,13 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format)
} else if (engine == OpenGL) {
QWindow win;
win.setSurfaceType(QSurface::OpenGLSurface);
+ win.setFormat(contextFormat);
win.create();
QOpenGLFramebufferObjectFormat fmt;
fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
fmt.setSamples(4);
QOpenGLContext ctx;
+ ctx.setFormat(contextFormat);
QVERIFY(ctx.create());
QVERIFY(ctx.makeCurrent(&win));
QOpenGLFramebufferObject fbo(800, 800, fmt);
@@ -291,7 +351,7 @@ void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, const QStr
//pcmd.setShouldDrawText(false);
switch (engine) {
case OpenGL:
- pcmd.setType(OpenGLBufferType);
+ pcmd.setType(OpenGLBufferType); // version/profile is communicated through the context's format()
break;
case Raster: // fallthrough
default: