tests: Test the tag `request::layouts`.

This commit is contained in:
Emmanuel Lepage Vallee 2019-11-30 20:12:05 -05:00 committed by Emmanuel Lepage-Vallee
parent 6b427e73a8
commit 839dddee25
1 changed files with 42 additions and 0 deletions

View File

@ -1,5 +1,6 @@
local awful = require("awful") local awful = require("awful")
local gtable = require("gears.table") local gtable = require("gears.table")
local gdebug = require("gears.debug")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local function check_order() local function check_order()
@ -196,6 +197,26 @@ local steps = {
return true return true
end, end,
-- Test adding and removing layouts.
function()
local t = mouse.screen.tags[9]
local count = #t.layouts
t:append_layout(awful.layout.suit.floating)
assert(#t.layouts == count + 1)
t:append_layouts({
awful.layout.suit.floating,
awful.layout.suit.floating,
})
assert(#t.layouts == count + 3)
t:remove_layout(awful.layout.suit.floating)
assert(#t.layouts == count)
return true
end
} }
local multi_screen_steps = {} local multi_screen_steps = {}
@ -313,6 +334,27 @@ local ms = require("_multi_screen")
ms.disable_wibox() ms.disable_wibox()
ms(steps, multi_screen_steps) ms(steps, multi_screen_steps)
-- Check deprecation.
table.insert(steps, function()
assert(#awful.layout.layouts > 0)
local called1, called2 = false, false
gdebug.deprecate = function() called1 = true end
gdebug.print_warning = function() called2 = true end
awful.layout.layouts = {}
assert(called2)
assert(not called1)
assert(#awful.layout.layouts == 0)
-- Test the random property setter.
awful.layout.foo = "bar"
assert(awful.layout.foo == "bar")
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