From 2c919ed93669240b94f65ecb141b359f9f1e76bf Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Fri, 31 Jan 2020 07:58:44 -0600 Subject: [PATCH] add test spec for placement --- spec/awful/placement_spec.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 spec/awful/placement_spec.lua diff --git a/spec/awful/placement_spec.lua b/spec/awful/placement_spec.lua new file mode 100644 index 00000000..7a66f25c --- /dev/null +++ b/spec/awful/placement_spec.lua @@ -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)