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

ossia / score / 32092262946

18 Aug 2026 02:33AM UTC coverage: 20.688% (+1.3%) from 19.438%
32092262946

push

github

jcelerier
tests: fake_puppet: support Qt < 6.5

QWebSocket::errorOccurred only exists since Qt 6.5; the Coverage CI
container builds the test tree with Qt 6.4, where the signal is the
overloaded `error`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

44247 of 213874 relevant lines covered (20.69%)

5667.56 hits per line

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

50.0
/src/plugins/score-plugin-js/JS/JSProcessModel.hpp
1
#pragma once
2
#include <Process/Process.hpp>
3
#include <Process/Script/ScriptProcess.hpp>
4

5
#include <JS/JSProcessMetadata.hpp>
6
#include <JS/Qml/QmlObjects.hpp>
7
#include <score/serialization/MapSerialization.hpp>
8
#include <QQmlComponent>
9

10
#include <score_plugin_js_export.h>
11

12
#include <memory>
13
#include <verdigris>
14
class QQuickItem;
15

16
namespace JS
17
{
18
class Script;
19
class ProcessModel;
20

21
struct QmlSource {
22
  QmlSource() = default;
6 ✔
23
  ~QmlSource() = default;
8 ✔
24
  QmlSource(const QmlSource&) = default;
×
25
  QmlSource(QmlSource&&) = default;
×
26

27
  QmlSource(const QString& execution, const QString& ui)
2 ✔
28
      : execution{execution}
2 ✔
29
      , ui{ui}
2 ✔
30
  {
31
  }
2 ✔
32

33
  QmlSource(const std::vector<QString>& vec)
×
34
  {
35
    SCORE_ASSERT(vec.size() == 2);
×
36
    execution = vec[0];
×
37
    ui = vec[1];
×
38
  }
×
39

40
  QmlSource& operator=(const QmlSource&) = default;
4 ✔
41
  QmlSource& operator=(QmlSource&&) = default;
42

43
  QString execution;
44
  QString ui;
45

46
  struct MemberSpec
47
  {
48
    const QString name;
49
    const QString QmlSource::*pointer;
50
    const std::string_view language{};
51
  };
52

53
  static const inline std::array<MemberSpec, 2> specification{
54
                                                              MemberSpec{QObject::tr("Execution"), &QmlSource::execution, "QML"},
55
                                                              MemberSpec{QObject::tr("GUI"), &QmlSource::ui, "QML"},
56
  };
57

58
  friend bool operator!=(const QmlSource& lhs, const std::vector<QString>& rhs) {
59
    return rhs.size() != 2 || lhs.execution != rhs[0]|| lhs.ui != rhs[1];
60
  }
61
  friend bool operator!=(const std::vector<QString>& rhs, const QmlSource& lhs) {
×
62
    return rhs.size() != 2 || lhs.execution != rhs[0]|| lhs.ui != rhs[1];
×
63
  }
64
};
65

66

67
struct ComponentCache
68
{
69
  struct Cache
70
  {
71
    QByteArray key;
72
    std::unique_ptr<QQmlComponent> component{};
73
    std::unique_ptr<JS::Script> object{};
74
  };
75

76
  JS::Script*
77
  getExecution(const JS::ProcessModel& process, const QByteArray& str, bool isFile) noexcept;
78
  QQmlComponent*
79
  getUi(const JS::ProcessModel& process, const QByteArray& str, bool isFile) noexcept;
80
  const Cache* tryGet(const QByteArray& str, bool isFile) const noexcept;
81

82
  ComponentCache();
83
  ~ComponentCache();
84

85
private:
86
  std::vector<Cache> m_map;
87

88
};
89

90
class SCORE_PLUGIN_JS_EXPORT ProcessModel final : public Process::ProcessModel
91
{
92
  SCORE_SERIALIZE_FRIENDS
93
  PROCESS_METADATA_IMPL_NOFLAGS(JS::ProcessModel)
32 ✔
94
  W_OBJECT(ProcessModel)
95
public:
96
  bool hasExternalUI() const noexcept { return bool(m_ui_component); }
1 ✔
97

98
  explicit ProcessModel(
99
      const TimeVal& duration, const QString& data, const Id<Process::ProcessModel>& id,
100
      QObject* parent);
101

102
  template <typename Impl>
103
  explicit ProcessModel(Impl& vis, QObject* parent)
6 ✔
104
      : Process::ProcessModel{vis, parent}
2 ✔
105
  {
2 ✔
106
    vis.writeTo(*this);
2 ✔
107
  }
2 ✔
108
  Process::ProcessFlags flags() const noexcept override;
109
  void setExecutionScript(const QString& script);
110
  const QString& executionScript() const noexcept { return m_program.execution; }
×
111
  void executionScriptOk() W_SIGNAL(executionScriptOk);
4 ✔
112
  void executionScriptChanged(const QString& arg_1) W_SIGNAL(executionScriptChanged, arg_1);
4 ✔
113
  const QByteArray& qmlData() const noexcept { return m_qmlData; }
×
114

115
  void setUiScript(const QString& script);
116
  const QString& uiScript() const noexcept { return m_program.ui; }
×
117
  void uiScriptOk() W_SIGNAL(uiScriptOk);
×
118
  void uiScriptChanged(const QString& arg_1) W_SIGNAL(uiScriptChanged, arg_1);
×
119

120
  void setState(const JS::JSState& s);
121
  void updateState(const QString& k, const ossia::value& v);
122
  const JS::JSState& state() const noexcept { return m_state; }
2 ✔
123
  void stateChanged() W_SIGNAL(stateChanged);
×
124
  void stateElementChanged(const QString& k, const ossia::value& v) W_SIGNAL(stateElementChanged, k, v);
×
125

126
  JS::Script* currentExecutionObject() const noexcept;
127
  QQuickItem* currentUI() const noexcept;
128
  bool isGpu() const noexcept;
129
  bool hasUi() const noexcept;
130
  QWidget* createWindowForUI(const score::DocumentContext& ctx,
131
                             QWidget* parent) const noexcept;
132
  QQuickItem* createItemForUI(const score::DocumentContext& ctx) const noexcept;
133

134
  ~ProcessModel() override;
135

136
  QString rootPath() const noexcept;
137
  bool validate(const std::vector<QString>& str) const noexcept;
138
  void errorMessage(const QString& arg_2) const
×
139
      W_SIGNAL(errorMessage, arg_2);
×
140

141
  const QmlSource& program() const noexcept { return m_program; }
4 ✔
142
  [[nodiscard]] Process::ScriptChangeResult setProgram(const QmlSource& f);
143
  void programChanged() W_SIGNAL(programChanged);
×
144

145
  void mapExternalFiles(Process::ExternalFileMap& map) override;
146

147
  void uiToExecution(const QVariant& v) W_SIGNAL(uiToExecution, v);
×
148
  void executionToUi(const QVariant& v) W_SIGNAL(executionToUi, v);
×
149

150
  PROPERTY(QString, executionScript READ executionScript WRITE setExecutionScript NOTIFY executionScriptChanged)
151
  PROPERTY(QString, uiScript READ uiScript WRITE setUiScript NOTIFY uiScriptChanged)
152
  PROPERTY(JS::QmlSource, program READ program WRITE setProgram NOTIFY programChanged)
153
  PROPERTY(JS::JSState, state READ state WRITE setState NOTIFY stateChanged)
154
private:
155
  QString effect() const noexcept override;
156
  void loadPreset(const Process::Preset& preset) override;
157
  Process::Preset savePreset() const noexcept override;
158
  Process::ScriptChangeResult setQmlData(const QByteArray&, bool isFile);
159

160
  QString m_root;
161
  QmlSource m_program;
162
  QByteArray m_qmlData;
163

164
  QQmlComponent* m_ui_component{};
2 ✔
165
  mutable QPointer<QQuickItem> m_ui_object{};
2 ✔
166

167
  mutable ComponentCache m_cache;
168
  JS::JSState m_state;
169
  bool m_isFile{};
2 ✔
170
};
171
}
172

173
W_REGISTER_ARGTYPE(JS::JSState)
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