• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / score / 38402803580

13 Oct 2026 01:09PM UTC coverage: 48.861%. First build
38402803580

Pull #2326

github

web-flow
Merge a12afe4e9 into 4b2f7f45e
Pull Request #2326: gfx: engine fixes for the shading tiers, scene lights and blending, glTF material parameters

1785 of 2258 new or added lines in 73 files covered. (79.05%)

160466 of 328410 relevant lines covered (48.86%)

146407.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/plugins/score-plugin-js/JS/ThreadLocalQmlEngine.cpp
1
#include "ThreadLocalQmlEngine.hpp"
2

3
#include <QDir>
4
#include <QQmlAbstractUrlInterceptor>
5
#include <QQmlEngine>
6

7
namespace JS
8
{
9
namespace
10
{
11
class DriveLetterUrlFix final : public QQmlAbstractUrlInterceptor
12
{
13
public:
14
  QUrl intercept(const QUrl& url, DataType) override
4,167 ✔
15
  {
16
    const QString scheme = url.scheme();
4,167 ✔
17
    if(scheme.size() != 1 || !scheme[0].isLetter() || !url.host().isEmpty())
4,167 ✔
18
      return url;
4,167 ✔
19

20
    // QUrl lower-cases the scheme; drive letters are case-insensitive.
21
    // A '?' or '#' in the file name was split off as query / fragment:
22
    // put them back, they are part of the path.
NEW
23
    QString path = scheme.toUpper() + QLatin1Char(':') + url.path(QUrl::FullyDecoded);
×
NEW
24
    if(url.hasQuery())
×
NEW
25
      path += QLatin1Char('?') + url.query(QUrl::FullyDecoded);
×
NEW
26
    if(url.hasFragment())
×
NEW
27
      path += QLatin1Char('#') + url.fragment(QUrl::FullyDecoded);
×
NEW
28
    return QUrl::fromLocalFile(QDir::fromNativeSeparators(path));
×
29
  }
4,167 ✔
30
};
31

32
struct DriveLetterUrlFixHolder : QObject
3,523 ✔
33
{
34
  DriveLetterUrlFix interceptor;
35
  QQmlEngine* engine{};
3,523 ✔
36
  ~DriveLetterUrlFixHolder() override
7,044 ✔
37
  {
7,044 ✔
38
    if(engine)
3,522 ✔
39
      engine->removeUrlInterceptor(&interceptor);
3,522 ✔
40
  }
7,044 ✔
41
};
42
}
43

44
void installLocalPathUrlFix(QQmlEngine& engine)
3,523 ✔
45
{
46
  static constexpr auto marker = "score_qml_drive_letter_url_fix";
47
  if(engine.property(marker).toBool())
3,523 ✔
NEW
48
    return;
×
49

50
  auto* holder = new DriveLetterUrlFixHolder;
3,523 ✔
51
  holder->engine = &engine;
3,523 ✔
52
  holder->setParent(&engine);
3,523 ✔
53
  engine.addUrlInterceptor(&holder->interceptor);
3,523 ✔
54
  engine.setProperty(marker, true);
3,523 ✔
55
}
3,523 ✔
56

57
std::shared_ptr<QQmlEngine> acquireThreadLocalEngine(const std::function<void(QQmlEngine&)>& onConstruction)
24 ✔
58
{
59
  thread_local struct QQmlEngineWatcher {
24 ✔
60
    ~QQmlEngineWatcher() {
9 ✔
61
      engine.reset();
9 ✔
62
    }
9 ✔
63
    std::weak_ptr<QQmlEngine> engine{};
64
  } g_qqmlWatcher;
65

66
  auto engine = g_qqmlWatcher.engine.lock();
24 ✔
67
  if(!engine) {
24 ✔
68
    engine = std::make_shared<QQmlEngine>();
24 ✔
69
    g_qqmlWatcher.engine = engine;
24 ✔
70
    installLocalPathUrlFix(*engine);
24 ✔
71
    if(onConstruction)
24 ✔
72
      onConstruction(*engine);
24 ✔
73
  }
24 ✔
74

75
  return engine;
24 ✔
76
}
24 ✔
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc