tests: Test recursive signals on mouse events.

This commit is contained in:
Emmanuel Lepage Vallee 2016-08-17 02:52:28 -04:00
parent 370d333590
commit 46f6d28bdf
1 changed files with 22 additions and 0 deletions

View File

@ -9,6 +9,10 @@ local w
local img local img
local button local button
-- Also check recursive signals from events
local layout
local got_called = false
-- create a wibox. -- create a wibox.
table.insert(steps, function() table.insert(steps, function()
@ -55,6 +59,21 @@ table.insert(steps, function()
img = button._private.image img = button._private.image
assert(img) assert(img)
-- Test the click
layout = w.widget
assert(layout)
button:buttons(awful.util.table.join(
button:buttons(),
awful.button({}, 1, nil, function ()
button:emit_signal_recursive("test::recursive")
end)
))
layout:connect_signal("test::recursive", function()
got_called = true
end)
return true return true
end) end)
@ -111,6 +130,9 @@ end)
table.insert(steps, function() table.insert(steps, function()
assert(button._private.image == img) assert(button._private.image == img)
-- The button had plenty of clicks by now. Make sure everything worked
assert(got_called)
return true return true
end) end)