Merge pull request #2992 from SethBarberee/placement_spec

add test spec for placement
This commit is contained in:
mergify[bot] 2020-02-16 17:57:54 +00:00 committed by GitHub
commit 81d6521149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
describe("awful.placement", function()
-- tiny hack to make sure we don't get errors about connect_signal
package.loaded["awful.screen"] = {}
local place = require("awful.placement")
it("awful.placement.closest_corner (top left)", function()
local _, corner = place.closest_corner(
{coords=function() return {x = 100, y=100} end},
{include_sides = true, bounding_rect = {x=0, y=0, width=200, height=200}}
)
assert(corner == "top_left")
end)
it("awful.placement.closest_corner (bottom)", function()
local _, corner = place.closest_corner(
{coords=function() return {x = 100, y=200} end},
{include_sides = true, bounding_rect = {x=0, y=0, width=200, height=200}}
)
assert(corner == "bottom")
end)
it("awful.placement.closest_corner (bottom right)", function()
local _, corner = place.closest_corner(
{coords=function() return {x = 200, y=200} end},
{include_sides = true, bounding_rect = {x=0, y=0, width=200, height=200}}
)
assert(corner == "bottom_right")
end)
end)