diff --git a/components/structures/src/new_frame.cpp b/components/structures/src/new_frame.cpp index 69780dab1c32aeff4dd134a42537b49641d5f96b..a290b25e5471e5d251b9545d0407f9b3b89df892 100644 --- a/components/structures/src/new_frame.cpp +++ b/components/structures/src/new_frame.cpp @@ -304,11 +304,11 @@ void Frame::forceStore() { d.status = ChannelStatus::INVALID; } - parent_->change_.trigger(*this, c.first); - uint64_t sig = (uint64_t(id()) << 32) + static_cast<unsigned int>(c.first); - const auto &i = parent_->change_channel_.find(sig); + //parent_->change_.trigger(*this, c.first); + //uint64_t sig = (uint64_t(id()) << 32) + static_cast<unsigned int>(c.first); + //const auto &i = parent_->change_channel_.find(sig); - if (i != parent_->change_channel_.end()) i->second.trigger(*this, c.first); + //if (i != parent_->change_channel_.end()) i->second.trigger(*this, c.first); } } diff --git a/components/structures/test/frame_unit.cpp b/components/structures/test/frame_unit.cpp index a092b391346b1c41e166d2997f5a9ec933bd79c1..33477e510cd77795595bdbf9a9c74ff78e6164f8 100644 --- a/components/structures/test/frame_unit.cpp +++ b/components/structures/test/frame_unit.cpp @@ -20,6 +20,7 @@ namespace data { class Pool { public: static Frame make(Session *s, FrameID id, uint64_t ts) { return Frame(nullptr, s, id, ts); } + static Frame make(Pool *p, Session *s, FrameID id, uint64_t ts) { return Frame(p, s, id, ts); } void release(Frame &f); @@ -1067,6 +1068,43 @@ TEST_CASE("ftl::data::Frame change events", "[3.4.1]") { f.store(); REQUIRE( event == 1 ); } + + SECTION("event on store of foreign change with flush") { + Session p; + Frame f = Feed::make(&p, FrameID(0,0), 0); + + int event = 0; + auto h = f.onChange([&event](Frame &frame, Channel c) { + event++; + return true; + }); + + f.createChange<int>(Channel::Pose, ChangeType::FOREIGN); + REQUIRE( event == 0 ); + + f.store(); + f.flush(); + REQUIRE( event == 1 ); + } + + SECTION("No event on flush of response frame") { + ftl::data::Pool p; + Session s; + Frame f = ftl::data::Pool::make(&p, &s, FrameID(0,0), 0); + + int event = 0; + auto h = f.onChange([&event](Frame &frame, Channel c) { + event++; + return true; + }); + + { + auto response = f.response(); + REQUIRE( event == 0 ); + response.create<int>(Channel::Control) = 55; + } + REQUIRE( event == 0 ); + } } /* #3.4.2 Not applicable as a unit test of Frame. See #3.2.5 */