tests: Add resizing support to the test client
This commit is contained in:
parent
710039ed3f
commit
ae7b173c54
|
@ -40,6 +40,11 @@ local function open_window(class, title, options)
|
||||||
if options.maximize_after then
|
if options.maximize_after then
|
||||||
window:maximize()
|
window:maximize()
|
||||||
end
|
end
|
||||||
|
if options.resize_after_width and options.resize_after_height then
|
||||||
|
window:resize(
|
||||||
|
tonumber(options.resize_after_width), tonumber(options.resize_after_height)
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function parse_options(options)
|
local function parse_options(options)
|
||||||
|
@ -136,10 +141,20 @@ return function(class, title, sn_rules, callback, resize_increment, args)
|
||||||
if args.maximize_after then
|
if args.maximize_after then
|
||||||
options = options .. "maximize_after,"
|
options = options .. "maximize_after,"
|
||||||
end
|
end
|
||||||
|
if args.resize then
|
||||||
|
options = table.concat {
|
||||||
|
options,
|
||||||
|
"resize_after_width=",
|
||||||
|
args.resize.height, ",",
|
||||||
|
"resize_after_height=",
|
||||||
|
args.resize.width, ","
|
||||||
|
}
|
||||||
|
end
|
||||||
if args.gravity then
|
if args.gravity then
|
||||||
assert(type(args.gravity)=="number","Use `lgi.Gdk.Gravity.NORTH_WEST`")
|
assert(type(args.gravity)=="number","Use `lgi.Gdk.Gravity.NORTH_WEST`")
|
||||||
options = options .. "gravity=" .. args.gravity .. ","
|
options = options .. "gravity=" .. args.gravity .. ","
|
||||||
end
|
end
|
||||||
|
|
||||||
local data = class .. "\n" .. title .. "\n" .. options .. "\n"
|
local data = class .. "\n" .. title .. "\n" .. options .. "\n"
|
||||||
local success, msg = pipe:write_all(data)
|
local success, msg = pipe:write_all(data)
|
||||||
assert(success, tostring(msg))
|
assert(success, tostring(msg))
|
||||||
|
|
Loading…
Reference in New Issue