From 33570e45d773bd53a79d54509a220bc6a0bca630 Mon Sep 17 00:00:00 2001 From: Xinhao Yuan Date: Tue, 15 Oct 2019 19:14:31 -0400 Subject: [PATCH] Added a test to check if window state is restored after a client unmaximizing itself. --- tests/_client.lua | 5 +++++ tests/test-maximize.lua | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/tests/_client.lua b/tests/_client.lua index 9c6563391..f2b6eac11 100644 --- a/tests/_client.lua +++ b/tests/_client.lua @@ -40,6 +40,8 @@ local function open_window(class, title, options) window:show_all() if options.maximize_after then window:maximize() + elseif options.unmaximize_after then + window:unmaximize() end if options.resize_after_width and options.resize_after_height then window:resize( @@ -142,6 +144,9 @@ return function(class, title, sn_rules, callback, resize_increment, args) if args.maximize_after then options = options .. "maximize_after," end + if args.unmaximize_after then + options = options .. "unmaximize_after," + end if args.size then options = table.concat { options, diff --git a/tests/test-maximize.lua b/tests/test-maximize.lua index 1ea6d0d21..132961fd8 100644 --- a/tests/test-maximize.lua +++ b/tests/test-maximize.lua @@ -232,6 +232,30 @@ gears.table.merge(steps, { return true end, + -- Maximize then unmaximize. The window state should be restored. + function() + if #client.get() > 0 then return end + + test_client(nil,nil,nil,nil,nil,{maximize_before=true,unmaximize_after=true}) + + return true + end, + function() + local c = client.get()[1] + + if not c then return end + + assert(not c.maximized_horizontal) + assert(not c.maximized_vertical) + -- May need to retry + if c.maximized then return end + assert(not c.immobilized_horizontal) + assert(not c.immobilized_vertical) + + c:kill() + + return true + end, function() if #client.get() > 0 then return end