aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/scenegraph/tst_scenegraph.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-10-22 12:05:18 +0200
committerLars Knoll <lars.knoll@qt.io>2017-10-22 12:26:28 +0200
commitaceb0d0cd2da89aebbf17729869b9e977290c826 (patch)
treeb29e815e32277710058bc32c571281937183fd43 /tests/auto/quick/scenegraph/tst_scenegraph.cpp
parent6ecbe6441f825489b5fafde1a274952933254c7f (diff)
parent1bb9c7b517e7995201d2a31cd1e852c02ad8c1bc (diff)
Merge remote-tracking branch 'origin/dev' into HEAD
Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4isel_moth_p.h src/qml/compiler/qv4ssa.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm_p.h src/qml/jit/qv4regalloc.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexp.cpp src/qml/jsruntime/qv4regexp_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp tests/auto/qml/qml.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp Change-Id: I1577e195c736f3414089036b957a01cb91a3ca23
Diffstat (limited to 'tests/auto/quick/scenegraph/tst_scenegraph.cpp')
-rw-r--r--tests/auto/quick/scenegraph/tst_scenegraph.cpp97
1 files changed, 57 insertions, 40 deletions
diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
index 2cd3a041c8..d8d9cd26e0 100644
--- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp
+++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
@@ -47,6 +47,9 @@
#include "../../shared/util.h"
#include "../shared/visualtestutil.h"
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformintegration.h>
+
using namespace QQuickVisualTestUtil;
class PerPixelRect : public QQuickItem
@@ -114,6 +117,7 @@ private slots:
private:
bool m_brokenMipmapSupport;
QQuickView *createView(const QString &file, QWindow *parent = 0, int x = -1, int y = -1, int w = -1, int h = -1);
+ bool isRunningOnOpenGL();
};
template <typename T> class ScopedList : public QList<T> {
@@ -131,38 +135,40 @@ void tst_SceneGraph::initTestCase()
qDebug() << "RenderLoop: " << loop;
#if QT_CONFIG(opengl)
- QOpenGLContext context;
- context.setFormat(loop->sceneGraphContext()->defaultSurfaceFormat());
- context.create();
- QSurfaceFormat format = context.format();
-
- QOffscreenSurface surface;
- surface.setFormat(format);
- surface.create();
- if (!context.makeCurrent(&surface))
- qFatal("Failed to create a GL context...");
-
- QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
- qDebug() << "R/G/B/A Buffers: " << format.redBufferSize() << format.greenBufferSize() << format.blueBufferSize() << format.alphaBufferSize();
- qDebug() << "Depth Buffer: " << format.depthBufferSize();
- qDebug() << "Stencil Buffer: " << format.stencilBufferSize();
- qDebug() << "Samples: " << format.samples();
- int textureSize;
- funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &textureSize);
- qDebug() << "Max Texture Size: " << textureSize;
- qDebug() << "GL_VENDOR: " << (const char *) funcs->glGetString(GL_VENDOR);
- qDebug() << "GL_RENDERER: " << (const char *) funcs->glGetString(GL_RENDERER);
- QByteArray version = (const char *) funcs->glGetString(GL_VERSION);
- qDebug() << "GL_VERSION: " << version.constData();
- QSet<QByteArray> exts = context.extensions();
- QByteArray all;
- foreach (const QByteArray &e, exts) all += ' ' + e;
- qDebug() << "GL_EXTENSIONS: " << all.constData();
-
- m_brokenMipmapSupport = version.contains("Mesa 10.1") || version.contains("Mesa 9.");
- qDebug() << "Broken Mipmap: " << m_brokenMipmapSupport;
-
- context.doneCurrent();
+ if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) {
+ QOpenGLContext context;
+ context.setFormat(loop->sceneGraphContext()->defaultSurfaceFormat());
+ context.create();
+ QSurfaceFormat format = context.format();
+
+ QOffscreenSurface surface;
+ surface.setFormat(format);
+ surface.create();
+ if (!context.makeCurrent(&surface))
+ qFatal("Failed to create a GL context...");
+
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ qDebug() << "R/G/B/A Buffers: " << format.redBufferSize() << format.greenBufferSize() << format.blueBufferSize() << format.alphaBufferSize();
+ qDebug() << "Depth Buffer: " << format.depthBufferSize();
+ qDebug() << "Stencil Buffer: " << format.stencilBufferSize();
+ qDebug() << "Samples: " << format.samples();
+ int textureSize;
+ funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &textureSize);
+ qDebug() << "Max Texture Size: " << textureSize;
+ qDebug() << "GL_VENDOR: " << (const char *) funcs->glGetString(GL_VENDOR);
+ qDebug() << "GL_RENDERER: " << (const char *) funcs->glGetString(GL_RENDERER);
+ QByteArray version = (const char *) funcs->glGetString(GL_VERSION);
+ qDebug() << "GL_VERSION: " << version.constData();
+ QSet<QByteArray> exts = context.extensions();
+ QByteArray all;
+ foreach (const QByteArray &e, exts) all += ' ' + e;
+ qDebug() << "GL_EXTENSIONS: " << all.constData();
+
+ m_brokenMipmapSupport = version.contains("Mesa 10.1") || version.contains("Mesa 9.");
+ qDebug() << "Broken Mipmap: " << m_brokenMipmapSupport;
+
+ context.doneCurrent();
+ }
#endif
}
@@ -231,6 +237,10 @@ public:
void tst_SceneGraph::manyWindows()
{
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms");
+
QFETCH(QString, file);
QFETCH(bool, toplevel);
QFETCH(bool, shared);
@@ -430,12 +440,8 @@ void tst_SceneGraph::render_data()
void tst_SceneGraph::render()
{
- QQuickView dummy;
- dummy.show();
- QTest::qWaitForWindowExposed(&dummy);
- if (dummy.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL)
+ if (!isRunningOnOpenGL())
QSKIP("Skipping complex rendering tests due to not running with OpenGL");
- dummy.hide();
QFETCH(QString, file);
QFETCH(QList<Sample>, baseStage);
@@ -485,6 +491,9 @@ void tst_SceneGraph::render()
// current on the other window.
void tst_SceneGraph::hideWithOtherContext()
{
+ if (!isRunningOnOpenGL())
+ QSKIP("Skipping OpenGL context test due to not running with OpenGL");
+
QWindow window;
window.setSurfaceType(QWindow::OpenGLSurface);
window.resize(100, 100);
@@ -500,9 +509,6 @@ void tst_SceneGraph::hideWithOtherContext()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL)
- QSKIP("Skipping OpenGL context test due to not running with OpenGL");
-
renderingOnMainThread = view.openglContext()->thread() == QGuiApplication::instance()->thread();
// Make the local context current on the local window...
@@ -549,6 +555,17 @@ void tst_SceneGraph::createTextureFromImage()
QCOMPARE(texture->hasAlphaChannel(), expectedAlpha);
}
+bool tst_SceneGraph::isRunningOnOpenGL()
+{
+ bool retval = false;
+ QQuickView dummy;
+ dummy.show();
+ QTest::qWaitForWindowExposed(&dummy);
+ if (dummy.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL)
+ retval = true;
+ dummy.hide();
+ return retval;
+}
#include "tst_scenegraph.moc"