tests: Test `widget:add_button()`
This commit is contained in:
parent
ab1e62a332
commit
fa414a86a3
|
@ -2,7 +2,7 @@ local runner = require( "_runner" )
|
||||||
local wibox = require( "wibox" )
|
local wibox = require( "wibox" )
|
||||||
local awful = require( "awful" )
|
local awful = require( "awful" )
|
||||||
local beautiful = require( "beautiful" )
|
local beautiful = require( "beautiful" )
|
||||||
local gtable = require("gears.table")
|
local gdebug = require("gears.debug")
|
||||||
|
|
||||||
local steps = {}
|
local steps = {}
|
||||||
|
|
||||||
|
@ -64,12 +64,20 @@ table.insert(steps, function()
|
||||||
layout = w.widget
|
layout = w.widget
|
||||||
assert(layout)
|
assert(layout)
|
||||||
|
|
||||||
button:buttons(gtable.join(
|
-- Test both legacy and new APIs
|
||||||
button:buttons(),
|
gdebug.deprecate = function() end
|
||||||
|
|
||||||
|
assert(#button:buttons() == 4)
|
||||||
|
assert(#button.buttons == 1)
|
||||||
|
|
||||||
|
button:add_button(
|
||||||
awful.button({}, 1, nil, function ()
|
awful.button({}, 1, nil, function ()
|
||||||
button:emit_signal_recursive("test::recursive")
|
button:emit_signal_recursive("test::recursive")
|
||||||
end)
|
end)
|
||||||
))
|
)
|
||||||
|
|
||||||
|
assert(#button:buttons() == 8)
|
||||||
|
assert(#button.buttons == 2)
|
||||||
|
|
||||||
layout:connect_signal("test::recursive", function()
|
layout:connect_signal("test::recursive", function()
|
||||||
got_called = true
|
got_called = true
|
||||||
|
|
Loading…
Reference in New Issue