Skip to content

Commit d1ade28

Browse files
committed
add test coverage for hotkeys_popup bg override
1 parent 29dd7e7 commit d1ade28

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/test-awesomerc.lua

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,57 @@ local steps = {
323323
end
324324
end
325325
end,
326+
-- Test hotkeys popup with override_label_bgs option
327+
function(count)
328+
if count == 1 then
329+
local custom_hotkeys_widget = hotkeys_widget.new({
330+
override_label_bgs = true,
331+
label_bg = "#FF0000"
332+
})
333+
334+
assert(custom_hotkeys_widget.override_label_bgs == true)
335+
assert(custom_hotkeys_widget.label_bg == "#FF0000")
336+
337+
-- Show the popup to exercise the _group_label method with override_label_bgs = true
338+
local s = awful.screen.focused()
339+
custom_hotkeys_widget:show_help(nil, s)
340+
341+
test_context.custom_hotkeys_widget = custom_hotkeys_widget
342+
return nil
343+
elseif count == 2 then
344+
-- Verify the popup is visible and working
345+
local custom_widget = test_context.custom_hotkeys_widget
346+
assert(custom_widget._cached_wiboxes)
347+
348+
-- Hide the popup
349+
root.fake_input("key_press", "Escape")
350+
root.fake_input("key_release", "Escape")
351+
352+
return nil
353+
elseif count == 3 then
354+
-- Test with override_label_bgs = false (default)
355+
local default_widget = hotkeys_widget.new({
356+
override_label_bgs = false
357+
})
358+
359+
assert(default_widget.override_label_bgs == false)
360+
361+
-- Show the popup to exercise the _group_label method with override_label_bgs = false
362+
local s = awful.screen.focused()
363+
default_widget:show_help(nil, s)
364+
365+
test_context.default_hotkeys_widget = default_widget
366+
return nil
367+
elseif count == 4 then
368+
-- Clean up
369+
root.fake_input("key_press", "Escape")
370+
root.fake_input("key_release", "Escape")
371+
372+
test_context.custom_hotkeys_widget = nil
373+
test_context.default_hotkeys_widget = nil
374+
return true
375+
end
376+
end,
326377
-- Test the `c:activate{}` keybindings.
327378
function()
328379
client.connect_signal("request::activate", function()

0 commit comments

Comments
 (0)