From b53ef90218633a1b7c9b0e726a45d86ecb2bfaf0 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Mon, 29 Oct 2018 20:06:45 -0700 Subject: source/*: Make updating callbacks possible Sometimes callers want to be able to update the callback used when the source is acted upon. This is needed for updating references stored in the callback. Tested: Run through the unit test suite. Change-Id: I78bda32569287964bfc9d49501869d3a2b497f3d Signed-off-by: William A. Kennington III --- test/source/time.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/source/time.cpp') diff --git a/test/source/time.cpp b/test/source/time.cpp index aa25da0..96a920e 100644 --- a/test/source/time.cpp +++ b/test/source/time.cpp @@ -90,6 +90,11 @@ TEST_F(TimeTest, ConstructSuccess) EXPECT_EQ(Time::TimePoint(std::chrono::microseconds(2000100)), saved_time); + time.set_callback(std::bind([]() {})); + EXPECT_EQ(0, handler(nullptr, 0, userdata)); + EXPECT_EQ(Time::TimePoint(std::chrono::microseconds(2000100)), + saved_time); + expect_time_destroy(expected_event, expected_source); } -- cgit v1.2.3