tests: Test the tag index more often

This commit is contained in:
Emmanuel Lepage Vallee 2016-08-22 17:25:50 -04:00
parent 99657f49cf
commit f2bb0ab871
1 changed files with 23 additions and 3 deletions

View File

@ -3,6 +3,14 @@ local beautiful = require("beautiful")
awful.util.deprecate = function() end awful.util.deprecate = function() end
local function check_order()
local tags = mouse.screen.tags
for k, v in ipairs(tags) do
assert(k == v.index)
end
end
local has_spawned = false local has_spawned = false
local steps = { local steps = {
@ -20,29 +28,39 @@ local tags = mouse.screen.tags
assert(#mouse.screen.tags == 9) assert(#mouse.screen.tags == 9)
for k, v in ipairs(tags) do check_order()
assert(k == v.index)
end
tags[7].index = 9 tags[7].index = 9
assert(tags[7].index == 9) assert(tags[7].index == 9)
check_order()
tags[7].index = 4 tags[7].index = 4
assert(tags[7].index == 4) assert(tags[7].index == 4)
check_order()
awful.tag.move(5, tags[7]) awful.tag.move(5, tags[7])
assert(tags[7].index == 5) assert(tags[7].index == 5)
check_order()
tags[1]:swap(tags[3]) tags[1]:swap(tags[3])
check_order()
assert(tags[1].index == 3) assert(tags[1].index == 3)
assert(tags[3].index == 1) assert(tags[3].index == 1)
check_order()
awful.tag.swap(tags[1], tags[3]) awful.tag.swap(tags[1], tags[3])
assert(tags[3].index == 3) assert(tags[3].index == 3)
assert(tags[1].index == 1) assert(tags[1].index == 1)
check_order()
-- Test add, icon and delete -- Test add, icon and delete
client.focus = client.get()[1] client.focus = client.get()[1]
@ -52,6 +70,8 @@ assert(beautiful.awesome_icon)
local t = awful.tag.add("Test", {clients={c}, icon = beautiful.awesome_icon}) local t = awful.tag.add("Test", {clients={c}, icon = beautiful.awesome_icon})
check_order()
local found = false local found = false
tags = mouse.screen.tags tags = mouse.screen.tags