Skip to content
Snippets Groups Projects
Commit 26a73e1a authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Remove some duplicate change events

parent cc8daf32
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #28424 passed
......@@ -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);
}
}
......
......@@ -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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment