From a3c7ed166fb53c7d56e35abb962780b3deeb0584 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 27 Oct 2021 18:04:40 -0700 Subject: [PATCH] tests: Modify the client.relative_move test for the new behavior. Also add more asserts. --- .../sequences/client/relative_move1.lua | 21 +++++++++++++++++-- .../client/relative_move1.output.txt | 5 +++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/examples/sequences/client/relative_move1.lua b/tests/examples/sequences/client/relative_move1.lua index fd9ecec68..d35b5c022 100644 --- a/tests/examples/sequences/client/relative_move1.lua +++ b/tests/examples/sequences/client/relative_move1.lua @@ -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() diff --git a/tests/examples/sequences/client/relative_move1.output.txt b/tests/examples/sequences/client/relative_move1.output.txt index 3bdf3709f..bc95f9db9 100644 --- a/tests/examples/sequences/client/relative_move1.output.txt +++ b/tests/examples/sequences/client/relative_move1.output.txt @@ -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