Merge pull request #1376 from Elv13/disable_wibox_in_tests
tests: Add a very dirty hack to break wibox for multiscreen tests
This commit is contained in:
commit
fe4d6404a6
|
@ -517,6 +517,29 @@ local function add_steps(real_steps, new_steps)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- This is a very ugly hack to speed up the test. Luacov get exponentially
|
||||||
|
-- slower / more memory hungry when it has more work to do in a single test.
|
||||||
|
-- A lot of that work is building wibars and widgets for those screen. This
|
||||||
|
-- has value when tried once (already covered by the test-screen-changes suit),
|
||||||
|
-- but not done 180 times in a row. This code monkey-patch `wibox` with the
|
||||||
|
-- intent of breaking it without causing errors. This way it stops doing too
|
||||||
|
-- many things (resulting in a faster luacov execution)
|
||||||
|
function module.disable_wibox()
|
||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
setmetatable(wibox, {
|
||||||
|
__call = function() return {
|
||||||
|
geometry = function()
|
||||||
|
return{x=0, y=0, width=0, height=0}
|
||||||
|
end,
|
||||||
|
set_widget = function() end,
|
||||||
|
setup = function() return {} end
|
||||||
|
}
|
||||||
|
end })
|
||||||
|
|
||||||
|
awful.wibar = wibox
|
||||||
|
end
|
||||||
|
|
||||||
return setmetatable(module, {
|
return setmetatable(module, {
|
||||||
__call = function(_,...) return add_steps(...) end
|
__call = function(_,...) return add_steps(...) end
|
||||||
})
|
})
|
||||||
|
|
|
@ -146,6 +146,8 @@ table.insert(steps, function()
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local multi_screen_steps = {}
|
local multi_screen_steps = {}
|
||||||
|
|
||||||
-- Add a test client on each screen.
|
-- Add a test client on each screen.
|
||||||
|
@ -321,7 +323,9 @@ table.insert(multi_screen_steps, function()
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
require("_multi_screen")(steps, multi_screen_steps)
|
local ms = require("_multi_screen")
|
||||||
|
ms.disable_wibox()
|
||||||
|
ms(steps, multi_screen_steps)
|
||||||
|
|
||||||
require("_runner").run_steps(steps)
|
require("_runner").run_steps(steps)
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,9 @@ table.insert(multi_screen_steps, function()
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
require("_multi_screen")(steps, multi_screen_steps)
|
local ms = require("_multi_screen")
|
||||||
|
ms.disable_wibox()
|
||||||
|
ms(steps, multi_screen_steps)
|
||||||
|
|
||||||
require("_runner").run_steps(steps)
|
require("_runner").run_steps(steps)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue