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: 100.0% 37 / 0 / 37
Functions: 100.0% 5 / 0 / 5
Branches: 85.5% 47 / 0 / 55

presentation/CommandHistory.cpp
Line Branch Exec Source
1 #include "CommandHistory.h"
2
3 #include "app/NamedCommandCatalog.h"
4
5 244 bool CommandHistory::record(const QString &input) {
6
1/1
✓ Branch 2 → 3 taken 244 times.
244 const QString line = input.simplified();
7
5/6
✓ Branch 4 → 5 taken 244 times.
✗ Branch 4 → 7 not taken.
✓ Branch 6 → 7 taken 1 time.
✓ Branch 6 → 8 taken 243 times.
✓ Branch 9 → 10 taken 1 time.
✓ Branch 9 → 11 taken 243 times.
244 if (line.isEmpty() || line.size() > MaxLineLength) return false;
8
1/1
✓ Branch 11 → 12 taken 243 times.
243 const auto parsed = NamedCommandCatalog::parse(line);
9
3/3
✓ Branch 12 → 13 taken 243 times.
✓ Branch 13 → 14 taken 37 times.
✓ Branch 13 → 15 taken 206 times.
243 if (!NamedCommandCatalog::storable(parsed)) return false;
10 // One spelling per line: the catalog's lowercase name, the argument as typed.
11
1/1
✓ Branch 15 → 16 taken 206 times.
206 const QString normalized = parsed.text();
12
1/1
✓ Branch 16 → 17 taken 206 times.
206 m_lines.removeAll(normalized);
13
1/1
✓ Branch 17 → 18 taken 206 times.
206 m_lines.prepend(normalized);
14
2/2
✓ Branch 21 → 19 taken 12 times.
✓ Branch 21 → 22 taken 206 times.
218 while (m_lines.size() > Capacity) m_lines.removeLast();
15 206 return true;
16 244 }
17
18 4 void CommandHistory::clear() {
19 4 m_lines.clear();
20 4 m_folders.clear();
21 4 }
22
23 130 void CommandHistory::recordFolder(const QString &account, const QString &path) {
24
4/8
✓ Branch 3 → 4 taken 130 times.
✗ Branch 3 → 8 not taken.
✓ Branch 5 → 6 taken 130 times.
✗ Branch 5 → 8 not taken.
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 130 times.
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 130 times.
130 if (account.isEmpty() || path.isEmpty() || path.size() > MaxLineLength) return;
25 130 QStringList &folders = m_folders[account];
26 130 folders.removeAll(path);
27 130 folders.prepend(path);
28
1/2
✗ Branch 18 → 16 not taken.
✓ Branch 18 → 19 taken 130 times.
130 while (folders.size() > RecentFolderCapacity) folders.removeLast();
29 }
30
31 266 QVariantMap CommandHistory::save() const {
32 266 QVariantMap folders;
33
3/3
✓ Branch 6 → 7 taken 143 times.
✓ Branch 11 → 3 taken 143 times.
✓ Branch 11 → 12 taken 266 times.
409 for (auto it = m_folders.cbegin(); it != m_folders.cend(); ++it) folders.insert(it.key(), it.value());
34
2/4
✓ Branch 22 → 23 taken 532 times.
✓ Branch 22 → 24 taken 266 times.
✗ Branch 36 → 37 not taken.
✗ Branch 36 → 38 not taken.
1596 return {{QStringLiteral("history"), m_lines}, {QStringLiteral("recentFolders"), folders}};
35 1064 }
36
37 767 void CommandHistory::restore(const QVariantMap &state) {
38
1/1
✓ Branch 2 → 3 taken 767 times.
767 m_lines.clear();
39 767 m_folders.clear();
40 // Oldest first, so record() rebuilds the order and drops anything a newer
41 // catalog no longer stores (renamed commands, free-text lines).
42
2/2
✓ Branch 8 → 9 taken 767 times.
✓ Branch 9 → 10 taken 767 times.
1534 const QStringList lines = state.value(QStringLiteral("history")).toStringList();
43
6/6
✓ Branch 15 → 16 taken 5 times.
✓ Branch 16 → 17 taken 5 times.
✓ Branch 17 → 18 taken 5 times.
✓ Branch 19 → 20 taken 772 times.
✓ Branch 20 → 15 taken 5 times.
✓ Branch 20 → 21 taken 767 times.
772 for (auto it = lines.crbegin(); it != lines.crend(); ++it) record(*it);
44
2/2
✓ Branch 25 → 26 taken 767 times.
✓ Branch 26 → 27 taken 767 times.
1534 const QVariantMap folders = state.value(QStringLiteral("recentFolders")).toMap();
45
4/4
✓ Branch 31 → 32 taken 767 times.
✓ Branch 45 → 46 taken 769 times.
✓ Branch 47 → 33 taken 2 times.
✓ Branch 47 → 48 taken 767 times.
769 for (auto it = folders.cbegin(); it != folders.cend(); ++it) {
46
1/1
✓ Branch 34 → 35 taken 2 times.
2 const QStringList paths = it.value().toStringList();
47
6/6
✓ Branch 36 → 37 taken 3 times.
✓ Branch 38 → 39 taken 3 times.
✓ Branch 39 → 40 taken 3 times.
✓ Branch 41 → 42 taken 5 times.
✓ Branch 42 → 36 taken 3 times.
✓ Branch 42 → 43 taken 2 times.
5 for (auto path = paths.crbegin(); path != paths.crend(); ++path) recordFolder(it.key(), *path);
48 2 }
49 767 }
50