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% 2 / 0 / 2
Functions: 100.0% 1 / 0 / 1
Branches: -% 0 / 0 / 0

service/NativeMailDocument.h
Line Branch Exec Source
1 #pragma once
2
3 #include <QByteArray>
4 #include <QString>
5 #include <QHash>
6 #include <QImage>
7 #include <QUrl>
8 #include <QList>
9 #include <QTextDocumentFragment>
10 #include <QSharedPointer>
11 #include <atomic>
12
13 // A bounded, resource-free HTML subset produced entirely from decoded UTF-8.
14 // Preparation is reentrant and may run on an owned worker. A cancelled/limited
15 // result never exposes a partially prepared document to its caller.
16 struct NativeMailDocument {
17 enum class Outcome { Ready, Limited, Cancelled, Failed };
18 static constexpr qsizetype MaxInputBytes = 1024 * 1024;
19 static constexpr int MaxNodes = 8192;
20 // Image references one document keeps at most (S106-634).
21 static constexpr int MaxImageReferences = 128;
22 static constexpr int MaxDepth = 64;
23
24 // Sprint 108 (D-9): Compose keeps the bounded composer styles (colours,
25 // font sizes, the D-6 font families, margins), MailJD's region markers
26 // and data: images; Reader output is unchanged by it.
27 enum class Mode { Reader, Compose };
28 struct ImageReference {
29 QString placeholder;
30 QString contentId;
31 QUrl remoteUrl{};
32 QByteArray data{}; // Compose only: a decoded data: image
33 QString mimeType{}; // its image type
34 QString alternativeText{};
35 int width = 0; // Compose only: the img's width/height attributes
36 int height = 0;
37 };
38 // A data: image a composer import keeps at most (decoded bytes).
39 static constexpr qsizetype MaxDataImageBytes = 5 * 1024 * 1024;
40 QList<ImageReference> imageReferences;
41 QHash<QUrl, QImage> images;
42 QString html;
43 QString plainText;
44 QSharedPointer<const QTextDocumentFragment> fragment;
45 Outcome outcome = Outcome::Ready;
46 bool simplified = false;
47 bool cacheHit = false;
48 int nodes = 0;
49 int deniedEntities = 0;
50
51 383 static NativeMailDocument prepare(const QByteArray &input,
52 const std::atomic_bool *cancelled = nullptr) {
53 383 return prepare(input, cancelled, Mode::Reader);
54 }
55 static NativeMailDocument prepare(const QByteArray &input, const std::atomic_bool *cancelled,
56 Mode mode);
57 };
58