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: 97.6% 41 / 0 / 42
Functions: 100.0% 4 / 0 / 4
Branches: 96.3% 52 / 0 / 54

presentation/KeyTipAssigner.cpp
Line Branch Exec Source
1 #include "KeyTipAssigner.h"
2
3 #include <algorithm>
4
5 namespace {
6 // Upper-case A–Z for a letter, folding accents (é → E, Ü → U); null otherwise.
7 6811 QChar baseLetter(QChar character) {
8 6811 QChar letter = character;
9
1/1
✓ Branch 2 → 3 taken 6811 times.
6811 const QString decomposed = character.decomposition();
10
3/3
✓ Branch 4 → 5 taken 1 time.
✓ Branch 4 → 6 taken 6810 times.
✓ Branch 5 → 6 taken 1 time.
6811 if (!decomposed.isEmpty()) letter = decomposed.front();
11
2/2
✓ Branch 8 → 9 taken 2 times.
✓ Branch 8 → 12 taken 6809 times.
6811 if (letter == QChar(0x00DF)) letter = QLatin1Char('S'); // ß
12 6811 letter = letter.toUpper();
13
4/4
✓ Branch 17 → 18 taken 5726 times.
✓ Branch 17 → 24 taken 1085 times.
✓ Branch 22 → 23 taken 5724 times.
✓ Branch 22 → 24 taken 2 times.
13622 return letter >= QLatin1Char('A') && letter <= QLatin1Char('Z') ? letter : QChar();
14 6811 }
15 } // namespace
16
17 475 QList<QChar> KeyTipAssigner::preferences(const QString &label) {
18 475 QList<QChar> initials;
19 475 QList<QChar> rest;
20 475 bool wordStart = true;
21
2/2
✓ Branch 22 → 4 taken 6811 times.
✓ Branch 22 → 23 taken 475 times.
7286 for (const QChar character : label) {
22
1/1
✓ Branch 4 → 5 taken 6811 times.
6811 const QChar letter = baseLetter(character);
23
2/2
✓ Branch 6 → 7 taken 5724 times.
✓ Branch 6 → 19 taken 1087 times.
6811 if (!letter.isNull()) {
24
2/2
✓ Branch 7 → 8 taken 913 times.
✓ Branch 7 → 9 taken 4811 times.
5724 QList<QChar> &target = wordStart ? initials : rest;
25
7/7
✓ Branch 11 → 12 taken 5191 times.
✓ Branch 11 → 15 taken 533 times.
✓ Branch 13 → 14 taken 3286 times.
✓ Branch 13 → 15 taken 1905 times.
✓ Branch 16 → 17 taken 3286 times.
✓ Branch 16 → 18 taken 2438 times.
✓ Branch 17 → 18 taken 3286 times.
5724 if (!initials.contains(letter) && !rest.contains(letter)) target.append(letter);
26 5724 wordStart = false;
27 } else {
28 1087 wordStart = !character.isLetterOrNumber();
29 }
30 }
31
1/1
✓ Branch 23 → 24 taken 475 times.
950 return initials + rest;
32 475 }
33
34 81 QHash<QString, QChar> KeyTipAssigner::assign(const QList<Candidate> &candidates, const QSet<QChar> &taken) {
35 81 QList<Candidate> ordered = candidates;
36
3/3
✓ Branch 3 → 4 taken 81 times.
✓ Branch 4 → 5 taken 81 times.
✓ Branch 5 → 6 taken 81 times.
81 std::stable_sort(ordered.begin(), ordered.end(), [](const Candidate &a, const Candidate &b) {
37
2/2
✓ Branch 2 → 3 taken 271 times.
✓ Branch 2 → 4 taken 724 times.
995 if (a.priority != b.priority) return a.priority > b.priority;
38
2/2
✓ Branch 6 → 7 taken 587 times.
✓ Branch 6 → 10 taken 137 times.
724 if (a.position.y() != b.position.y()) return a.position.y() < b.position.y();
39
1/2
✓ Branch 12 → 13 taken 137 times.
✗ Branch 12 → 16 not taken.
137 if (a.position.x() != b.position.x()) return a.position.x() < b.position.x();
40 ✗ return a.id < b.id;
41 });
42 81 QSet<QChar> used = taken;
43 81 QHash<QString, QChar> result;
44
3/4
✓ Branch 7 → 8 taken 5 times.
✓ Branch 7 → 17 taken 76 times.
✓ Branch 9 → 10 taken 5 times.
✗ Branch 9 → 17 not taken.
86 static const QString digits = QStringLiteral("1234567890");
45
4/4
✓ Branch 17 → 18 taken 81 times.
✓ Branch 18 → 19 taken 81 times.
✓ Branch 43 → 20 taken 470 times.
✓ Branch 43 → 44 taken 81 times.
551 for (const Candidate &candidate : ordered) {
46
1/1
✓ Branch 21 → 22 taken 470 times.
470 QList<QChar> options = preferences(candidate.label);
47
3/3
✓ Branch 24 → 25 taken 4700 times.
✓ Branch 26 → 24 taken 4700 times.
✓ Branch 26 → 27 taken 470 times.
5170 for (const QChar digit : digits) options.append(digit);
48
4/4
✓ Branch 27 → 28 taken 470 times.
✓ Branch 28 → 29 taken 470 times.
✓ Branch 39 → 30 taken 1040 times.
✓ Branch 39 → 40 taken 26 times.
1066 for (const QChar option : options) {
49
2/2
✓ Branch 32 → 33 taken 596 times.
✓ Branch 32 → 34 taken 444 times.
1040 if (used.contains(option)) continue;
50
1/1
✓ Branch 34 → 35 taken 444 times.
444 used.insert(option);
51
1/1
✓ Branch 35 → 36 taken 444 times.
444 result.insert(candidate.id, option);
52 444 break;
53 }
54 470 }
55 81 return result;
56 81 }
57