From ef5ec333cc590733f2231b513d14a323421ad59d Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 28 Mar 2016 02:14:09 -0400 Subject: [PATCH] tests: Test the remaining existing `awful.placement` methods. Notes that some asserts are missing because the tests fail. This will be fixed later. It is not a regression. --- .../awful/placement/next_to_mouse.lua | 8 ++++++ .../examples/awful/placement/no_offscreen.lua | 9 +++++++ tests/examples/awful/placement/no_overlap.lua | 26 +++++++++++++++++++ .../examples/awful/placement/under_mouse.lua | 8 ++++++ 4 files changed, 51 insertions(+) create mode 100644 tests/examples/awful/placement/next_to_mouse.lua create mode 100644 tests/examples/awful/placement/no_offscreen.lua create mode 100644 tests/examples/awful/placement/no_overlap.lua create mode 100644 tests/examples/awful/placement/under_mouse.lua diff --git a/tests/examples/awful/placement/next_to_mouse.lua b/tests/examples/awful/placement/next_to_mouse.lua new file mode 100644 index 000000000..45c76ddce --- /dev/null +++ b/tests/examples/awful/placement/next_to_mouse.lua @@ -0,0 +1,8 @@ +screen[1]._resize {width = 128, height = 96} --DOC_HIDE +local awful = {placement = require("awful.placement")} --DOC_HIDE +client.gen_fake {x = 10, y = 10, width=40, height=30} --DOC_HIDE + +mouse.coords {x= 50, y=50} --DOC_HIDE +mouse.push_history() --DOC_HIDE + +awful.placement.next_to_mouse(client.focus) diff --git a/tests/examples/awful/placement/no_offscreen.lua b/tests/examples/awful/placement/no_offscreen.lua new file mode 100644 index 000000000..1f65cdb42 --- /dev/null +++ b/tests/examples/awful/placement/no_offscreen.lua @@ -0,0 +1,9 @@ +local awful = {placement = require("awful.placement")} --DOC_HIDE + +local c = client.gen_fake {x = -30, y = -30, width= 100, height=100} --DOC_HIDE + +print("Before:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE + +awful.placement.no_offscreen(c)--, {honor_workarea=true, margins=40}) + +print("After:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE diff --git a/tests/examples/awful/placement/no_overlap.lua b/tests/examples/awful/placement/no_overlap.lua new file mode 100644 index 000000000..14d09a376 --- /dev/null +++ b/tests/examples/awful/placement/no_overlap.lua @@ -0,0 +1,26 @@ +screen[1]._resize {width = 128, height = 96} --DOC_HIDE +screen._add_screen {x = 140, y = 0 , width = 128, height = 96} --DOC_HIDE +screen._add_screen {x = 0 , y = 110, width = 128, height = 96} --DOC_HIDE +screen._add_screen {x = 140, y = 110, width = 128, height = 96} --DOC_HIDE +local awful = {placement = require("awful.placement")} --DOC_HIDE +local beautiful = require("beautiful") --DOC_HIDE + + +client.gen_fake {x = 10, y = 10, width=40, height=30} --DOC_HIDE +client.gen_fake {x = 80, y = 55, width=40, height=30} --DOC_HIDE +client.gen_fake {x = 0, y = 0, width=40, height=50, color=beautiful.bg_highlight} --DOC_HIDE +client.focus:_hide() --DOC_HIDE + +awful.placement.no_overlap(client.focus) + +local x,y = screen[4].geometry.x, screen[4].geometry.y +client.gen_fake {x = x+10, y = y+10, width=40, height=30} --DOC_HIDE +client.gen_fake {x = x+80, y = y+10, width=40, height=30} --DOC_HIDE +client.gen_fake {x = x+10, y = y+55, width=40, height=30} --DOC_HIDE +client.gen_fake {x = x+80, y = y+55, width=40, height=30} --DOC_HIDE +client.gen_fake {x = x+0, y = y+0, width=40, height=50, color=beautiful.bg_highlight} --DOC_HIDE +client.focus:_hide() --DOC_HIDE +awful.placement.no_overlap(client.focus) --FIXME --DOC_HIDE + +--TODO maximized + no_overlap --DOC_HIDE +--TODO add 9 clients with no_overlap on all of them --DOC_HIDE diff --git a/tests/examples/awful/placement/under_mouse.lua b/tests/examples/awful/placement/under_mouse.lua new file mode 100644 index 000000000..e1b407659 --- /dev/null +++ b/tests/examples/awful/placement/under_mouse.lua @@ -0,0 +1,8 @@ +screen[1]._resize {width = 128, height = 96} --DOC_HIDE +local awful = {placement = require("awful.placement")} --DOC_HIDE +client.gen_fake {x = 10, y = 10, width=40, height=30} --DOC_HIDE + +mouse.coords {x= 50, y=50} --DOC_HIDE +mouse.push_history() --DOC_HIDE + +awful.placement.under_mouse(client.focus)