STEPS TO REPRODUCE 1. compile alkimia on Linux 2. run DISPLAY=: make test OBSERVED RESULT The tests complain that an x server is required. EXPECTED RESULT The automatic tests should not depend on the presence of an X server SOFTWARE/OS VERSIONS Linux/KDE Plasma: openSUSE_Leap_15.1 (available in About System) KDE Frameworks Version: 5.55 Qt Version: 5.11
With alkonlinequotetest/KF5 configured with the use of QWebEngine and without X-display I get at execution: QWARN : AlkOnlineQuoteTest::testLaunchWebKit() WebEngine compiled with X11 support, however qpa backend is not xcb. This may fail. QWARN : AlkOnlineQuoteTest::testLaunchWebKit() QObject::connect: Cannot connect (null)::destroyed(QObject*) to QOffscreenSurface::screenDestroyed(QObject*) KCrash: Application 'alkonlinequotestest' crashing... Executable is: "/root/src/alkimia-master-build/bin/alkonlinequotestest"
> KCrash: Application 'alkonlinequotestest' crashing.. (gdb) bt #0 QOffscreenSurface::create (this=this@entry=0x65dcc0) at kernel/qoffscreensurface.cpp:182 #1 0x00007ffff15613f8 in (anonymous namespace)::openGLVendor () at /usr/src/debug/libqt5-qtwebengine-5.9.7-lp151.1.42.x86_64/src/core/web_engine_context.cpp:184 #2 QtWebEngineCore::WebEngineContext::WebEngineContext (this=0x67de80) at /usr/src/debug/libqt5-qtwebengine-5.9.7-lp151.1.42.x86_64/src/core/web_engine_context.cpp:429 #3 0x00007ffff1562585 in QtWebEngineCore::WebEngineContext::current () at /usr/src/debug/libqt5-qtwebengine-5.9.7-lp151.1.42.x86_64/src/core/web_engine_context.cpp:272 #4 0x00007ffff1550e8d in QtWebEngineCore::WebContentsAdapterPrivate::WebContentsAdapterPrivate (this=0x665d20) at /usr/src/debug/libqt5-qtwebengine-5.9.7-lp151.1.42.x86_64/src/core/web_contents_adapter.cpp:353 #5 0x00007ffff15511be in QtWebEngineCore::WebContentsAdapter::WebContentsAdapter (this=0x67e430, webContents=0x0) at /usr/src/debug/libqt5-qtwebengine-5.9.7-lp151.1.42.x86_64/src/core/web_contents_adapter.cpp:392 #6 0x00007ffff74a1091 in QSharedPointer<QtWebEngineCore::WebContentsAdapter>::create<>() () at /usr/include/qt5/QtCore/qsharedpointer_impl.h:442 #7 QWebEnginePagePrivate::QWebEnginePagePrivate (this=0x68e0a0, _profile=0x0) at api/qwebenginepage.cpp:242 #8 0x00007ffff74a1c04 in QWebEnginePage::QWebEnginePage (this=0x67cf60, parent=<optimized out>) at api/qwebenginepage.cpp:700 #9 0x00007ffff7bc0fb0 in AlkWebPage::AlkWebPage(QObject*) () from ~/src/alkimia-master-build/bin/libalkimia5.so.8 #10 0x00007ffff7bba753 in AlkOnlineQuotesProfileManager::webPage() () from ~/src/alkimia-master-build/bin/libalkimia5.so.8 #11 0x00007ffff7bad1a9 in AlkOnlineQuote::Private::launchWebKitHtmlParser(QString const&, QString const&, QString const&) () from ~/src/alkimia-master-build/bin/libalkimia5.so.8 #12 0x00007ffff7baf924 in AlkOnlineQuote::launch(QString const&, QString const&, QString const&) () from ~/src/alkimia-master-build/bin/libalkimia5.so.8 #13 0x000000000040657e in AlkOnlineQuoteTest::testLaunchWebKit() () #14 0x0000000000408b9e in AlkOnlineQuoteTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () #15 0x00007fffebf496d3 in QMetaMethod::invoke (this=<optimized out>, object=0x7fffffffe090, connectionType=connectionType@entry=Qt::DirectConnection, returnValue=..., val0=..., val1=..., val2=..., val3=..., val4=..., val5=..., val6=..., val7=..., val8=..., val9=...) at kernel/qmetaobject.cpp:2222 #16 0x00007ffff797401a in QMetaMethod::invoke (val9=..., val8=..., val7=..., val6=..., val5=..., val4=..., val3=..., val2=..., val1=..., val0=..., connectionType=Qt::DirectConnection, object=<optimized out>, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qmetaobject.h:123 #17 QTest::TestMethods::invokeTestOnData (this=this@entry=0x7fffffffdfd0, index=index@entry=2) at qtestcase.cpp:888 #18 0x00007ffff7974d70 in QTest::TestMethods::invokeTest (this=this@entry=0x7fffffffdfd0, index=index@entry=2, data=data@entry=0x0, watchDog=watchDog@entry=0x0) at qtestcase.cpp:1069 #19 0x00007ffff79752e1 in QTest::TestMethods::invokeTests (this=this@entry=0x7fffffffdfd0, testObject=testObject@entry=0x7fffffffe090) at qtestcase.cpp:1376 #20 0x00007ffff79758ab in QTest::qExec (testObject=0x7fffffffe090, argc=<optimized out>, argv=0x7fffffffe1b8) at qtestcase.cpp:1797 #21 0x0000000000405edd in main ()
One of the reason for this is that the usage of QTEST_MAIN() in the test case source results into generating a gui application depending on a graphical display.
Git commit 1507ef16f01c83b0164446573aeb5fbd3a3828d5 by Ralf Habacker. Committed on 11/11/2020 at 20:46. Pushed by habacker into branch '8.0'. Generate autotests, which do not require a graphical display, as command line app M +3 -3 autotests/alkcompanytest.cpp M +3 -3 autotests/alkdateformattest.cpp M +2 -2 autotests/alkexceptiontest.cpp M +2 -3 autotests/alkonlinequotesourcetest.cpp M +3 -3 autotests/alkquoteitemtest.cpp M +2 -3 autotests/alkvaluetest.cpp A +16 -0 autotests/test.h * The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page. https://invent.kde.org/office/alkimia/commit/1507ef16f01c83b0164446573aeb5fbd3a3828d5
Another issue is that in the native launch mode, kio wants to create a downlod ui dialog QDEBUG : AlkOnlineQuoteTest::testLaunch() alkonlinequotestest(6255)/kio (KIOJob) KIO::SlaveInterface::dispatch: needs a msg box QFATAL : AlkOnlineQuoteTest::testLaunch() QWidget: Cannot create a QWidget when no GUI is being used
The ALkOnlineQuote class currently uses the KDE framework library KIO to fetch files from remote locations, which requires a GUI. A possible solution would be to use the corresponding classes of the QtNetwork module in the ALkOnlineQuote class, which does not have this dependency.
(In reply to Ralf Habacker from comment #6) > The ALkOnlineQuote class currently uses the KDE framework library KIO to > fetch files from remote locations, which requires a GUI. A possible solution > would be to use the corresponding classes of the QtNetwork module in the > ALkOnlineQuote class, which does not have this dependency. Unfortunately, this change does not solve the problem yet, because the framework library KNewStuff depends on KIOWidgets and KIOCore library.