MailJDTourDownloadDocsQualityTestsCoverage

Which source lines and branches the tests execute. Lines 91.5 %, branches 75.0 % (minimum 85 % and 72 %). main @ 399ffe3d · 21 October 2026 · pipeline 7238.

GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 55.9% 19 / 0 / 34
Functions: 100.0% 1 / 0 / 1
Branches: 34.5% 20 / 0 / 58

quick/DesktopActivation.cpp
Line Branch Exec Source
1 #include "DesktopActivation.h"
2
3 #include "service/DesktopIntegration.h"
4
5 #include <QQuickWindow>
6
7 #ifdef MAILJD_HAVE_KWINDOWSYSTEM
8 #include <KWindowSystem>
9 #ifdef MAILJD_KWS_HAS_SET_STARTUP_ID
10 #include <KStartupInfo>
11 #endif
12 #endif
13
14 namespace DesktopActivation {
15
16 17 bool activateWindow(QQuickWindow *window, const QString &activationToken) {
17
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 17 times.
17 if (!window) return false;
18 // Restoring visibility is separate from claiming compositor focus.
19
2/2
✓ Branch 5 → 6 taken 1 time.
✓ Branch 5 → 7 taken 16 times.
17 if (window->visibility() == QWindow::Minimized)
20 1 window->showNormal();
21
2/2
✓ Branch 8 → 9 taken 6 times.
✓ Branch 8 → 10 taken 10 times.
16 else if (!window->isVisible())
22 6 window->show();
23 17 window->raise();
24
25 17 const bool wayland = DesktopIntegration::isWaylandSession();
26 17 bool activationAuthorized = !wayland;
27 17 bool platformTokenInstalled = false;
28
29 #ifdef MAILJD_HAVE_KWINDOWSYSTEM
30
1/2
✓ Branch 13 → 14 taken 17 times.
✗ Branch 13 → 54 not taken.
17 if (DesktopIntegration::current().kdeWindowActivation) {
31 #ifdef MAILJD_KWS_HAS_UPDATE_STARTUP_ID
32
1/2
✓ Branch 15 → 16 taken 17 times.
✗ Branch 15 → 23 not taken.
34 if (activationToken.isEmpty() &&
33
3/7
✓ Branch 16 → 17 taken 17 times.
✓ Branch 18 → 19 taken 17 times.
✗ Branch 18 → 22 not taken.
✗ Branch 28 → 29 not taken.
✓ Branch 28 → 31 taken 17 times.
✗ Branch 76 → 77 not taken.
✗ Branch 76 → 78 not taken.
34 (!qgetenv("XDG_ACTIVATION_TOKEN").isEmpty() ||
34
4/9
✓ Branch 19 → 20 taken 17 times.
✗ Branch 21 → 22 not taken.
✓ Branch 21 → 23 taken 17 times.
✓ Branch 24 → 25 taken 17 times.
✗ Branch 24 → 26 not taken.
✓ Branch 26 → 27 taken 17 times.
✗ Branch 26 → 28 not taken.
✗ Branch 72 → 73 not taken.
✗ Branch 72 → 74 not taken.
34 !qgetenv("DESKTOP_STARTUP_ID").isEmpty())) {
35 ✗ KWindowSystem::updateStartupId(window);
36 ✗ platformTokenInstalled = true;
37 ✗ activationAuthorized = true;
38 }
39 #endif
40 #ifdef MAILJD_KWS_HAS_SET_STARTUP_ID
41
3/6
✓ Branch 31 → 32 taken 17 times.
✗ Branch 31 → 35 not taken.
✗ Branch 33 → 34 not taken.
✓ Branch 33 → 35 taken 17 times.
✗ Branch 36 → 37 not taken.
✓ Branch 36 → 41 taken 17 times.
17 if (!wayland && !activationToken.isEmpty()) {
42 ✗ KStartupInfo::setNewStartupId(window, activationToken.toUtf8());
43 ✗ platformTokenInstalled = true;
44 }
45 #endif
46 #ifdef MAILJD_KWS_HAS_XDG_ACTIVATION_TOKEN
47
2/6
✗ Branch 41 → 42 not taken.
✓ Branch 41 → 45 taken 17 times.
✗ Branch 43 → 44 not taken.
✗ Branch 43 → 45 not taken.
✗ Branch 46 → 47 not taken.
✓ Branch 46 → 49 taken 17 times.
17 if (wayland && !activationToken.isEmpty()) {
48 ✗ KWindowSystem::setCurrentXdgActivationToken(activationToken);
49 ✗ activationAuthorized = true;
50 ✗ platformTokenInstalled = true;
51 }
52 #endif
53
1/4
✗ Branch 49 → 50 not taken.
✓ Branch 49 → 52 taken 17 times.
✗ Branch 50 → 51 not taken.
✗ Branch 50 → 52 not taken.
17 if (wayland && !activationAuthorized) {
54 // The window is revealed, but a tokenless focus request would be
55 // silently denied by the compositor - report that honestly. (The
56 // widgets build could demand attention via QApplication::alert;
57 // a pure QQuickWindow has no equivalent.)
58 ✗ return false;
59 }
60 #ifdef MAILJD_KWS_HAS_REQUEST_ACTIVATE
61 KWindowSystem::requestActivateWindow(window);
62 #else
63 17 KWindowSystem::activateWindow(window);
64 #endif
65 17 return true;
66 }
67 #endif
68
69 // S106-362: without KWindowSystem (or with its activation switched off)
70 // Qt's Wayland plugin takes the token from XDG_ACTIVATION_TOKEN when the
71 // window requests activation; a forwarded token used to be dropped here.
72 ✗ if (wayland && !platformTokenInstalled && !activationToken.isEmpty()) {
73 ✗ qputenv("XDG_ACTIVATION_TOKEN", activationToken.toUtf8());
74 ✗ platformTokenInstalled = true;
75 }
76 ✗ if (wayland && !platformTokenInstalled) return false;
77 ✗ window->requestActivate();
78 ✗ return true;
79 }
80
81 } // namespace DesktopActivation
82