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% 35 / 0 / 35
Functions: 100.0% 8 / 0 / 8
Branches: 78.7% 37 / 0 / 47

presentation/MapTileProvider.cpp
Line Branch Exec Source
1 #include "MapTileProvider.h"
2
3 #include "MapTileRenderer.h"
4
5 #include <QMutexLocker>
6 #include <QStringList>
7
8 namespace {
9
10 class TileResponse final : public QQuickImageResponse {
11 public:
12 281 QQuickTextureFactory *textureFactory() const override { return QQuickTextureFactory::textureFactoryForImage(m_image); }
13 384 void finish(const QImage &image) {
14 384 m_image = image;
15 384 emit finished();
16 384 }
17
18 private:
19 QImage m_image;
20 };
21
22
1/1
✓ Branch 4 → 5 taken 813 times.
813 QColor colour(const QString &hex) { return QColor(QLatin1Char('#') + hex); }
23
24 } // namespace
25
26
2/2
✓ Branch 3 → 4 taken 765 times.
✓ Branch 6 → 7 taken 765 times.
765 MapTileProvider::MapTileProvider() { m_pool.setMaxThreadCount(2); }
27
28 1526 MapTileProvider::~MapTileProvider() { m_pool.waitForDone(); }
29
30 384 QQuickImageResponse *MapTileProvider::requestImageResponse(const QString &id, const QSize &requestedSize) {
31
3/6
✓ Branch 2 → 3 taken 384 times.
✓ Branch 3 → 4 taken 384 times.
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 384 times.
✗ Branch 50 → 51 not taken.
✗ Branch 50 → 52 not taken.
384 auto *response = new TileResponse;
32
1/1
✓ Branch 9 → 10 taken 384 times.
384 const QStringList parts = id.split(QLatin1Char('/'));
33 384 const int pixels = qBound(64, qMax(requestedSize.width(), requestedSize.height()) > 0
34
2/3
✓ Branch 13 → 14 taken 384 times.
✗ Branch 13 → 18 not taken.
✓ Branch 19 → 20 taken 384 times.
768 ? qMax(requestedSize.width(), requestedSize.height()) : 256, 1024);
35
3/3
✓ Branch 20 → 21 taken 384 times.
✓ Branch 23 → 24 taken 384 times.
✓ Branch 24 → 25 taken 384 times.
384 const QString cacheKey = id + QLatin1Char('@') + QString::number(pixels);
36 {
37 384 QMutexLocker lock(&m_mutex);
38
2/2
✓ Branch 29 → 30 taken 13 times.
✓ Branch 29 → 36 taken 371 times.
384 if (const QImage *cached = m_cache.object(cacheKey)) {
39
1/1
✓ Branch 30 → 31 taken 13 times.
13 const QImage image = *cached;
40
2/2
✓ Branch 31 → 32 taken 13 times.
✓ Branch 32 → 33 taken 13 times.
26 QMetaObject::invokeMethod(response, [response, image] { response->finish(image); }, Qt::QueuedConnection);
41 13 return response;
42 13 }
43 384 }
44
1/3
✓ Branch 42 → 44 taken 371 times.
✗ Branch 82 → 83 not taken.
✗ Branch 82 → 84 not taken.
371 m_pool.start([this, response, parts, pixels, cacheKey] {
45 371 QImage image;
46
1/1
✓ Branch 3 → 4 taken 371 times.
371 const auto world = MapTileRenderer::World::builtIn();
47
5/6
✓ Branch 5 → 6 taken 271 times.
✓ Branch 5 → 9 taken 100 times.
✓ Branch 7 → 8 taken 271 times.
✗ Branch 7 → 9 not taken.
✓ Branch 10 → 11 taken 271 times.
✓ Branch 10 → 28 taken 100 times.
371 if (world && parts.size() >= 6)
48
4/4
✓ Branch 18 → 19 taken 271 times.
✓ Branch 20 → 21 taken 271 times.
✓ Branch 22 → 23 taken 271 times.
✓ Branch 24 → 25 taken 271 times.
542 image = MapTileRenderer::render(*world, parts.at(0).toInt(), parts.at(1).toInt(), parts.at(2).toInt(),
49
3/3
✓ Branch 12 → 13 taken 271 times.
✓ Branch 14 → 15 taken 271 times.
✓ Branch 16 → 17 taken 271 times.
542 {colour(parts.at(3)), colour(parts.at(4)), colour(parts.at(5))}, pixels);
50 {
51 371 QMutexLocker lock(&m_mutex);
52
5/8
✓ Branch 29 → 30 taken 371 times.
✓ Branch 31 → 32 taken 371 times.
✓ Branch 32 → 33 taken 371 times.
✓ Branch 33 → 34 taken 371 times.
✗ Branch 34 → 35 not taken.
✓ Branch 34 → 36 taken 371 times.
✗ Branch 43 → 44 not taken.
✗ Branch 43 → 45 not taken.
371 m_cache.insert(cacheKey, new QImage(image), int(qMax<qsizetype>(1, image.sizeInBytes() / 1024)));
53 371 }
54
1/1
✓ Branch 37 → 38 taken 371 times.
371 response->finish(image);
55 371 });
56 371 return response;
57 384 }
58