Merge pull request #1781 from psychon/fullscreen_test

Some changes to fullscreen tests
This commit is contained in:
Daniel Hahler 2017-05-14 19:53:09 +02:00 committed by GitHub
commit 52fa619506
2 changed files with 23 additions and 11 deletions

View File

@ -16,6 +16,9 @@ local function open_window(class, title, options)
default_height = 100, default_height = 100,
title = title title = title
} }
if options.gravity then
window:set_gravity(tonumber(options.gravity))
end
if options.snid and options.snid ~= "" then if options.snid and options.snid ~= "" then
window:set_startup_id(options.snid) window:set_startup_id(options.snid)
end end
@ -106,7 +109,8 @@ local function get_snid(sn_rules, callback)
return snid return snid
end end
return function(class, title, sn_rules, callback, resize_increment) return function(class, title, sn_rules, callback, resize_increment, args)
args = args or {}
class = class or "test_app" class = class or "test_app"
title = title or "Awesome test client" title = title or "Awesome test client"
@ -120,6 +124,10 @@ return function(class, title, sn_rules, callback, resize_increment)
if resize_increment then if resize_increment then
options = options .. "resize_increment," options = options .. "resize_increment,"
end end
if args.gravity then
assert(type(args.gravity)=="number","Use `lgi.Gdk.Gravity.NORTH_WEST`")
options = options .. "gravity=" .. args.gravity .. ","
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))

View File

@ -2,13 +2,20 @@
local runner = require("_runner") local runner = require("_runner")
local awful = require("awful") local awful = require("awful")
local test_client = require("_client")
local lgi = require("lgi")
local function geo_to_str(g)
return "pos=" .. g.x .. "," .. g.y ..
";size=" .. g.width .. "x" .. g.height
end
local original_geo = nil local original_geo = nil
local steps = { local steps = {
function(count) function(count)
if count == 1 then if count == 1 then
awful.spawn("xterm") test_client(nil,nil,nil,nil,nil,{gravity=lgi.Gdk.Gravity.NORTH_WEST})
else else
local c = client.get()[1] local c = client.get()[1]
if c then if c then
@ -66,9 +73,8 @@ local steps = {
local new_geo = c:geometry() local new_geo = c:geometry()
for k,v in pairs(original_geo) do assert(geo_to_str(original_geo) == geo_to_str(new_geo),
assert(new_geo[k] == v) geo_to_str(original_geo) .. " == " .. geo_to_str(new_geo))
end
c.fullscreen = true c.fullscreen = true
@ -97,9 +103,8 @@ local steps = {
local new_geo = c:geometry() local new_geo = c:geometry()
for k,v in pairs(original_geo) do assert(geo_to_str(original_geo) == geo_to_str(new_geo),
assert(new_geo[k] == v) geo_to_str(original_geo) .. " == " .. geo_to_str(new_geo))
end
c.floating = true c.floating = true
@ -134,9 +139,8 @@ local steps = {
local new_geo = c:geometry() local new_geo = c:geometry()
for k,v in pairs(original_geo) do assert(geo_to_str(original_geo) == geo_to_str(new_geo),
assert(new_geo[k] == v) geo_to_str(original_geo) .. " == " .. geo_to_str(new_geo))
end
return true return true
end end