2019-11-18 00:46:22 +01:00
|
|
|
describe("awful.permissions.client_geometry_requests", function()
|
2017-10-25 15:36:00 +02:00
|
|
|
package.loaded["awful.client"] = {}
|
|
|
|
package.loaded["awful.layout"] = {}
|
|
|
|
package.loaded["awful.screen"] = {}
|
|
|
|
package.loaded["awful.tag"] = {}
|
|
|
|
package.loaded["gears.timer"] = {}
|
|
|
|
_G.client = {
|
|
|
|
connect_signal = function() end,
|
|
|
|
get = function() return {} end,
|
|
|
|
}
|
|
|
|
_G.screen = {
|
|
|
|
connect_signal = function() end,
|
|
|
|
}
|
2019-11-17 00:51:15 +01:00
|
|
|
_G.tag = {
|
|
|
|
connect_signal = function() end,
|
|
|
|
}
|
2017-10-25 15:36:00 +02:00
|
|
|
|
2019-11-18 00:46:22 +01:00
|
|
|
local permissions = require("awful.permissions")
|
2017-10-25 15:36:00 +02:00
|
|
|
|
|
|
|
it("removes x/y/width/height when immobilized", function()
|
|
|
|
local c = {}
|
|
|
|
local s = stub.new(c, "geometry")
|
|
|
|
|
2019-11-18 00:46:22 +01:00
|
|
|
permissions.client_geometry_requests(c, "ewmh", {})
|
2017-10-25 15:36:00 +02:00
|
|
|
assert.stub(s).was_called_with(c, {})
|
|
|
|
|
2019-11-18 00:46:22 +01:00
|
|
|
permissions.client_geometry_requests(c, "ewmh", {x=0, width=400})
|
2017-10-25 15:36:00 +02:00
|
|
|
assert.stub(s).was_called_with(c, {x=0, width=400})
|
|
|
|
|
|
|
|
c.immobilized_horizontal = true
|
|
|
|
c.immobilized_vertical = false
|
2019-11-18 00:46:22 +01:00
|
|
|
permissions.client_geometry_requests(c, "ewmh", {x=0, width=400})
|
2017-10-25 15:36:00 +02:00
|
|
|
assert.stub(s).was_called_with(c, {})
|
|
|
|
|
2019-11-18 00:46:22 +01:00
|
|
|
permissions.client_geometry_requests(c, "ewmh", {x=0, width=400, y=0})
|
2017-10-25 15:36:00 +02:00
|
|
|
assert.stub(s).was_called_with(c, {y=0})
|
|
|
|
|
|
|
|
c.immobilized_horizontal = true
|
|
|
|
c.immobilized_vertical = true
|
2019-11-18 00:46:22 +01:00
|
|
|
permissions.client_geometry_requests(c, "ewmh", {x=0, width=400, y=0})
|
2017-10-25 15:36:00 +02:00
|
|
|
assert.stub(s).was_called_with(c, {})
|
|
|
|
|
|
|
|
c.immobilized_horizontal = false
|
|
|
|
c.immobilized_vertical = true
|
|
|
|
local hints = {x=0, width=400, y=0}
|
2019-11-18 00:46:22 +01:00
|
|
|
permissions.client_geometry_requests(c, "ewmh", hints)
|
2017-10-25 15:36:00 +02:00
|
|
|
assert.stub(s).was_called_with(c, {x=0, width=400})
|
|
|
|
-- Table passed as argument should not have been modified.
|
|
|
|
assert.is.same(hints, {x=0, width=400, y=0})
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|