2016-04-08 05:53:00 +02:00
|
|
|
local awful = require("awful")
|
|
|
|
|
|
|
|
local has_spawned = false
|
|
|
|
local steps = {
|
2016-12-27 21:39:08 +01:00
|
|
|
function(count)
|
|
|
|
if count <= 1 and not has_spawned and #client.get() < 2 then
|
|
|
|
awful.spawn("xterm")
|
|
|
|
awful.spawn("xterm")
|
|
|
|
has_spawned = true
|
|
|
|
|
|
|
|
elseif #client.get() >= 2 then
|
|
|
|
-- Test properties
|
|
|
|
client.focus = client.get()[1]
|
|
|
|
|
|
|
|
local s = mouse.screen
|
|
|
|
assert(s)
|
|
|
|
assert(s == screen[s])
|
|
|
|
|
|
|
|
-- Test padding
|
|
|
|
s.padding = 42
|
|
|
|
local counter = 0
|
|
|
|
for _, v in pairs(s.padding) do
|
|
|
|
assert(v == 42)
|
|
|
|
counter = counter + 1
|
|
|
|
end
|
|
|
|
assert(counter == 4)
|
|
|
|
|
2017-03-31 05:44:20 +02:00
|
|
|
s.padding = {
|
|
|
|
left = 1337,
|
|
|
|
right = 1337,
|
|
|
|
top = 1337,
|
|
|
|
bottom = 1337,
|
|
|
|
}
|
2016-12-27 21:39:08 +01:00
|
|
|
counter = 0
|
|
|
|
for _, v in pairs(s.padding) do
|
|
|
|
assert(v == 1337)
|
|
|
|
counter = counter + 1
|
|
|
|
end
|
|
|
|
assert(counter == 4)
|
|
|
|
|
|
|
|
counter = 0
|
2017-03-31 05:44:20 +02:00
|
|
|
for _, v in pairs(s.padding) do
|
2016-12-27 21:39:08 +01:00
|
|
|
assert(v == 1337)
|
|
|
|
counter = counter + 1
|
|
|
|
end
|
|
|
|
assert(counter == 4)
|
|
|
|
|
|
|
|
-- Test square distance
|
|
|
|
assert(s:get_square_distance(9999, 9999))
|
|
|
|
|
|
|
|
-- Test count
|
|
|
|
counter = 0
|
|
|
|
for _ in screen do
|
|
|
|
counter = counter + 1
|
|
|
|
end
|
|
|
|
|
|
|
|
assert(screen.count() == counter)
|
|
|
|
|
|
|
|
counter = 0
|
|
|
|
awful.screen.connect_for_each_screen(function()
|
|
|
|
counter = counter + 1
|
|
|
|
end)
|
|
|
|
assert(screen.count() == counter)
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
2019-06-15 08:17:34 +02:00
|
|
|
end,
|
|
|
|
-- Make sure the error code still works when all screens are gone.
|
|
|
|
function()
|
|
|
|
while screen.count() > 0 do
|
|
|
|
screen[1]:fake_remove()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Don't make the test fail.
|
|
|
|
local called = false
|
|
|
|
require("gears.debug").print_warning = function() called = true end
|
|
|
|
|
|
|
|
-- Cause an error in a protected call!
|
|
|
|
awesome.emit_signal("debug::error", "err")
|
|
|
|
|
|
|
|
assert(called)
|
|
|
|
|
2019-06-15 08:22:03 +02:00
|
|
|
return true
|
|
|
|
end,
|
|
|
|
-- Test the `automatic_factory` getter and setter.
|
|
|
|
function()
|
|
|
|
assert(type(screen.automatic_factory) == "boolean")
|
|
|
|
local orig = screen.automatic_factory
|
|
|
|
screen.automatic_factory = not orig
|
|
|
|
assert(screen.automatic_factory ~= orig)
|
|
|
|
assert(type(screen.automatic_factory) == "boolean")
|
|
|
|
screen.automatic_factory = not screen.automatic_factory
|
|
|
|
assert(screen.automatic_factory == orig)
|
2019-06-15 08:17:34 +02:00
|
|
|
return true
|
2016-12-27 21:39:08 +01:00
|
|
|
end
|
2016-04-08 05:53:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
require("_runner").run_steps(steps)
|
2016-12-27 21:39:08 +01:00
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|