Skip to content

Commit

Permalink
[ci] Work on build & test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Sep 23, 2023
1 parent 101bdf9 commit bc4592b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 21 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/libremidi
5 changes: 3 additions & 2 deletions src/ossia-pd/src/object_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,11 @@ void object_base::set_description()
switch(m_description[i].a_type)
{
case A_SYMBOL:
fmt::format_to(description, "{} ", m_description[i].a_w.w_symbol->s_name);
fmt::format_to(
fmt::appender(description), "{} ", m_description[i].a_w.w_symbol->s_name);
break;
case A_FLOAT:
fmt::format_to(description, "{} ", m_description[i].a_w.w_float);
fmt::format_to(fmt::appender(description), "{} ", m_description[i].a_w.w_float);
break;
default:
break;
Expand Down
4 changes: 2 additions & 2 deletions src/ossia-python/ossia_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ PYBIND11_MODULE(ossia_python, m)
py::class_<ossia::net::midi::midi_info>(m, "MidiInfo")
.def(py::init())
.def_readonly("type", &ossia::net::midi::midi_info::type)
.def_readonly("device", &ossia::net::midi::midi_info::device)
.def_readonly("port", &ossia::net::midi::midi_info::port);
.def_readonly("handle", &ossia::net::midi::midi_info::handle)
.def_readonly("virtual", &ossia::net::midi::midi_info::is_virtual);

py::enum_<ossia::net::midi::midi_info::Type>(m, "MidiDeviceType", py::arithmetic())
.value("Output", ossia::net::midi::midi_info::Type::Output)
Expand Down
2 changes: 2 additions & 0 deletions src/ossia/dataflow/execution_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ struct OSSIA_EXPORT execution_state : public Nano::Observer
double start_date{}; // in ns, for vst
double cur_date{};

#if !defined(OSSIA_TESTING)
private:
#endif
void get_new_values();

void register_parameter(ossia::net::parameter_base& p);
Expand Down
9 changes: 7 additions & 2 deletions src/ossia/dataflow/nodes/messages.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#pragma once
#include <ossia/dataflow/data.hpp>
#include <ossia/dataflow/execution_state.hpp>
#include <ossia/dataflow/graph_node.hpp>
#include <ossia/dataflow/value_port.hpp>
#include <ossia/editor/state/message.hpp>

namespace ossia::nodes
{
// This is only used for testing so not very efficient by design
class messages final : public ossia::graph_node
{
public:
Expand All @@ -14,9 +17,11 @@ class messages final : public ossia::graph_node
{
for(auto& msg : data)
{
e.insert(
msg.dest.address(),
ossia::value_port p;
p.add_local_value(
ossia::typed_value{msg.message_value, msg.dest.index, msg.dest.unit});

e.impl->insert(msg.dest.address(), p);
}
}

Expand Down
36 changes: 22 additions & 14 deletions tests/Editor/ScenarioAlgoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <ossia/detail/config.hpp>

#include <ossia/dataflow/execution/merged_policy.hpp>
#include <ossia/dataflow/graph/graph.hpp>
#include <ossia/dataflow/node_process.hpp>
#include <ossia/dataflow/nodes/messages.hpp>
Expand Down Expand Up @@ -910,6 +911,12 @@ TEST_CASE("test_autom_and_state", "test_autom_and_state")
// s.interval->tick(1_tv);
}

static auto& get_value_state(ossia::execution_state& s)
{
return static_cast<ossia::merged_execution_state_policy*>(s.m_policy.get())
->m_valueState;
};

TEST_CASE("test_percentage", "test_percentage")
{

Expand Down Expand Up @@ -937,31 +944,31 @@ TEST_CASE("test_percentage", "test_percentage")
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.size() == 1);
REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(0.f));
REQUIRE(get_value_state(s).size() == 1);
REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(0.f));
}

s.interval->tick(1_tv, default_request());
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.size() == 1);
REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(0.5f));
REQUIRE(get_value_state(s).size() == 1);
REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(0.5f));
}

s.interval->tick(1_tv, default_request());
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.size() == 1);
REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(1.f));
REQUIRE(get_value_state(s).size() == 1);
REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(1.f));
}

s.interval->tick(1_tv, default_request());
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.empty());
REQUIRE(get_value_state(s).empty());
}
}

Expand Down Expand Up @@ -991,31 +998,32 @@ TEST_CASE("test_percentage_long", "test_percentage_long")
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.size() == 1);
REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(0.f));
REQUIRE(get_value_state(s).size() == 1);
REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(0.f));
}

s.interval->tick(3_tv, default_request());
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.size() == 1);
REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(3. / 5.));
REQUIRE(get_value_state(s).size() == 1);
REQUIRE(
get_value_state(s).begin()->second.back().first.value == ossia::value(3. / 5.));
}

s.interval->tick(7_tv, default_request());
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.size() == 1);
REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(1.f));
REQUIRE(get_value_state(s).size() == 1);
REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(1.f));
}

s.interval->tick(1_tv, default_request());
{
ossia::execution_state s;
g.state(s);
REQUIRE(s.m_valueState.empty());
REQUIRE(get_value_state(s).empty());
}
}

Expand Down

0 comments on commit bc4592b

Please sign in to comment.