Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.3.1
-
None
-
OS: Debian GNU/Linux 11
Architecture: x86_64;
Description
It seems that in Qt6 qmltestrunner doesn't have an option to initialize the QtWebEngine, so one cannot test the WebEngineView QML components with it. The Qt5 version works.
1. Create WebView item with WebEngineView
WebViewTest.qml:
import QtQuick import QtWebEngine WebView { id: webView anchors.fill: parent WebEngineView { id: webEngineView x: parent.x y: parent.y width: parent.width height: parent.height } }
2. Add a test case consuming the WebView then run it using qmltestrunner
tst_WebViewTest.qml
import QtQuick import QtTest Item { width: 800; height: 600; WebViewTest { id: webViewTest } TestCase { name: "testCase1" when: windowShown function test_shown(){ tryVerify(() => webViewTest.visible === true) } } }
$ /usr/local/Qt6.3.1/bin/qmltestrunner -platform vnc -input tst_WebViewTest.qml
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime'
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute and QSGRendererInterface::OpenGLRhi using QQuickWindow::setGraphicsApi before constructing QGuiApplication.
Segmentation fault (core dumped)
^
- Looks like a regression in Qt6 (tested in v6.3.1 though not tested in v6.2.x)
- It can be circumvented by creating a custom Qt Quick Test application with a setup that sets the requested attributes by the WebEngine.