tests: Test clearing a tag.

This commit is contained in:
Emmanuel Lepage Vallee 2020-09-14 00:30:07 -07:00
parent b1b9bd838d
commit a0fda78714
1 changed files with 38 additions and 0 deletions

View File

@ -355,6 +355,44 @@ table.insert(steps, function()
return true return true
end) end)
-- Check tag:clear()
table.insert(steps, function()
screen[1].tags[1]:view_only()
mouse.coords {
x = screen[1].geometry.x + 1,
y = screen[1].geometry.y + 1,
}
awful.spawn("xterm")
awful.spawn("xterm")
return true
end)
table.insert(steps, function()
if #screen[1].tags[1]:clients() ~= 2 then return end
local old_clients = screen[1].tags[1]:clients()
local clear_called, untagged = false, 0
screen[1].tags[1]:connect_signal("cleared", function() clear_called = true end)
screen[1].tags[1]:connect_signal("untagged", function()
untagged = untagged + 1
end)
screen[1].tags[1]:clear{}
assert(#screen[1].tags[1]:clients() == 0)
assert(clear_called)
assert(untagged == 2)
for _, c in ipairs(old_clients) do
assert(#c:tags() > 0)
end
return true
end)
require("_runner").run_steps(steps) require("_runner").run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80