Add late installed listeners

Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
rahix 2019-04-17 02:52:55 +02:00
parent c33fdd41a6
commit 50ae923ef7
3 changed files with 31 additions and 2 deletions

View file

@ -195,3 +195,22 @@ function test_listen_cancel_remote()
bc1:set("lcanr1", 21)
assert_equal(1, n, "wrong number of listener invokations")
end
function test_listen_late_install()
local bc1 = BaseControl:new()
local addr1 = network.get_scene()
local n = 0
bc1:listen("late1", BaseControl.Query.Change, function()
n = n + 1
end)
local bc2 = BaseControl:new()
local addr2 = network.get_scene()
bc2:register("late1", 1234)
bc2:finalize()
assert_equal(0, n, "wrong number of listener invokations")
bc2:set("late1", 34)
assert_equal(1, n, "wrong number of listener invokations")
end