tests: Make sure the legacy buttons/keys method are converted back.

This commit is contained in:
Emmanuel Lepage Vallee 2019-10-26 19:54:55 -04:00
parent 12a7d026c2
commit 4723c3218a
1 changed files with 12 additions and 4 deletions

View File

@ -168,7 +168,15 @@ for _, type_name in ipairs { "key", "button" } do
-- This *will* happen with older configs because `awful.rules` will -- This *will* happen with older configs because `awful.rules` will
-- loop the properties, find the old capi list and fail to understand -- loop the properties, find the old capi list and fail to understand
-- that the content should use the legacy API. -- that the content should use the legacy API.
c[type_name.."s"] = gtable.join(o1)
local joined = gtable.join(o1)
assert(#joined == 4)
c[type_name.."s"] = joined
-- It should have been converted to the new format.
assert(#c[type_name.."s"] == 1)
return true return true
end) end)
@ -190,7 +198,7 @@ for _, type_name in ipairs { "key", "button" } do
local c = mouse.screen.clients[1] local c = mouse.screen.clients[1]
assert(#c[type_name.."s"] ~= 0) assert(#c[type_name.."s"] == 1)
-- Test setting the object to `false` to simulate an inline Lua -- Test setting the object to `false` to simulate an inline Lua
-- expression gone wrong. This used to work and is rather -- expression gone wrong. This used to work and is rather
@ -201,7 +209,7 @@ for _, type_name in ipairs { "key", "button" } do
c[type_name.."s"] = {o1} c[type_name.."s"] = {o1}
assert(#c[type_name.."s"] ~= 0) assert(#c[type_name.."s"] == 1)
-- Test removing the objects using `nil`. -- Test removing the objects using `nil`.
c[type_name.."s"] = nil c[type_name.."s"] = nil
@ -210,7 +218,7 @@ for _, type_name in ipairs { "key", "button" } do
c[type_name.."s"] = {o1} c[type_name.."s"] = {o1}
assert(#c[type_name.."s"] ~= 0) assert(#c[type_name.."s"] == 1)
-- Test removing using `{}` -- Test removing using `{}`
c[type_name.."s"] = {} c[type_name.."s"] = {}