tests: Test the new `awful.placement` aliases

This commit is contained in:
Emmanuel Lepage Vallee 2016-03-28 01:37:26 -04:00
parent d85b7eb3e5
commit dd0ea33015
11 changed files with 161 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,15 @@
-- Align a client to the vertical center of the parent area. --DOC_HEADER
-- @tparam drawable d A drawable (like `client`, `mouse` or `wibox`) --DOC_HEADER
-- @tparam[opt={}] table args Other arguments") --DOC_HEADER
-- @name center_vertical --DOC_HEADER
-- @class function --DOC_HEADER
screen[1]._resize {width = 128, height = 96} --DOC_HIDE
local awful = {placement = require("awful.placement")} --DOC_HIDE
--[[local c = ]]client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE
awful.placement.center_vertical(client.focus)
-- print("\n\n\n\n", c.y, c.height, screen[1].geometry.height/2-30/2)--FIXME
-- assert(c.x == 45 and c.y==screen[1].geometry.height/2-30/2--DOC_HIDE
-- and c.width==40 and c,height==30)--DOC_HIDE

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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