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

ossia / score / 32671464175

23 Aug 2026 10:43PM UTC coverage: 23.21% (+1.6%) from 21.606%
32671464175

push

github

jcelerier
scenario: export NodalIntervalView

test_integration_nodal_viewport and test_integration_cable_drag_view_scroll
call into the class from outside the plug-in, so a shared-plugin build could
not link either of them: the library held 136 NodalIntervalView symbols and
exported none. A static-plugin build never sees it, which is why CI does not.

51875 of 223502 relevant lines covered (23.21%)

63063.32 hits per line

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

69.53
/src/plugins/score-lib-process/Process/Process.cpp
1
// This is an open source non-commercial project. Dear PVS-Studio, please check
2
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
3
#include "Process.hpp"
4

5
#include <Process/Dataflow/PortVisibility.hpp>
6

7
#include <Process/Dataflow/Port.hpp>
8
#include <Process/ExpandMode.hpp>
9
#include <Process/PresetHelpers.hpp>
10
#include <Process/TimeValue.hpp>
11

12
#include <LocalTree/ProcessComponent.hpp>
13

14
#include <score/model/ComponentUtils.hpp>
15
#include <score/model/EntitySerialization.hpp>
16
#include <score/model/IdentifiedObject.hpp>
17
#include <score/model/Identifier.hpp>
18
#include <score/model/ModelMetadata.hpp>
19
#include <score/tools/Bind.hpp>
20
#include <score/widgets/SetIcons.hpp>
21

22
#include <ossia/detail/algorithms.hpp>
23
#include <ossia/detail/disable_fpe.hpp>
24
#include <ossia/network/base/device.hpp>
25
#include <ossia/network/base/node.hpp>
26

27
#include <QObject>
28

29
#include <wobjectimpl.h>
30

31
W_OBJECT_IMPL(Process::ProcessModel)
9,700 ✔
32

