From 46f6d28bdfe4625d143a24c359fca702e35455c3 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 17 Aug 2016 02:52:28 -0400 Subject: [PATCH] tests: Test recursive signals on mouse events. --- tests/test-awful-widget-button.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test-awful-widget-button.lua b/tests/test-awful-widget-button.lua index ffb84e12c..be99c5653 100644 --- a/tests/test-awful-widget-button.lua +++ b/tests/test-awful-widget-button.lua @@ -9,6 +9,10 @@ local w local img local button +-- Also check recursive signals from events +local layout +local got_called = false + -- create a wibox. table.insert(steps, function() @@ -55,6 +59,21 @@ table.insert(steps, function() img = button._private.image 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 end) @@ -111,6 +130,9 @@ end) table.insert(steps, function() assert(button._private.image == img) + -- The button had plenty of clicks by now. Make sure everything worked + assert(got_called) + return true end)