MailJDTourDownloadDocsQualityTestsCoverage

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

GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 2 / 0 / 2
Functions: 100.0% 2 / 0 / 2
Branches: -% 0 / 0 / 0

service/MailLoginProbe.h
Line Branch Exec Source
1 #pragma once
2 #include "ConnectionDiagnosis.h"
3 #include <QObject>
4 #include <QSslConfiguration>
5 #include <QSslSocket>
6 #include <QTimer>
7
8 // Sprint 100 S100.1.11 (D-25, SF-15): signs in to an incoming (IMAP) or
9 // outgoing (SMTP) server once and reports a Diagnosis — the check behind
10 // "Save = test" and the guided setup. The password is only sent after TLS
11 // is up (implicit TLS or STARTTLS); a server without TLS is refused. The
12 // SMTP check authenticates (EHLO, STARTTLS, AUTH PLAIN/LOGIN) and quits —
13 // it never sends MAIL FROM. One probe per object; it deletes nothing itself.
14 class MailLoginProbe final : public QObject {
15 Q_OBJECT
16 public:
17 struct Request {
18 QString service; // "imap" or "smtp"
19 QString host;
20 quint16 port = 0;
21 QString security; // "ssl" (implicit TLS) or "starttls"
22 QString username;
23 QByteArray password;
24 QString account; // the address, for the messages
25 };
26 explicit MailLoginProbe(QObject *parent = nullptr);
27 // Tests trust their fixture certificate through this configuration.
28 32 void setSslConfiguration(const QSslConfiguration &configuration) { m_sslConfiguration = configuration; }
29 16 void setTimeoutMs(int ms) { m_timeoutMs = ms; }
30 void start(const Request &request);
31 void cancel();
32 bool running() const { return m_running; }
33 signals:
34 void finished(const Diagnosis &diagnosis);
35 private:
36 enum class Step { Greeting, StartTls, Capabilities, Login, AuthPlain, AuthUser, AuthPassword,
37 MailFrom, RcptTo, Done };
38 void readLines();
39 void handleImap(const QByteArray &line);
40 void handleSmtp(const QByteArray &line);
41 void encrypted();
42 void imapLogin();
43 void smtpHello();
44 void smtpAuthenticate();
45 void send(const QByteArray &line);
46 void fail(ConnectionDiagnosis::Input input);
47 void succeed();
48 ConnectionDiagnosis::Input baseInput() const;
49 QSslSocket m_socket;
50 QSslConfiguration m_sslConfiguration = QSslConfiguration::defaultConfiguration();
51 QTimer m_deadline;
52 Request m_request;
53 Step m_step = Step::Greeting;
54 QList<QSslError> m_sslErrors;
55 QByteArray m_capabilities;
56 bool m_running = false;
57 bool m_tls = false;
58 int m_timeoutMs = 10000;
59 };
60