diff --git a/spec/wibox/container/arcchart_spec.lua b/spec/wibox/container/arcchart_spec.lua new file mode 100644 index 00000000..e4745b68 --- /dev/null +++ b/spec/wibox/container/arcchart_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local arcchart = require("wibox.container.arcchart") +local utils = require("wibox.test_utils") + +describe("wibox.container.arcchart", function() + it("common interfaces", function() + utils.test_container(arcchart()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/background_spec.lua b/spec/wibox/container/background_spec.lua new file mode 100644 index 00000000..5dce5462 --- /dev/null +++ b/spec/wibox/container/background_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local background = require("wibox.container.background") +local utils = require("wibox.test_utils") + +describe("wibox.container.background", function() + it("common interfaces", function() + utils.test_container(background()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/constraint_spec.lua b/spec/wibox/container/constraint_spec.lua new file mode 100644 index 00000000..102d749e --- /dev/null +++ b/spec/wibox/container/constraint_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local constraint = require("wibox.container.constraint") +local utils = require("wibox.test_utils") + +describe("wibox.container.constraint", function() + it("common interfaces", function() + utils.test_container(constraint()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/margin_spec.lua b/spec/wibox/container/margin_spec.lua new file mode 100644 index 00000000..ad668ad6 --- /dev/null +++ b/spec/wibox/container/margin_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local margin = require("wibox.container.margin") +local utils = require("wibox.test_utils") + +describe("wibox.container.margin", function() + it("common interfaces", function() + utils.test_container(margin()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/mirror_spec.lua b/spec/wibox/container/mirror_spec.lua new file mode 100644 index 00000000..852bb958 --- /dev/null +++ b/spec/wibox/container/mirror_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local mirror = require("wibox.container.mirror") +local utils = require("wibox.test_utils") + +describe("wibox.container.mirror", function() + it("common interfaces", function() + utils.test_container(mirror()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/place_spec.lua b/spec/wibox/container/place_spec.lua new file mode 100644 index 00000000..22e09b03 --- /dev/null +++ b/spec/wibox/container/place_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local place = require("wibox.container.place") +local utils = require("wibox.test_utils") + +describe("wibox.container.place", function() + it("common interfaces", function() + utils.test_container(place()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/radialprogressbar_spec.lua b/spec/wibox/container/radialprogressbar_spec.lua new file mode 100644 index 00000000..415fb30d --- /dev/null +++ b/spec/wibox/container/radialprogressbar_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local radialprogressbar = require("wibox.container.radialprogressbar") +local utils = require("wibox.test_utils") + +describe("wibox.container.radialprogressbar", function() + it("common interfaces", function() + utils.test_container(radialprogressbar()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/rotate_spec.lua b/spec/wibox/container/rotate_spec.lua new file mode 100644 index 00000000..947c153b --- /dev/null +++ b/spec/wibox/container/rotate_spec.lua @@ -0,0 +1,15 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +local rotate = require("wibox.container.rotate") +local utils = require("wibox.test_utils") + +describe("wibox.container.rotate", function() + it("common interfaces", function() + utils.test_container(rotate()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/container/scroll_spec.lua b/spec/wibox/container/scroll_spec.lua new file mode 100644 index 00000000..b2c14414 --- /dev/null +++ b/spec/wibox/container/scroll_spec.lua @@ -0,0 +1,17 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter +-- @copyright 2017 Uli Schlachter +--------------------------------------------------------------------------- + +package.loaded["gears.timer"] = {} + +local scroll = require("wibox.container.scroll") +local utils = require("wibox.test_utils") + +describe("wibox.container.scroll", function() + it("common interfaces", function() + utils.test_container(scroll.horizontal()) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/spec/wibox/test_utils.lua b/spec/wibox/test_utils.lua index 39d65c66..7a1167f3 100644 --- a/spec/wibox/test_utils.lua +++ b/spec/wibox/test_utils.lua @@ -83,6 +83,26 @@ assert:register("assertion", "assertion.widget_layout.positive") -- }}} +local function test_container(container) + local w1 = base.empty_widget() + + assert.is.same({}, container:get_children()) + + container:set_widget(w1) + assert.is.same({ w1 }, container:get_children()) + + container:set_widget(nil) + assert.is.same({}, container:get_children()) + + container:set_widget(w1) + assert.is.same({ w1 }, container:get_children()) + + if container.reset then + container:reset() + assert.is.same({}, container:get_children()) + end +end + return { widget_stub = function(width, height) local w = object() @@ -105,6 +125,8 @@ return { return w end, + + test_container = test_container, } -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80