Bug 459337

Summary: Some tests fail when built statically
Product: [Frameworks and Libraries] frameworks-kconfig Reporter: Dawid Wróbel <me>
Component: generalAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: alexander.lohnau, kdelibs-bugs-null, vkrause
Priority: NOR    
Version First Reported In: 5.68.0   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Dawid Wróbel 2022-09-18 16:33:58 UTC
SUMMARY

See the pipeline run for a complete log:
https://invent.kde.org/frameworks/kconfig/-/jobs/484432
Comment 1 Dawid Wróbel 2022-09-20 12:27:15 UTC
The error reported is:

QWARN  : KConfigTest::initTestCase() kf.config.core: KConfigGroup::writeEntry was passed GUI type ' QColor ' but KConfigGui isn't linked! If it is linked to your program, this is a platform bug. Please inform the KDE developers
QWARN  : KConfigTest::initTestCase() kf.config.core: KConfigGroup::writeEntry was passed GUI type ' QColor ' but KConfigGui isn't linked! If it is linked to your program, this is a platform bug. Please inform the KDE developers
QWARN  : KConfigTest::initTestCase() kf.config.core: KConfigGroup::writeEntry was passed GUI type ' QFont ' but KConfigGui isn't linked! If it is linked to your program, this is a platform bug. Please inform the KDE developers
PASS   : KConfigTest::initTestCase()
QWARN  : KConfigTest::testComplex() kf.config.core: KConfigGroup::readEntry was passed GUI type ' QColor ' but KConfigGui isn't linked! If it is linked to your program, this is a platform bug. Please inform the KDE developers
QWARN  : KConfigTest::testComplex() kf.config.core: unhandled type  QColor
FAIL!  : KConfigTest::testComplex() Compared values are not the same
   Actual   (QVariant(sc3.readEntry("colorEntry1", QColor(Qt::black))).toString()): "#000000"
   Expected (QVariant(s_color_entry1).toString())                                 : "#4682b4"
   Loc: [/builds/frameworks/kconfig/autotests/kconfigguitest.cpp(80)]


The important bits are:
kf.config.core: KConfigGroup::writeEntry was passed GUI type ' QColor '/'QFont'
kf.config.core: unhandled type  QColor/QFont
Comment 2 Volker Krause 2022-09-24 15:25:21 UTC
This is due to `initKConfigGroupGui()` in kconfiggroupgui.cpp not being called when building statically, forcing that by manually calling it from the test fixes it.
Comment 3 Volker Krause 2022-09-25 10:13:51 UTC
I'm not finding a way to do this without explicit API, not even with just one compiler, let alone portable.
Comment 4 Bug Janitor Service 2022-10-17 16:05:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kconfig/-/merge_requests/145
Comment 5 Alexander Lohnau 2022-10-18 10:42:29 UTC
Git commit d6173cee8d62b241672d98abe9dd6515d2049336 by Alexander Lohnau.
Committed on 17/10/2022 at 16:02.
Pushed by alex into branch 'master'.

Fix KConfigGui initialization in case of static builds

This way we ensure that the symbols land in the actual executable and
thus we call the KConfigGui method.

M  +8    -0    src/gui/CMakeLists.txt
M  +2    -1    src/gui/kconfiggroupgui.cpp
A  +6    -0    src/gui/kconfigguistaticinitializer.cpp     [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)]

https://invent.kde.org/frameworks/kconfig/commit/d6173cee8d62b241672d98abe9dd6515d2049336