Bug 469342

Summary: Set QT_QPA_PLATFORM=offscreen for gui test to pass when packaging it
Product: [Applications] kronometer Reporter: andreamtp+bz
Component: generalAssignee: Elvis Angelaccio <elvis.angelaccio>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description andreamtp+bz 2023-05-04 08:26:13 UTC
While packaging the tool in rpm format - action that happen in a linux namespace - the gui test fails because it cannot connect to a display. 
Setting QT_QPA_PLATFORM=offscreen let the test to pass

STEPS TO REPRODUCE
[interactive into the namespace]
<mock-chroot> bash-5.2$ cd redhat-linux-build/autotests
<mock-chroot> bash-5.2$ make
<mock-chroot> bash-5.2$ ./testtimedisplay
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

OBSERVED RESULT
<mock-chroot> bash-5.2$ ./testtimedisplay
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

EXPECTED RESULT / RESOLUTION
<mock-chroot> bash-5.2$ export QT_QPA_PLATFORM=offscreen
<mock-chroot> bash-5.2$ ./testtimedisplay 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-mockbuild'
********* Start testing of TestTimeDisplay *********
Config: Using QtTest library 5.15.9, Qt 5.15.9 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 13.0.1 20230401 (Red Hat 13.0.1-0)), fedora 38
PASS   : TestTimeDisplay::initTestCase()
QWARN  : TestTimeDisplay::testDefaultWidget() kf.i18n: KLocalizedString: Using an empty domain, fix the code. msgid: "Hours" msgid_plural: "" msgctxt: "@title:column"
[...]
Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted, 5ms
********* Finished testing of TestTimeDisplay *********


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 38
(available in About System)
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION