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

ossia / score / 35310244323

18 Sep 2026 05:17AM UTC coverage: 39.902% (+2.2%) from 37.724%
35310244323

push

github

jcelerier
tests: include CommandDispatcher where JsLibraryScriptSavingTest uses it

ee4b67af6f added the test with a CommandDispatcher<> but without its header,
relying on it arriving transitively. The Coverage build compiles with clang-19
at gnu++23 and does not get it that way:

  JsLibraryScriptSavingTest.cpp:70:3: error: no template named 'CommandDispatcher'

This has been broken since 2026-09-13 and was hidden behind the boost download
failure, which stopped that job before it ever reached the compile.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1e2ZdUQh7Srmv6BGVakrQ

114906 of 287968 relevant lines covered (39.9%)

77906.02 hits per line

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

82.35
/src/plugins/score-lib-process/Process/Script/ScriptWidget.cpp
1
#include <Process/Script/ScriptWidget.hpp>
2

3
#include <score/application/GUIApplicationContext.hpp>
4
#include <score/model/Skin.hpp>
5
#include <score/tools/File.hpp>
6

7
#include <QCXXHighlighter>
8
#include <QCodeEditor>
9
#include <QFaustCompleter>
10
#include <QFaustHighlighter>
11
#include <QFile>
12
#include <QGLSLCompleter>
13
#include <QGLSLHighlighter>
14
#include <QJSCompleter>
15
#include <QJSHighlighter>
16
#include <QMainWindow>
17
#include <QRegularExpression>
18
#include <QSyntaxStyle>
19

20
namespace Process
21
{
22
namespace
23
{
24
void setTabWidth(QTextEdit& edit, int spaceCount)
136✔
25
{
26
  const QString spaces(spaceCount, QChar(' '));
136✔
27
  const QFontMetrics metrics(edit.font());
136✔
28
  edit.setTabStopDistance(metrics.horizontalAdvance(spaces));
136✔
29
}
136✔
30

31
std::pair<QStyleSyntaxHighlighter*, QCompleter*>
32
getLanguageStyle(const std::string_view language)
136✔
33
{
34
  if(language == "glsl" || language == "Glsl" || language == "GLSL")
136✔
35
  {
36
    return {new QGLSLHighlighter, new QGLSLCompleter};
×
37
  }
38
  else if(language == "js" || language == "Js" || language == "JS")
136✔
39
  {
40
    return {new QJSHighlighter, new QJSCompleter};
×
41
  }
42
  else if(language == "qml" || language == "Qml" || language == "QML")
136✔
43
  {
44
    return {new QJSHighlighter, new QJSCompleter};
136✔
45
  }
46
  else if(language == "faust" || language == "Faust")
×
47
  {
48
    return {new QFaustHighlighter, new QFaustCompleter};
×
49
  }
50
  else // C, C++, ...
51
  {
52
    return {new QCXXHighlighter, nullptr};
×
53
  }
54
}
136✔
55

56
}
57

58
static QByteArray themeSource()
2✔
59
{
60
  // A copy, not a mapping: the file is closed when this returns
61
  QFile fl(":/drakula.xml");
2✔
62
  if(fl.open(QIODevice::ReadOnly))
2✔
63
    return fl.readAll();
2✔
64
  qDebug() << "Could not load style:" << fl.fileName();
×
65
  return {};
×
66
}
2✔
67

68
QSyntaxStyle* scriptStyle()
152✔
69
{
70
  static bool tried_to_load = false;
71
  static QSyntaxStyle style;
152✔
72
  if(!tried_to_load)
152✔
73
  {
74
    if(const auto src = themeSource(); !src.isEmpty())
2✔
75
      style.load(src);
1✔
76
    tried_to_load = true;
1✔
77
  }
1✔
78
  return &style;
152✔
79
}
×
80

81
QSyntaxStyle* overlayScriptStyle()
20✔
82
{
83
  static bool tried_to_load = false;
84
  static QSyntaxStyle style;
20✔
85
  if(!tried_to_load)
20✔
86
  {
87
    if(auto src = QString::fromUtf8(themeSource()); !src.isEmpty())
2✔
88
    {
89
      // QColor reads #AARRGGBB: alpha 0 for the text background, which also
90
      // fills the line number area; 10% for the current line.
91
      static const QRegularExpression text{
2✔
92
          QStringLiteral(R"((name="Text"[^/>]*background=")#([0-9a-fA-F]{6}"))")};
1✔
93
      static const QRegularExpression currentLine{
2✔
94
          QStringLiteral(R"((name="CurrentLine"[^/>]*background=")#([0-9a-fA-F]{6}"))")};
1✔
95
      src.replace(text, QStringLiteral("\\1#00\\2"));
1✔
96
      src.replace(currentLine, QStringLiteral("\\1#1a\\2"));
1✔
97
      style.load(src);
1✔
98
    }
1✔
99
    tried_to_load = true;
1✔
100
  }
1✔
101
  return &style;
20✔
102
}
×
103

104
QTextEdit* createScriptWidget(const std::string_view language)
136✔
105
{
106
  auto edit = new QCodeEditor{};
136✔
107

108
  auto& skin = score::Skin::instance();
136✔
109
  edit->setFont(skin.CodeFont);
136✔
110
  QObject::connect(&skin, &score::Skin::changed, edit, [edit] {
136✔
111
    edit->setFont(score::Skin::instance().CodeFont);
×
112
  });
×
113

114
  auto [highlight, complete] = getLanguageStyle(language);
136✔
115

116
  if(highlight)
136✔
117
  {
118
    edit->setHighlighter(highlight);
272✔
119
    highlight->setParent(edit);
136✔
120
  }
136✔
121
  if(complete)
136✔
122
  {
123
    edit->setCompleter(complete);
272✔
124
    complete->setParent(edit);
136✔
125
  }
136✔
126

127
  edit->setSyntaxStyle(scriptStyle());
136✔
128

129
  setTabWidth(*edit, 4);
136✔
130

131
  return edit;
136✔
132
}
×
133
}
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