tests: Modify the client.relative_move test for the new behavior.

Also add more asserts.
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-27 18:04:40 -07:00
parent 7d6892992c
commit a3c7ed166f
2 changed files with 22 additions and 4 deletions

View File

@ -6,6 +6,7 @@ awful.placement = require("awful.placement")
require("awful.ewmh")
screen[1]:fake_resize(0, 0, 800, 480)
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile)
local original_geo, geo
function awful.spawn(name)
client.gen_fake{class = name, name = name, x = 4, y=10, width = 60, height =50, screen=screen[1]}
@ -22,6 +23,7 @@ module.add_event("Spawn a floating client.", function()
client.get()[1].floating = true
--DOC_NEWLINE
--DOC_HIDE_START
end)
@ -29,14 +31,25 @@ module.display_tags()
module.add_event("Move it.", function()
--DOC_HIDE_END
geo = client.get()[1]:geometry()
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
original_geo = geo --DOC_HIDE
--DOC_NEWLINE
client.get()[1]:relative_move(100, 100)
--DOC_NEWLINE
local geo = client.get()[1]:geometry()
geo = client.get()[1]:geometry()
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
--DOC_NEWLINE
--DOC_HIDE_START
assert(original_geo.width == geo.width)
assert(original_geo.height == geo.height)
assert(original_geo.x == geo.x - 100)
assert(original_geo.y == geo.y - 100)
original_geo.x, original_geo.y = geo.x, geo.y
end)
module.display_tags()
@ -46,10 +59,14 @@ module.add_event("Resize it.", function()
client.get()[1]:relative_move(nil, nil, 100, 100)
--DOC_NEWLINE
local geo = client.get()[1]:geometry()
geo = client.get()[1]:geometry()
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
--DOC_HIDE_START
assert(original_geo.width == geo.width - 100)
assert(original_geo.height == geo.height - 100)
assert(original_geo.x == geo.x)
assert(original_geo.y == geo.y)
end)
module.display_tags()

View File

@ -1,2 +1,3 @@
Client geometry: 110 110 120 100
Client geometry: 220 220 220 200
Client geometry: 4 10 60 50
Client geometry: 104 110 60 50
Client geometry: 104 110 160 150