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

ossia / score / 35899133125

23 Sep 2026 05:57PM UTC coverage: 41.488% (+1.2%) from 40.337%
35899133125

push

github

jcelerier
3rdparty: follow the merged libossia

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

123236 of 297041 relevant lines covered (41.49%)

113626.05 hits per line

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

1.75
/src/plugins/score-plugin-dataflow/Dataflow/DropPortInScenario.cpp
1
#include "DropPortInScenario.hpp"
2

3
#include <Scenario/Application/Drops/ScenarioDropHandler.hpp>
4
#include <Scenario/Commands/CommandAPI.hpp>
5
#include <Scenario/Commands/Interval/AddProcessToInterval.hpp>
6
#include <Scenario/Process/Algorithms/Accessors.hpp>
7
#include <Scenario/Process/ScenarioPresenter.hpp>
8

9
#include <Dataflow/PortItem.hpp>
10
namespace Dataflow
11
{
12
DropPortInScenario::DropPortInScenario() { }
1,761✔
13

14
bool DropPortInScenario::canDrop(const QMimeData& mime) const noexcept
×
15
{
16
  if(mime.hasFormat(score::mime::port()))
×
17
  {
18
    auto base_port = Dataflow::PortItem::clickedPort;
×
19
    if(!base_port || base_port->port().type() != Process::PortType::Message
×
20
       || qobject_cast<const Process::Outlet*>(&base_port->port()))
×
21
      return false;
×
22

23
    return bool(dynamic_cast<Dataflow::AutomatablePortItem*>(base_port));
×
24
  }
25
  return false;
×
26
}
×
27

28
bool DropPortInScenario::drop(
×
29
    const Scenario::ScenarioPresenter& pres, QPointF pos, const QMimeData& mime)
30
{
31
  if(mime.hasFormat(score::mime::port()))
×
32
  {
33
    auto base_port = Dataflow::PortItem::clickedPort;
×
34
    if(!base_port || base_port->port().type() != Process::PortType::Message
×
35
       || qobject_cast<const Process::Outlet*>(&base_port->port()))
×
36
      return false;
×
37

38
    auto port = dynamic_cast<Dataflow::AutomatablePortItem*>(base_port);
×
39
    if(!port)
×
40
      return false;
×
41

42
    Scenario::Command::Macro m{
×
43
        new Scenario::Command::AddProcessInNewBoxMacro, pres.context().context};
×
44

45
    // Create a box.
46
    const Scenario::ProcessModel& scenar = pres.model();
×
47
    Scenario::Point pt = pres.toScenarioPoint(pos);
×
48

49
    // 5 seconds.
50
    // TODO instead use a percentage of the currently displayed view
51
    TimeVal t = TimeVal::fromMsecs(5000);
×
52

53
    auto& interval = m.createBox(scenar, pt.date, pt.date + t, pt.y);
×
54

55
    if(Scenario::dropStartsOnPlay())
×
56
      Scenario::addStartOnPlayTrigger(m, Scenario::startTimeSync(interval, scenar));
×
57

58
    // Create process
59
    auto ok = port->on_createAutomation(
×
60
        interval, [&](score::Command* cmd) { m.submit(cmd); }, pres.context().context);
×
61
    if(!ok)
×
62
    {
63
      return false;
×
64
    }
65

66
    m.showRack(interval);
×
67

68
    m.commit();
×
69
    return true;
×
70
  }
×
71

72
  return false;
×
73
}
×
74

75
bool DropPortInInterval::drop(
×
76
    const score::DocumentContext& ctx, const Scenario::IntervalModel& interval,
77
    QPointF p, const QMimeData& mime)
78
{
79
  if(mime.hasFormat(score::mime::port()))
×
80
  {
81
    auto base_port = Dataflow::PortItem::clickedPort;
×
82
    if(!base_port || base_port->port().type() != Process::PortType::Message
×
83
       || qobject_cast<const Process::Outlet*>(&base_port->port()))
×
84
      return false;
×
85

86
    auto port = dynamic_cast<Dataflow::AutomatablePortItem*>(base_port);
×
87
    if(!port)
×
88
      return false;
×
89

90
    Scenario::Command::Macro m{new Scenario::Command::DropProcessInIntervalMacro, ctx};
×
91
    auto ok = port->on_createAutomation(
×
92
        interval, [&](score::Command* cmd) { m.submit(cmd); }, ctx);
×
93
    if(!ok)
×
94
    {
95
      return false;
×
96
    }
97

98
    m.showRack(interval);
×
99
    m.commit();
×
100
    return true;
×
101
  }
×
102

103
  return false;
×
104
}
×
105

106
}
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