33
#if !defined(SCORE_ALL_UNITY)
34
template class IdentifiedObject<Process::ProcessModel>;
35
template class score::SerializableInterface<Process::ProcessModelFactory>;
36
#endif
37
namespace Process
38
{
39

40
const QIcon& getCategoryIcon(const QString& category) noexcept
6,099 ✔
41
{
42
  static const ossia::flat_map<QString, QIcon> categoryIcon{
6,515 ✔
43
      {"AI", makeIcon(QStringLiteral(":/icons/ai.png"))},
26 ✔
44
      {"Analysis", makeIcon(QStringLiteral(":/icons/analysis.png"))},
26 ✔
45
      {"Audio", makeIcon(QStringLiteral(":/icons/audio.png"))},
26 ✔
46
      {"Plugins", makeIcon(QStringLiteral(":/icons/filter.png"))},
26 ✔
47
      {"Midi", makeIcon(QStringLiteral(":/icons/midi.png"))},
26 ✔
48
      {"Control", makeIcon(QStringLiteral(":/icons/controls.png"))},
26 ✔
49
      {"Visuals", makeIcon(QStringLiteral(":/icons/gfx.png"))},
26 ✔
50
      {"Automations", makeIcon(QStringLiteral(":/icons/automation.png"))},
26 ✔
51
      {"Impro", makeIcon(QStringLiteral(":/icons/controls.png"))},
26 ✔
52
      {"Script", makeIcon(QStringLiteral(":/icons/script.png"))},
26 ✔
53
      {"Structure", makeIcon(QStringLiteral(":/icons/structure.png"))},
26 ✔
54
      {"Network", makeIcon(QStringLiteral(":/icons/sync.png"))},
26 ✔
55
      {"Monitoring", makeIcon(QStringLiteral(":/icons/ui.png"))},
26 ✔
56
      {"Spatial", makeIcon(QStringLiteral(":/icons/spatial.png"))},
26 ✔
57
      // Kept until the remaining processes are renamed to "Spatial": the icon
58
      // is looked up on the first path segment only, so both spellings need a
59
      // row or one of them renders without an icon.
60
      {"Spatialization", makeIcon(QStringLiteral(":/icons/spatial.png"))},
26 ✔
61
      {"Timing", makeIcon(QStringLiteral(":/icons/timing.png"))},
26 ✔
62
  };
63
  static const QIcon invalid;
6,099 ✔
64
  if(auto it = categoryIcon.find(category); it != categoryIcon.end())
6,099 ✔
65
  {
66
    return it->second;
6,099 ✔
67
  }
68
  if(auto slash_it = category.indexOf("/"); slash_it != -1)
×
69
  {
70
    if(auto it = categoryIcon.find(category.mid(0, slash_it)); it != categoryIcon.end())
×
71
    {
72
      return it->second;
×
73
    }
74
  }
×
75
  return invalid;
×
76
}
6,099 ✔
77
ProcessModel::ProcessModel(
1,192 ✔
78
    TimeVal duration, const Id<ProcessModel>& id, const QString& name, QObject* parent)
79
    : Entity{id, name, parent}
596 ✔
80
    , m_duration{std::move(duration)}
81
    , m_slotHeight{300}
82
    , m_loopDuration{m_duration}
83
    , m_size{200, 100}
84
    , m_loops{false}
85
{
1,192 ✔
86
  ossia::disable_fpe();
596 ✔
87
  con(metadata(), &score::ModelMetadata::NameChanged, this,
1,192 ✔
88
      [this] { prettyNameChanged(); });
1,213 ✔
89
  connect(this, &Process::ProcessModel::resetExecution, this, [this] {
685 ✔
90
    for(auto& p : this->m_inlets)
159 ✔
91
      p->executionReset();
70 ✔
92
    for(auto& p : this->m_outlets)
178 ✔
93
      p->executionReset();
89 ✔
94
  });
89 ✔
95
  // metadata().setInstanceName(*this);
96
}
×
97

98
ProcessModel::~ProcessModel()
1,318 ✔
99
{
1,318 ✔
100
  identified_object_destroying(this);
1,318 ✔
101
}
1,318 ✔
102

103
QString ProcessModel::effect() const noexcept
120 ✔
104
{
105
  return {};
120 ✔
106
}
107

108
void ProcessModel::setDurationAndScale(const TimeVal& newDuration) noexcept
×
109
{
110
  setDuration(newDuration);
×
111
}
×
112

113
void ProcessModel::setDurationAndGrow(const TimeVal& newDuration) noexcept
×
114
{
115
  setDuration(newDuration);
×
116
}
×
117

118
void ProcessModel::setDurationAndShrink(const TimeVal& newDuration) noexcept
×
119
{
120
  setDuration(newDuration);
×
121
}
×
122

123
ProcessModel::ProcessModel(DataStream::Deserializer& vis, QObject* parent)
700 ✔
124
    : Entity(vis, parent)
350 ✔
125
{
700 ✔
126
  ossia::disable_fpe();
350 ✔
127
  vis.writeTo(*this);
350 ✔
128
  con(metadata(), &score::ModelMetadata::NameChanged, this,
700 ✔
129
      [this] { prettyNameChanged(); });
350 ✔
130
}
×
131

132
ProcessModel::ProcessModel(JSONObject::Deserializer& vis, QObject* parent)
744 ✔
133
    : Entity(vis, parent)
372 ✔
134
{
744 ✔
135
  ossia::disable_fpe();
372 ✔
136
  vis.writeTo(*this);
372 ✔
137
  con(metadata(), &score::ModelMetadata::NameChanged, this,
744 ✔
138
      [this] { prettyNameChanged(); });
372 ✔
139
}
×
140

141
QString ProcessModel::prettyName() const noexcept
728 ✔
142
{
143
  return metadata().getName();
728 ✔
144
}
145

146
void ProcessModel::setParentDuration(ExpandMode mode, const TimeVal& t) noexcept
×
147
{
148
  switch(mode)
×
149
  {
150
    case ExpandMode::Scale:
151
      setDurationAndScale(t);
×
152
      break;
×
153
    case ExpandMode::GrowShrink: {
154
      if(duration() < t)
×
155
        setDurationAndGrow(t);
×
156
      else
157
        setDurationAndShrink(t);
×
158
      break;
×
159
    }
160
    case ExpandMode::ForceGrow: {
161
      if(duration() < t)
×
162
        setDurationAndGrow(t);
×
163
      break;
×
164
    }
165
    case ExpandMode::CannotExpand:
×
166
    default:
167
      break;
×
168
  }
169
}
×
170

171
TimeVal ProcessModel::contentDuration() const noexcept
×
172
{
173
  return TimeVal::zero();
×
174
}
175

176
void ProcessModel::setDuration(const TimeVal& other) noexcept
1 ✔
177
{
178
  m_duration = other;
1 ✔
179
  durationChanged(m_duration);
1 ✔
180
}
1 ✔
181

182
const TimeVal& ProcessModel::duration() const noexcept
1,285 ✔
183
{
184
  return m_duration;
1,285 ✔
185
}
186

187
ProcessStateDataInterface* ProcessModel::startStateData() const noexcept
200 ✔
188
{
189
  return nullptr;
200 ✔
190
}
191

192
ProcessStateDataInterface* ProcessModel::endStateData() const noexcept
200 ✔
193
{
194
  return nullptr;
200 ✔
195
}
196

197
Selection ProcessModel::selectableChildren() const noexcept
×
198
{
199
  return {};
×
200
}
201

202
Selection ProcessModel::selectedChildren() const noexcept
×
203
{
204
  return {};
×
205
}
206

207
void ProcessModel::setSelection(const Selection& s) const noexcept
1 ✔
208
{
209
  // OPTIMIZEME
210
  auto cld = this->findChildren<Selectable*>();
1 ✔
211
  for(Selectable* child : cld)
10 ✔
212
  {
213
    child->set(s.contains(child->parent()));
9 ✔
214
  }
215
}
1 ✔
216

217
Process::Inlet* ProcessModel::inlet(const Id<Process::Port>& p) const noexcept
4 ✔
218
{
219
  for(auto e : m_inlets)
11 ✔
220
    if(e->id() == p)
10 ✔
221
      return e;
3 ✔
222
  return nullptr;
1 ✔
223
}
4 ✔
224

225
Process::Outlet* ProcessModel::outlet(const Id<Process::Port>& p) const noexcept
1 ✔
226
{
227
  for(auto e : m_outlets)
1 ✔
228
    if(e->id() == p)
1 ✔
229
      return e;
1 ✔
230
  return nullptr;
×
231
}
1 ✔
232

233
void ProcessModel::loadPreset(const Preset& preset)
2 ✔
234
{
235
  const rapidjson::Document doc = readJson(preset.data);
2 ✔
236
  loadFixedControls(doc.GetArray(), *this);
2 ✔
237
}
2 ✔
238

239
Preset ProcessModel::savePreset() const noexcept
4 ✔
240
{
241
  Preset p;
4 ✔
242
  p.name = this->metadata().getName();
4 ✔
243
  p.key.key = this->concreteKey();
4 ✔
244

245
  JSONReader r;
4 ✔
246
  saveFixedControls(r, *this);
4 ✔
247
  p.data = r.toByteArray();
4 ✔
248
  return p;
4 ✔
249
}
4 ✔
250

251
std::vector<Preset> ProcessModel::builtinPresets() const noexcept
×
252
{
253
  return {};
×
254
}
255

256
void ProcessModel::ancestorStartDateChanged() { }
×
257

258
void ProcessModel::ancestorTempoChanged() { }
×
259

260
void ProcessModel::forEachControl(
×
261
    smallfun::function<void(ControlInlet&, const ossia::value&)> f) const
262
{
263
  for(const auto& inlet : m_inlets)
×
264
  {
265
    if(auto ctrl = qobject_cast<Process::ControlInlet*>(inlet))
×
266
    {
267
      f(*ctrl, ctrl->value());
×
268
    }
×
269
  }
270
}
×
271

272
void ProcessModel::setCreatingControls(bool ok) { }
×
273

274
bool ProcessModel::creatingControls() const noexcept
×
275
{
276
  return this->flags() & ProcessFlags::CreateControls;
×
277
}
278

279
void ProcessModel::setLoops(bool b)
18 ✔
280
{
281
  if(b != m_loops)
18 ✔
282
  {
283
    m_loops = b;
16 ✔
284
    loopsChanged(b);
16 ✔
285
  }
16 ✔
286
}
18 ✔
287

288
void ProcessModel::setStartOffset(TimeVal b)
10 ✔
289
{
290
  if(b != m_startOffset)
10 ✔
291
  {
292
    m_startOffset = b;
9 ✔
293
    startOffsetChanged(b);
9 ✔
294
  }
9 ✔
295
}
10 ✔
296

297
void ProcessModel::setLoopDuration(TimeVal b)
9 ✔
298
{
299
  if(b.msec() < 0.1)
9 ✔
300
    b = TimeVal::fromMsecs(0.1);
×
301

302
  if(b != m_loopDuration)
9 ✔
303
  {
304
    m_loopDuration = b;
9 ✔
305
    loopDurationChanged(b);
9 ✔
306
  }
9 ✔
307
}
9 ✔
308

309
QPointF ProcessModel::position() const noexcept
663 ✔
310
{
311
  return m_position;
663 ✔
312
}
313

314
QSizeF ProcessModel::size() const noexcept
723 ✔
315
{
316
  return m_size;
723 ✔
317
}
318

319
void ProcessModel::setPosition(const QPointF& v)
227 ✔
320
{
321
  if(v != m_position)
227 ✔
322
  {
323
    m_position = v;
225 ✔
324
    positionChanged(v);
225 ✔
325
  }
225 ✔
326
}
227 ✔
327

328
void ProcessModel::setSize(const QSizeF& v)
29 ✔
329
{
330
  if(v != m_size)
29 ✔
331
  {
332
    m_size = v;
29 ✔
333
    sizeChanged(v);
29 ✔
334
  }
29 ✔
335
}
29 ✔
336

337
FoldMode ProcessModel::foldMode() const noexcept
752 ✔
338
{
339
  return m_foldMode;
752 ✔
340
}
341

342
void ProcessModel::setFoldMode(FoldMode v)
6 ✔
343
{
344
  if(v != m_foldMode)
6 ✔
345
  {
346
    m_foldMode = v;
6 ✔
347
    foldModeChanged(v);
6 ✔
348
  }
6 ✔
349
}
6 ✔
350

351
bool ProcessModel::folded() const noexcept
70 ✔
352
{
353
  switch(m_foldMode)
70 ✔
354
  {
355
    case FoldMode::Folded:
356
      return true;
5 ✔
357
    case FoldMode::Unfolded:
358
      return false;
2 ✔
359
    case FoldMode::Auto:
63 ✔
360
    default:
361
      return std::ssize(m_inlets) > MaxUnpaginatedControls;
63 ✔
362
  }
363
}
70 ✔
364

365
double ProcessModel::getSlotHeight() const noexcept
3,912 ✔
366
{
367
  return m_slotHeight;
3,912 ✔
368
}
369

370
void ProcessModel::setSlotHeight(double v) noexcept
130 ✔
371
{
372
  m_slotHeight = v;
130 ✔
373
  slotHeightChanged(v);
130 ✔
374
}
130 ✔
375

376
void ProcessModel::setExecuting(bool e)
163 ✔
377
{
378
  m_executing = e;
163 ✔
379
}
163 ✔
380

381
std::optional<Process::MagneticInfo>
382
ProcessModel::magneticPosition(const QObject* o, const TimeVal t) const noexcept
×
383
{
384
  return {};
×
385
}
386

387
ProcessModel* parentProcess(QObject* obj) noexcept
3 ✔
388
{
389
  if(obj)
3 ✔
390
    obj = obj->parent();
3 ✔
391

392
  while(obj && !qobject_cast<ProcessModel*>(obj))
3 ✔
393
  {
394
    obj = obj->parent();
×
395
  }
396

397
  if(obj)
3 ✔
398
    return static_cast<ProcessModel*>(obj);
3 ✔
399
  return nullptr;
×
400
}
3 ✔
401

402
const ProcessModel* parentProcess(const QObject* obj) noexcept
×
403
{
404
  if(obj)
×
405
    obj = obj->parent();
×
406

407
  while(obj && !qobject_cast<const ProcessModel*>(obj))
×
408
  {
409
    obj = obj->parent();
×
410
  }
411

412
  if(obj)
×
413
    return static_cast<const ProcessModel*>(obj);
×
414
  return nullptr;
×
415
}
×
416

417
QString processLocalTreeAddress(const ProcessModel& proc)
×
418
{
419
  if(auto lt = findComponent<LocalTree::ProcessComponent>(proc.components()))
×
420
  {
421
    return QString::fromStdString(
×
422
        lt->node().get_device().get_name() + ":" + lt->node().osc_address());
×
423
  }
424
  return {};
×
425
}
×
426
}
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