tests: Test `widget:add_button()`

This commit is contained in:
Emmanuel Lepage Vallee 2018-12-28 03:04:42 -05:00
parent ab1e62a332
commit fa414a86a3
1 changed files with 12 additions and 4 deletions

View File

@ -2,7 +2,7 @@ local runner = require( "_runner" )
local wibox = require( "wibox" )
local awful = require( "awful" )
local beautiful = require( "beautiful" )
local gtable = require("gears.table")
local gdebug = require("gears.debug")
local steps = {}
@ -64,12 +64,20 @@ table.insert(steps, function()
layout = w.widget
assert(layout)
button:buttons(gtable.join(
button:buttons(),
-- Test both legacy and new APIs
gdebug.deprecate = function() end
assert(#button:buttons() == 4)
assert(#button.buttons == 1)
button:add_button(
awful.button({}, 1, nil, function ()
button:emit_signal_recursive("test::recursive")
end)
))
)
assert(#button:buttons() == 8)
assert(#button.buttons == 2)
layout:connect_signal("test::recursive", function()
got_called = true