From f2bb0ab87101ea752f8f72b9d2497f3d747111bb Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 22 Aug 2016 17:25:50 -0400 Subject: [PATCH] tests: Test the tag index more often --- tests/test-awful-tag.lua | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/test-awful-tag.lua b/tests/test-awful-tag.lua index 076cd0b35..3f684ad62 100644 --- a/tests/test-awful-tag.lua +++ b/tests/test-awful-tag.lua @@ -3,6 +3,14 @@ local beautiful = require("beautiful") 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 steps = { @@ -20,29 +28,39 @@ local tags = mouse.screen.tags assert(#mouse.screen.tags == 9) -for k, v in ipairs(tags) do - assert(k == v.index) -end +check_order() tags[7].index = 9 assert(tags[7].index == 9) +check_order() + tags[7].index = 4 assert(tags[7].index == 4) +check_order() + awful.tag.move(5, tags[7]) assert(tags[7].index == 5) +check_order() + tags[1]:swap(tags[3]) +check_order() + assert(tags[1].index == 3) assert(tags[3].index == 1) +check_order() + awful.tag.swap(tags[1], tags[3]) assert(tags[3].index == 3) assert(tags[1].index == 1) +check_order() + -- Test add, icon and delete 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}) +check_order() + local found = false tags = mouse.screen.tags