tests: Test all `awful.placement.stretch` aliases

This commit is contained in:
Emmanuel Lepage Vallee 2016-03-28 01:53:39 -04:00
parent 19913ba62d
commit 7b7d09edff
4 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,17 @@
-- Stretch the drawable to the bottom of the parent area. --DOC_HEADER
-- @tparam drawable d A drawable (like `client` or `wibox`) --DOC_HEADER
-- @tparam[opt={}] table args Other arguments --DOC_HEADER
-- @name stretch_down --DOC_HEADER
-- @class function --DOC_HEADER
screen[1]._resize {width = 128, height = 96} --DOC_HIDE
local placement = require("awful.placement") --DOC_HIDE
local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE
placement.stretch_down(client.focus)
assert(c.x==45) --DOC_HIDE
assert(c.y==35) --DOC_HIDE
assert(c.width == 40) --DOC_HIDE
assert(c.y+c.height == --DOC_HIDE
screen[1].geometry.y + screen[1].geometry.height) --DOC_HIDE

View File

@ -0,0 +1,14 @@
-- Stretch the drawable to the left of the parent area. --DOC_HEADER
-- @tparam drawable d A drawable (like `client` or `wibox`) --DOC_HEADER
-- @tparam[opt={}] table args Other arguments --DOC_HEADER
-- @name stretch_left --DOC_HEADER
-- @class function --DOC_HEADER
screen[1]._resize {width = 128, height = 96} --DOC_HIDE
local placement = require("awful.placement") --DOC_HIDE
local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE
placement.stretch_left(client.focus)
assert(c.x == c.border_width and c.y == 35 and c.height == 30 --DOC_HIDE
and c.width == 45+40) --DOC_HIDE

View File

@ -0,0 +1,14 @@
-- Stretch the drawable to the right of the parent area. --DOC_HEADER
-- @tparam drawable d A drawable (like `client` or `wibox`) --DOC_HEADER
-- @tparam[opt={}] table args Other arguments --DOC_HEADER
-- @name stretch_right --DOC_HEADER
-- @class function --DOC_HEADER
screen[1]._resize {width = 128, height = 96} --DOC_HIDE
local placement = require("awful.placement") --DOC_HIDE
local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE
placement.stretch_right(client.focus)
local right = screen[1].geometry.x + screen[1].geometry.width --DOC_HIDE
assert(c.height == 30 and c.x == 45 and c.x+c.width+c.border_width == right) --DOC_HIDE

View File

@ -0,0 +1,17 @@
-- Stretch the drawable to the top of the parent area. --DOC_HEADER
-- @tparam drawable d A drawable (like `client` or `wibox`) --DOC_HEADER
-- @tparam[opt={}] table args Other arguments --DOC_HEADER
-- @name stretch_up --DOC_HEADER
-- @class function --DOC_HEADER
screen[1]._resize {width = 128, height = 96} --DOC_HIDE
local placement = require("awful.placement") --DOC_HIDE
local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE
placement.stretch_up(client.focus)
assert(c.y==c.border_width) --DOC_HIDE
assert(c.x==45) --DOC_HIDE
assert(c.width == 40) --DOC_HIDE
print(c.height)
assert(c.height == 35+30) --DOC_HIDE