Add tests

This commit is contained in:
Grumph 2022-02-15 00:10:34 +01:00
parent c101859897
commit 808b17cd5c
1 changed files with 36 additions and 0 deletions

View File

@ -6,6 +6,7 @@ local awful = require("awful")
local keygrabber_a_active = false
local keygrabber_b_active = false
local keygrabber_c_active = false
-- Disable the deprecation to test both the current and legacy APIs.
local gdebug = require("gears.debug")
@ -34,6 +35,21 @@ local steps = {
stop_callback = function() keygrabber_b_active = false end,
export_keybindings = true,
}
local kgc = awful.keygrabber {
keybindings = {},
stop_key = "Escape",
stop_callback = function() keygrabber_c_active = false end,
export_keybindings = true,
}
kgc:add_keybinding(
awful.key {
modifiers = {},
key = "c",
on_press = function() keygrabber_c_active = true end
}
)
return true
end,
@ -76,6 +92,26 @@ local steps = {
return true
end
end,
function(count)
if count == 1 then
root.fake_input("key_press" , "c")
root.fake_input("key_release", "c")
end
if not keygrabber_a_active and not keygrabber_b_active and keygrabber_c_active then
return true
end
end,
function(count)
if count == 1 then
root.fake_input("key_press" , "Escape")
root.fake_input("key_release", "Escape")
end
if not keygrabber_a_active and not keygrabber_b_active and not keygrabber_c_active then
return true
end
end
}
runner.run_steps(steps)