diff --git a/spec/wibox/test_utils.lua b/spec/wibox/test_utils.lua index b503caf69..d1e4954e3 100644 --- a/spec/wibox/test_utils.lua +++ b/spec/wibox/test_utils.lua @@ -9,22 +9,6 @@ local matrix_equals = require("gears.matrix").equals local base = require("wibox.widget.base") local say = require("say") local assert = require("luassert") -local spy = require("luassert.spy") -local stub = require("luassert.stub") - -local real_draw_widget = base.draw_widget -local widgets_drawn = nil - --- This function would reject stubbed widgets -local real_check_widget = base.check_widget -base.check_widget = function() -end - -local function stub_draw_widget(wibox, cr, widget, x, y, width, height) - assert.is.equal("wibox", wibox) - assert.is.equal("cr", cr) - table.insert(widgets_drawn, { widget, x, y, width, height }) -end -- {{{ Own widget-based assertions local function widget_fit(state, arguments) @@ -96,48 +80,17 @@ assert:register("assertion", "widget_layout", widget_layout, "assertion.widget_l -- }}} return { - real_check_widget = real_check_widget, - widget_stub = function(width, height) local w = object() w.visible = true - w:add_signal("widget::updated") w.fit = function() return width or 10, height or 10 end - w.draw = function() end w._fit_geometry_cache = cache.new(w.fit) - spy.on(w, "fit") - stub(w, "draw") - return w end, - - stub_draw_widget = function() - base.draw_widget = stub_draw_widget - widgets_drawn = {} - end, - - revert_draw_widget = function() - base.draw_widget = real_draw_widget - widgets_drawn = nil - end, - - check_widgets_drawn = function(expected) - assert.is.equals(#expected, #widgets_drawn) - for k, v in pairs(expected) do - -- widget, x, y, width, height - -- Compared like this so we get slightly less bad error messages - assert.is.equals(expected[k][1], widgets_drawn[k][1]) - assert.is.equals(expected[k][2], widgets_drawn[k][2]) - assert.is.equals(expected[k][3], widgets_drawn[k][3]) - assert.is.equals(expected[k][4], widgets_drawn[k][4]) - assert.is.equals(expected[k][5], widgets_drawn[k][5]) - end - widgets_drawn = {} - end } -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80