summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authoraavit <eirik.aavitsland@digia.com>2012-10-29 10:34:20 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-09 16:07:44 +0100
commitf4a8e940eda1904ed2fba247c1d2752106ccc5c9 (patch)
tree9121c2b03d70591c1345379a3dad75298df31923 /tests/manual
parent6dffbccbf3045d928ffcc3af0d2c659c1a3b8b1f (diff)
Qt5 updates to the QPainter lancelot autotest
a) Use the new Qt5 OpenGL API for testing of GL painting b) Simplify: Use the higher-level QBaselineTest API instead of the low-level baselineprotocol API. Change-Id: Ib5f47f6fe68837dfdc8dc3a74638c5cb0b724614 Reviewed-by: aavit <eirik.aavitsland@digia.com>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/lance/main.cpp31
-rw-r--r--tests/manual/lance/widgets.h4
2 files changed, 26 insertions, 9 deletions
diff --git a/tests/manual/lance/main.cpp b/tests/manual/lance/main.cpp
index c44710620f..97197f0509 100644
--- a/tests/manual/lance/main.cpp
+++ b/tests/manual/lance/main.cpp
@@ -102,8 +102,8 @@ static void printHelp()
" -imagemono Paints the files to a monochrome image\n"
" -imagewidget same as image, but with interacion...\n"
#ifndef QT_NO_OPENGL
- " -opengl Paints the files to an OpenGL on screen\n"
- " -pbuffer Paints the files to an OpenGL pbuffer\n"
+ " -opengl Paints the files to a QGLWidget (Qt4 style) on screen\n"
+ " -glbuffer Paints the files to a QOpenGLFrameBufferObject (Qt5 style) \n"
#endif
#ifdef USE_CUSTOM_DEVICE
" -customdevice Paints the files to the custom paint device\n"
@@ -289,8 +289,8 @@ int main(int argc, char **argv)
#ifndef QT_NO_OPENGL
else if (option == "opengl")
type = OpenGLType;
- else if (option == "pbuffer")
- type = OpenGLPBufferType;
+ else if (option == "glbuffer")
+ type = OpenGLBufferType;
#endif
#ifdef USE_CUSTOM_DEVICE
else if (option == "customdevice")
@@ -424,16 +424,28 @@ int main(int argc, char **argv)
}
#ifndef QT_NO_OPENGL
- case OpenGLPBufferType:
+ case OpenGLBufferType:
{
- QGLPixelBuffer pbuffer(QSize(width, height));
- QPainter pt(&pbuffer);
+ QWindow win;
+ win.setSurfaceType(QSurface::OpenGLSurface);
+ win.create();
+ QOpenGLFramebufferObjectFormat fmt;
+ fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
+ fmt.setSamples(4);
+ QOpenGLContext ctx;
+ ctx.create();
+ ctx.makeCurrent(&win);
+ QOpenGLFramebufferObject fbo(width, height, fmt);
+ fbo.bind();
+ QOpenGLPaintDevice pdev(width, height);
+
+ QPainter pt(&pdev);
pcmd.setPainter(&pt);
pcmd.setFilePath(fileinfo.absolutePath());
pcmd.runCommands();
pt.end();
- QImage image = pbuffer.toImage();
+ QImage image = fbo.toImage();
QLabel *label = createLabel();
label->setPixmap(QPixmap::fromImage(image));
@@ -456,8 +468,11 @@ int main(int argc, char **argv)
}
#else
case OpenGLType:
+ case OpenGLBufferType:
+ {
printf("OpenGL type not supported in this Qt build\n");
break;
+ }
#endif
#ifdef USE_CUSTOM_DEVICE
case CustomDeviceType:
diff --git a/tests/manual/lance/widgets.h b/tests/manual/lance/widgets.h
index 3d2d92d56c..e5e21f4b35 100644
--- a/tests/manual/lance/widgets.h
+++ b/tests/manual/lance/widgets.h
@@ -231,11 +231,13 @@ public:
}
}
}
-
+#if 0
+ // ### TBD: Make this work with Qt5
if (m_render_view.isNull()) {
m_render_view = QPixmap::grabWidget(this);
m_render_view.save("renderView.png");
}
+#endif
}
void paintBaselineView() {