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: 88.0% 44 / 0 / 50
Functions: 87.5% 7 / 0 / 8
Branches: 64.5% 49 / 0 / 76

presentation/FolderSubscriptionEditor.cpp
Line Branch Exec Source
1 #include "FolderSubscriptionEditor.h"
2 #include "data/FolderPreferences.h"
3 #include <utility>
4
5 796 FolderSubscriptionEditor::FolderSubscriptionEditor(QString profileDirectory, QObject *parent)
6 796 : QAbstractListModel(parent), m_profileDirectory(std::move(profileDirectory)) {}
7 792 int FolderSubscriptionEditor::rowCount(const QModelIndex &parent) const {
8
1/2
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 792 times.
792 return parent.isValid() ? 0 : m_paths.size();
9 }
10 10 QVariant FolderSubscriptionEditor::data(const QModelIndex &index, int role) const {
11
4/8
✓ Branch 3 → 4 taken 10 times.
✗ Branch 3 → 9 not taken.
✓ Branch 5 → 6 taken 10 times.
✗ Branch 5 → 9 not taken.
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 10 taken 10 times.
✗ Branch 11 → 12 not taken.
✓ Branch 11 → 13 taken 10 times.
10 if (!index.isValid() || index.row() < 0 || index.row() >= m_paths.size()) return {};
12 10 const auto &path = m_paths[index.row()];
13
2/2
✓ Branch 15 → 16 taken 4 times.
✓ Branch 15 → 17 taken 6 times.
10 if (role == Path) return path;
14
1/2
✓ Branch 17 → 18 taken 6 times.
✗ Branch 17 → 20 not taken.
6 if (role == Selected) return m_selected.contains(path);
15 ✗ return {};
16 }
17 8 QHash<int, QByteArray> FolderSubscriptionEditor::roleNames() const {
18
2/4
✓ Branch 6 → 7 taken 16 times.
✓ Branch 6 → 8 taken 8 times.
✗ Branch 11 → 12 not taken.
✗ Branch 11 → 13 not taken.
24 return {{Path, "folderPath"}, {Selected, "folderSelected"}};
19 8 }
20 4 void FolderSubscriptionEditor::begin(QString account, QStringList available,
21 const QStringList &selected, std::function<bool(const QString &, const QStringList &)> admit) {
22 4 beginResetModel();
23 4 m_account = std::move(account);
24 4 available.removeDuplicates();
25 4 available.sort(Qt::CaseInsensitive);
26 4 m_paths = std::move(available);
27
1/1
✓ Branch 11 → 12 taken 4 times.
4 m_selected = QSet<QString>(selected.begin(), selected.end());
28 4 m_admit = std::move(admit);
29 4 m_error.clear();
30 4 endResetModel();
31 4 emit stateChanged();
32 4 }
33 ✗ void FolderSubscriptionEditor::setSelected(int row, bool selected) {
34 ✗ if (row < 0 || row >= m_paths.size()) return;
35 ✗ if (selected) m_selected.insert(m_paths[row]); else m_selected.remove(m_paths[row]);
36 ✗ emit dataChanged(index(row), index(row), {Selected});
37 }
38 2 void FolderSubscriptionEditor::selectAll(bool selected) {
39
5/5
✓ Branch 2 → 3 taken 1 time.
✓ Branch 2 → 6 taken 1 time.
✓ Branch 3 → 4 taken 1 time.
✓ Branch 4 → 5 taken 1 time.
✓ Branch 5 → 7 taken 1 time.
2 m_selected = selected ? QSet<QString>(m_paths.begin(), m_paths.end()) : QSet<QString>{};
40
5/6
✓ Branch 10 → 11 taken 2 times.
✗ Branch 10 → 20 not taken.
✓ Branch 11 → 12 taken 2 times.
✓ Branch 14 → 15 taken 2 times.
✓ Branch 16 → 17 taken 2 times.
✓ Branch 17 → 18 taken 2 times.
2 if (!m_paths.isEmpty()) emit dataChanged(index(0), index(m_paths.size() - 1), {Selected});
41 2 }
42 3 bool FolderSubscriptionEditor::save() {
43 3 QStringList selected;
44
7/7
✓ Branch 2 → 3 taken 3 times.
✓ Branch 3 → 4 taken 3 times.
✓ Branch 7 → 8 taken 3 times.
✓ Branch 7 → 9 taken 2 times.
✓ Branch 8 → 9 taken 3 times.
✓ Branch 11 → 5 taken 5 times.
✓ Branch 11 → 12 taken 3 times.
8 for (const auto &path : m_paths) if (m_selected.contains(path)) selected.append(path);
45 // S106-239: a subscription the dialog did not list (the folder list was
46 // still arriving when it opened) is kept as it was, not dropped.
47 3 QStringList unlisted;
48
5/5
✓ Branch 17 → 18 taken 1 time.
✓ Branch 17 → 19 taken 3 times.
✓ Branch 18 → 19 taken 1 time.
✓ Branch 21 → 15 taken 4 times.
✓ Branch 21 → 22 taken 3 times.
7 for (const auto &path : std::as_const(m_selected)) if (!m_paths.contains(path)) unlisted.append(path);
49
1/1
✓ Branch 22 → 23 taken 3 times.
3 unlisted.sort(Qt::CaseInsensitive);
50
1/1
✓ Branch 23 → 24 taken 3 times.
3 selected.append(unlisted);
51
7/9
✓ Branch 25 → 26 taken 3 times.
✗ Branch 25 → 30 not taken.
✓ Branch 27 → 28 taken 3 times.
✗ Branch 27 → 30 not taken.
✓ Branch 28 → 29 taken 3 times.
✓ Branch 29 → 30 taken 1 time.
✓ Branch 29 → 31 taken 2 times.
✓ Branch 32 → 33 taken 1 time.
✓ Branch 32 → 37 taken 2 times.
3 if (m_account.isEmpty() || !m_admit || !m_admit(m_account, selected))
52
1/1
✓ Branch 33 → 34 taken 1 time.
1 m_error = tr("The account or folder list changed. Reopen this dialog.");
53
2/3
✓ Branch 37 → 38 taken 2 times.
✗ Branch 38 → 39 not taken.
✓ Branch 38 → 43 taken 2 times.
2 else if (!FolderPreferences::saveAccountSubscriptions(m_profileDirectory, m_account, selected))
54 ✗ m_error = tr("The folder subscriptions could not be saved locally.");
55 2 else m_error.clear();
56
1/1
✓ Branch 44 → 45 taken 3 times.
3 emit stateChanged();
57
2/2
✓ Branch 46 → 47 taken 1 time.
✓ Branch 46 → 48 taken 2 times.
3 if (!m_error.isEmpty()) return false;
58
1/1
✓ Branch 48 → 49 taken 2 times.
2 emit saved(m_account, selected);
59 2 return true;
60 3 }
61