1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
--- Test if the wallpaper function do not cause errors
local runner = require("_runner")
local wp = require("gears.wallpaper")
local color = require("gears.color")
local cairo = require( "lgi" ).cairo
local surface = require("gears.surface")
local steps = {}
local colors = {
"#000030",
{
type = "linear" ,
from = { 0, 0 },
to = { 0, 100 },
stops = {
{ 0, "#ff0000" },
{ 1, "#0000ff" }
}
},
color("#043000"),
"#302E00",
"#002C30",
color("#300030AA"),
"#301C00",
"#140030",
}
-- Dummy wallpaper
local img = cairo.ImageSurface.create(cairo.Format.ARGB32, 100, 100)
local cr = cairo.Context(img)
cr:set_source(color(colors[2]))
cr:rectangle(0,0,100,100)
cr:fill()
cr:paint()
table.insert(steps, function()
assert(img)
assert(surface.load_uncached(img))
local w, h = surface.get_size(surface.load_uncached(img))
assert(w == 100)
assert(h == 100)
wp.fit(img, nil, nil)
wp.fit(img, screen[1], nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.fit(img, screen[1], "#00ff00")
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.centered(img, nil, nil)
wp.centered(img, screen[1], nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.centered(img, screen[1], "#00ff00")
return true
end)
table.insert(steps, function()
wp.maximized(img, nil, nil, nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.maximized(img, screen[1], nil, nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.maximized(img, screen[1], false, nil)
wp.maximized(img, screen[1], true, nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.maximized(img, screen[1], false, {x=10, y= 10})
wp.maximized(img, screen[1], true, {x=10, y= 10})
return true
end)
table.insert(steps, function()
wp.tiled(img, nil, nil)
wp.tiled(img, screen[1], nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.tiled(img, screen[1], {x=10, y= 10})
return true
end)
table.insert(steps, function()
for _, c in ipairs(colors) do
wp.set(c)
end
return true
end)
runner.run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|