diff --git a/tests/examples/awful/placement/bottom.lua b/tests/examples/awful/placement/bottom.lua new file mode 100644 index 00000000..814d3546 --- /dev/null +++ b/tests/examples/awful/placement/bottom.lua @@ -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 diff --git a/tests/examples/awful/placement/bottom_left.lua b/tests/examples/awful/placement/bottom_left.lua new file mode 100644 index 00000000..f1da6045 --- /dev/null +++ b/tests/examples/awful/placement/bottom_left.lua @@ -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 diff --git a/tests/examples/awful/placement/bottom_right.lua b/tests/examples/awful/placement/bottom_right.lua new file mode 100644 index 00000000..1c6d7b20 --- /dev/null +++ b/tests/examples/awful/placement/bottom_right.lua @@ -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 diff --git a/tests/examples/awful/placement/center_horizontal.lua b/tests/examples/awful/placement/center_horizontal.lua new file mode 100644 index 00000000..c8e2874c --- /dev/null +++ b/tests/examples/awful/placement/center_horizontal.lua @@ -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 diff --git a/tests/examples/awful/placement/center_vertical.lua b/tests/examples/awful/placement/center_vertical.lua new file mode 100644 index 00000000..18306088 --- /dev/null +++ b/tests/examples/awful/placement/center_vertical.lua @@ -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 diff --git a/tests/examples/awful/placement/centered.lua b/tests/examples/awful/placement/centered.lua new file mode 100644 index 00000000..5b97a16f --- /dev/null +++ b/tests/examples/awful/placement/centered.lua @@ -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 diff --git a/tests/examples/awful/placement/left.lua b/tests/examples/awful/placement/left.lua new file mode 100644 index 00000000..f7e8c8cf --- /dev/null +++ b/tests/examples/awful/placement/left.lua @@ -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 diff --git a/tests/examples/awful/placement/right.lua b/tests/examples/awful/placement/right.lua new file mode 100644 index 00000000..1ba092c9 --- /dev/null +++ b/tests/examples/awful/placement/right.lua @@ -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 diff --git a/tests/examples/awful/placement/top.lua b/tests/examples/awful/placement/top.lua new file mode 100644 index 00000000..ab1bdc0b --- /dev/null +++ b/tests/examples/awful/placement/top.lua @@ -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 diff --git a/tests/examples/awful/placement/top_left.lua b/tests/examples/awful/placement/top_left.lua new file mode 100644 index 00000000..208e86eb --- /dev/null +++ b/tests/examples/awful/placement/top_left.lua @@ -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 diff --git a/tests/examples/awful/placement/top_right.lua b/tests/examples/awful/placement/top_right.lua new file mode 100644 index 00000000..9655032f --- /dev/null +++ b/tests/examples/awful/placement/top_right.lua @@ -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