tests: Extend the test client to handle minimization.
The goal is to make the coverage less flacky by explicitly handling some events.
This commit is contained in:
parent
50b9b10437
commit
6615772d10
|
@ -11,6 +11,7 @@ end
|
|||
local test_client_source = [[
|
||||
pcall(require, 'luarocks.loader')
|
||||
local lgi = require 'lgi'
|
||||
local GLib = lgi.require('GLib')
|
||||
local Gdk = lgi.require('Gdk')
|
||||
local Gtk = lgi.require('Gtk')
|
||||
local Gio = lgi.require('Gio')
|
||||
|
@ -40,6 +41,8 @@ local function open_window(class, title, options)
|
|||
end
|
||||
if options.maximize_before then
|
||||
window:maximize()
|
||||
elseif options.unminimize_after then
|
||||
window:iconify()
|
||||
end
|
||||
window:set_wmclass(class, class)
|
||||
window:show_all()
|
||||
|
@ -47,6 +50,14 @@ local function open_window(class, title, options)
|
|||
window:maximize()
|
||||
elseif options.unmaximize_after then
|
||||
window:unmaximize()
|
||||
elseif options.minimize_after then
|
||||
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, function()
|
||||
window:iconify()
|
||||
end)
|
||||
elseif options.unminimize_after then
|
||||
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, function()
|
||||
window:deiconify()
|
||||
end)
|
||||
end
|
||||
if options.resize_after_width and options.resize_after_height then
|
||||
window:resize(
|
||||
|
@ -152,6 +163,13 @@ return function(class, title, sn_rules, callback, resize_increment, args)
|
|||
if args.unmaximize_after then
|
||||
options = options .. "unmaximize_after,"
|
||||
end
|
||||
if args.unminimize_after then
|
||||
options = options .. "unminimize_after,"
|
||||
end
|
||||
if args.minimize_after then
|
||||
options = options .. "minimize_after,"
|
||||
end
|
||||
|
||||
if args.size then
|
||||
options = table.concat {
|
||||
options,
|
||||
|
|
|
@ -371,8 +371,38 @@ gears.table.merge(steps, {
|
|||
|
||||
if not c or counter ~= 2 then return end
|
||||
|
||||
c:kill()
|
||||
|
||||
client.disconnect_signal("request::geometry", geometry_handler)
|
||||
|
||||
test_client(nil,nil,nil,nil,nil,{minimize_after=true})
|
||||
|
||||
return true
|
||||
end
|
||||
end,
|
||||
function()
|
||||
-- Test minimization.
|
||||
if #client.get() ~= 1 or not client.get()[1].minimized then return end
|
||||
|
||||
assert(client.get()[1].minimized)
|
||||
client.get()[1]:kill()
|
||||
|
||||
return true
|
||||
end,
|
||||
function()
|
||||
if #client.get() > 0 then return end
|
||||
|
||||
test_client(nil,nil,nil,nil,nil,{unminimize_after=true})
|
||||
|
||||
return true
|
||||
end,
|
||||
function()
|
||||
if #client.get() ~= 1 or client.get()[1].minimized then return end
|
||||
|
||||
assert(not client.get()[1].minimized)
|
||||
client.get()[1]:kill()
|
||||
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
runner.run_steps(steps)
|
||||
|
|
Loading…
Reference in New Issue