Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-106617

qmltestrunner is incompatible with QML WebEngineView in Qt6 [REG 5.15.x->6.3.x]

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.3.1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      OS: Debian GNU/Linux 11
      Architecture: x86_64;
    • Platform/s:
      All

      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.

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            qqute Hobbyistor Mr
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes