tests: Change only_on_screen to create fake screens "in sight".

Previously, it would create screens outside of a visible output area. In
the following commit, this will be tracked and a warning is printed when
it happens. This makes the test fail.
This commit is contained in:
Emmanuel Lepage Vallee 2019-06-24 23:23:12 -04:00
parent dcdbc679f7
commit fa7f1d689e
1 changed files with 22 additions and 3 deletions

View File

@ -4,8 +4,22 @@ local runner = require("_runner")
local wibox = require("wibox") local wibox = require("wibox")
local awful = require("awful") local awful = require("awful")
-- Make sure we have at least two screens to test this on -- Make sure we have at least two screens to test this on.
screen.fake_add(-100, -100, 50, 50) local origin_width = screen[1].geometry.width
screen[1]:fake_resize(
screen[1].geometry.x,
screen[1].geometry.y,
origin_width/2,
screen[1].geometry.height
)
screen.fake_add(
screen[1].geometry.x+origin_width/2,
screen[1].geometry.y,
origin_width/2,
screen[1].geometry.height
)
assert(screen.count() == 2) assert(screen.count() == 2)
-- Each screen gets a wibox displaying our only_on_screen widget -- Each screen gets a wibox displaying our only_on_screen widget
@ -116,7 +130,12 @@ table.insert(steps, function()
for s in screen do for s in screen do
assert(not widget_visible_on(s)) assert(not widget_visible_on(s))
end end
screen.fake_add(-100, -100, 50, 50) screen.fake_add(
screen[1].geometry.x+origin_width/2,
screen[1].geometry.y,
origin_width/2,
screen[1].geometry.height
)
return true return true
end) end)
table.insert(steps, function() table.insert(steps, function()