diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-10 09:26:52 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-11 22:23:50 +0200 |
commit | 132e2fb2bf28c6aa3c1598deecf4d723f83396ec (patch) | |
tree | 805c55e6e49b2b05500b5ecf1f563fdf15e068be /tests/auto/quick/scenegraph | |
parent | 2cb24f7054e1105be0dcb1a4d61a5b52d62d1a55 (diff) |
Make openglContext getter in QQuickWindow private
Fix up the scenegraph and qquickwindow autotests as well. (direct OpenGL
specifics are now completely removed from both, i.e. the remaning OpenGL
specific tests are now run (and not skipped) with OpenGL-on-RHI)
[ChangeLog][Qt Quick][QQuickWindow] openglContext() has been removed
from QQuickWindow. Use QSGRendererInterface to query the QOpenGLContext.
Change-Id: If5c9802b71ac5f9cffc695827e286eb2a2d03580
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/auto/quick/scenegraph')
-rw-r--r-- | tests/auto/quick/scenegraph/tst_scenegraph.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index 34e2630019..8e79f89dc6 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -118,7 +118,6 @@ private slots: private: QQuickView *createView(const QString &file, QWindow *parent = nullptr, int x = -1, int y = -1, int w = -1, int h = -1); - bool isRunningOnOpenGLDirectly(); bool isRunningOnRhi(); }; @@ -411,8 +410,8 @@ void tst_SceneGraph::render_data() void tst_SceneGraph::render() { - if (!isRunningOnOpenGLDirectly() && !isRunningOnRhi()) - QSKIP("Skipping complex rendering tests due to not running with OpenGL or QRhi"); + if (!isRunningOnRhi()) + QSKIP("Skipping complex rendering tests due to not running with QRhi"); QFETCH(QString, file); QFETCH(QList<Sample>, baseStage); @@ -462,8 +461,8 @@ void tst_SceneGraph::render() // current on the other window. void tst_SceneGraph::hideWithOtherContext() { - if (!isRunningOnOpenGLDirectly()) - QSKIP("Skipping OpenGL context test due to not running with OpenGL"); + if (!isRunningOnRhi()) + QSKIP("Skipping OpenGL context test due to not running with QRhi"); QWindow window; window.setSurfaceType(QWindow::OpenGLSurface); @@ -480,7 +479,12 @@ void tst_SceneGraph::hideWithOtherContext() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - renderingOnMainThread = view.openglContext()->thread() == QGuiApplication::instance()->thread(); + if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGLRhi) + QSKIP("Skipping OpenGL context test due to not using OpenGL"); + + QOpenGLContext *ctx = static_cast<QOpenGLContext *>(view.rendererInterface()->getResource( + &view, QSGRendererInterface::OpenGLContextResource)); + renderingOnMainThread = ctx->thread() == QGuiApplication::instance()->thread(); // Make the local context current on the local window... context.makeCurrent(&window); @@ -526,21 +530,6 @@ void tst_SceneGraph::createTextureFromImage() QCOMPARE(texture->hasAlphaChannel(), expectedAlpha); } -bool tst_SceneGraph::isRunningOnOpenGLDirectly() -{ - static bool retval = false; - static bool decided = false; - if (!decided) { - decided = true; - QQuickView dummy; - dummy.show(); - if (QTest::qWaitForWindowExposed(&dummy)) - retval = dummy.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL; - dummy.hide(); - } - return retval; -} - bool tst_SceneGraph::isRunningOnRhi() { static bool retval = false; |