From fa414a86a31d6adb378e52c82e006d81cc95c94e Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Fri, 28 Dec 2018 03:04:42 -0500 Subject: [PATCH] tests: Test `widget:add_button()` --- tests/test-awful-widget-button.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test-awful-widget-button.lua b/tests/test-awful-widget-button.lua index 09c608de..df1a6333 100644 --- a/tests/test-awful-widget-button.lua +++ b/tests/test-awful-widget-button.lua @@ -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