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% 18 / 0 / 18
Functions: 100.0% 1 / 0 / 1
Branches: 76.2% 48 / 0 / 63

data/DavCredentials.h
Line Branch Exec Source
1 #pragma once
2
3 #include <QByteArray>
4 #include <QString>
5 #include <QUrl>
6 #include <functional>
7
8 class QObject;
9
10 namespace DavCredentials {
11
12 // Canonical credential boundary used by both the keyring and settings sync.
13 // Only the HTTPS origin (scheme, IDNA host and effective port) and username
14 // participate; URL paths intentionally do not, because one DAV account may
15 // serve several collections below the same origin.
16 2734 inline QString canonicalOrigin(const QString &serverUrl) {
17
2/2
✓ Branch 2 → 3 taken 2734 times.
✓ Branch 3 → 4 taken 2734 times.
2734 const QUrl url(serverUrl.trimmed(), QUrl::StrictMode);
18
2/2
✓ Branch 5 → 6 taken 2734 times.
✓ Branch 6 → 7 taken 2734 times.
2734 const QString scheme = url.scheme().toLower();
19
1/1
✓ Branch 9 → 10 taken 2734 times.
2734 const QString parsedHost = url.host();
20 const QString host =
21
1/1
✓ Branch 12 → 13 taken 2734 times.
2734 parsedHost.contains(QLatin1Char(':'))
22 2734 ? parsedHost.toLower()
23
10/14
✓ Branch 13 → 14 taken 1 time.
✓ Branch 13 → 15 taken 2733 times.
✓ Branch 14 → 19 taken 1 time.
✓ Branch 16 → 17 taken 2733 times.
✓ Branch 17 → 18 taken 2733 times.
✓ Branch 18 → 19 taken 2733 times.
✓ Branch 19 → 20 taken 2733 times.
✓ Branch 19 → 21 taken 1 time.
✓ Branch 21 → 22 taken 2733 times.
✓ Branch 21 → 23 taken 1 time.
✗ Branch 88 → 89 not taken.
✗ Branch 88 → 90 not taken.
✗ Branch 92 → 93 not taken.
✗ Branch 92 → 94 not taken.
2734 : QString::fromLatin1(QUrl::toAce(parsedHost)).toLower();
24
11/15
✓ Branch 23 → 24 taken 2734 times.
✓ Branch 24 → 25 taken 2730 times.
✓ Branch 24 → 36 taken 4 times.
✓ Branch 29 → 30 taken 2726 times.
✓ Branch 29 → 36 taken 4 times.
✓ Branch 31 → 32 taken 2725 times.
✓ Branch 31 → 36 taken 1 time.
✓ Branch 42 → 43 taken 2730 times.
✓ Branch 42 → 44 taken 4 times.
✓ Branch 44 → 45 taken 10 times.
✓ Branch 44 → 46 taken 2724 times.
✗ Branch 104 → 105 not taken.
✗ Branch 104 → 106 not taken.
✗ Branch 108 → 109 not taken.
✗ Branch 108 → 110 not taken.
10923 if (!url.isValid() || scheme != QStringLiteral("https") || host.isEmpty() ||
25
7/9
✓ Branch 33 → 34 taken 2725 times.
✓ Branch 35 → 36 taken 1 time.
✓ Branch 35 → 37 taken 2724 times.
✓ Branch 38 → 39 taken 2725 times.
✓ Branch 38 → 40 taken 9 times.
✓ Branch 40 → 41 taken 2730 times.
✓ Branch 40 → 42 taken 4 times.
✗ Branch 99 → 100 not taken.
✗ Branch 99 → 101 not taken.
5459 !url.userInfo().isEmpty()) {
26 10 return {};
27 }
28
29
1/1
✓ Branch 46 → 47 taken 2724 times.
2724 const int port = url.port(443);
30
3/4
✓ Branch 47 → 48 taken 2723 times.
✓ Branch 47 → 49 taken 1 time.
✗ Branch 48 → 49 not taken.
✓ Branch 48 → 50 taken 2723 times.
2724 if (port < 1 || port > 65535)
31 1 return {};
32
1/1
✓ Branch 52 → 53 taken 2723 times.
2723 const QString authorityHost = host.contains(QLatin1Char(':'))
33
2/6
✓ Branch 62 → 63 taken 1 time.
✓ Branch 62 → 64 taken 2722 times.
✗ Branch 113 → 114 not taken.
✗ Branch 113 → 115 not taken.
✗ Branch 117 → 118 not taken.
✗ Branch 117 → 119 not taken.
2724 ? QStringLiteral("[%1]").arg(host)
34
5/5
✓ Branch 53 → 54 taken 1 time.
✓ Branch 53 → 59 taken 2722 times.
✓ Branch 58 → 60 taken 1 time.
✓ Branch 60 → 61 taken 1 time.
✓ Branch 60 → 62 taken 2722 times.
2724 : host;
35
2/2
✓ Branch 68 → 69 taken 2723 times.
✓ Branch 70 → 71 taken 2723 times.
8169 return QStringLiteral("https://%1:%2").arg(authorityHost).arg(port);
36 2734 }
37
38 QString accountName(const QString &accountId, const QString &serverUrl,
39 const QString &username,
40 const QString &credentialId = {});
41
42 // Always completes asynchronously. The returned operation belongs to owner;
43 // deleting it cancels outstanding keyring jobs and suppresses the callback.
44 // Completion is bounded to 30 seconds and rechecks local authorization.
45 using PasswordCallback = std::function<void(QByteArray password, QString error)>;
46 QObject *readPasswordAsync(QObject *owner, const QString &accountId,
47 const QString &serverUrl, const QString &username,
48 PasswordCallback callback,
49 const QString &credentialId = {});
50
51 // Removes endpoint-bound and legacy keys without blocking the caller.
52 // Same owner/cancellation and 30-second total deadline as readPasswordAsync.
53 QObject *deletePasswordAsync(QObject *owner, const QString &accountId,
54 const QString &serverUrl, const QString &username,
55 std::function<void(bool)> callback,
56 const QString &credentialId = {});
57
58 QByteArray readPasswordBlocking(const QString &accountId,
59 const QString &serverUrl,
60 const QString &username,
61 QString *error = nullptr,
62 const QString &credentialId = {});
63
64 bool writePasswordBlocking(const QString &accountId, const QString &serverUrl,
65 const QString &username,
66 const QByteArray &password,
67 QString *error = nullptr,
68 const QString &credentialId = {});
69
70 bool deletePasswordBlocking(const QString &accountId, const QString &serverUrl,
71 const QString &username,
72 QString *error = nullptr,
73 const QString &credentialId = {});
74
75 } // namespace DavCredentials
76