From 447492e986c97bfd12c77edae6114a32113efacc Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 6 Sep 2015 10:00:27 +0200 Subject: [PATCH] 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 --- spec/wibox/hierarchy_spec.lua | 6 ++---- spec/wibox/test_utils.lua | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/wibox/hierarchy_spec.lua b/spec/wibox/hierarchy_spec.lua index 6472eda33..98a1abad5 100644 --- a/spec/wibox/hierarchy_spec.lua +++ b/spec/wibox/hierarchy_spec.lua @@ -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 diff --git a/spec/wibox/test_utils.lua b/spec/wibox/test_utils.lua index d1e4954e3..e13fef340 100644 --- a/spec/wibox/test_utils.lua +++ b/spec/wibox/test_utils.lua @@ -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