Tests: Have only one place for stubbing widgets

This makes the tests for wibox.hierarchy use test_utils.widget_stub() instead of
having its own implementation of "fake widgets".

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-09-06 10:00:27 +02:00
parent 45323f2801
commit 447492e986
2 changed files with 5 additions and 5 deletions

View file

@ -8,12 +8,10 @@ local hierarchy = require("wibox.hierarchy")
local cairo = require("lgi").cairo
local matrix = require("gears.matrix")
local object = require("gears.object")
local utils = require("wibox.test_utils")
local function make_widget(children)
local result = object()
result:add_signal("widget::redraw_needed")
result:add_signal("widget::layout_changed")
result.visible = true
local result = utils.widget_stub()
result.layout = function()
return children
end

View file

@ -82,8 +82,10 @@ assert:register("assertion", "widget_layout", widget_layout, "assertion.widget_l
return {
widget_stub = function(width, height)
local w = object()
w:add_signal("widget::redraw_needed")
w:add_signal("widget::layout_changed")
w.visible = true
w.opacity = 1
w.fit = function()
return width or 10, height or 10
end