From 7b11f1c1b4c759f4a15357d4e72861f2fff29b15 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 24 Jul 2016 22:18:12 -0400 Subject: [PATCH] tests: Test progressbat paddings, margins and clip --- lib/wibox/widget/progressbar.lua | 8 ++++++ .../wibox/widget/progressbar/clip.lua | 27 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/examples/wibox/widget/progressbar/clip.lua diff --git a/lib/wibox/widget/progressbar.lua b/lib/wibox/widget/progressbar.lua index ef4e0729..f7f9d314 100644 --- a/lib/wibox/widget/progressbar.lua +++ b/lib/wibox/widget/progressbar.lua @@ -77,6 +77,8 @@ local progressbar = { mt = {} } --- Force the inner part (the bar) to fit in the background shape. -- +--@DOC_wibox_widget_progressbar_clip_EXAMPLE@ +-- -- @property clip -- @tparam[opt=true] boolean clip @@ -129,6 +131,9 @@ local progressbar = { mt = {} } --- The progressbar margins. -- Note that if the `clip` is disabled, this allows the background to be smaller -- than the bar. +-- +-- See the `clip` example. +-- -- @tparam[opt=0] (table|number|nil) margins A table for each side or a number -- @tparam[opt=0] number margins.top -- @tparam[opt=0] number margins.bottom @@ -140,6 +145,9 @@ local progressbar = { mt = {} } --- The progressbar padding. -- Note that if the `clip` is disabled, this allows the bar to be taller -- than the background. +-- +-- See the `clip` example. +-- -- @tparam[opt=0] (table|number|nil) padding A table for each side or a number -- @tparam[opt=0] number padding.top -- @tparam[opt=0] number padding.bottom diff --git a/tests/examples/wibox/widget/progressbar/clip.lua b/tests/examples/wibox/widget/progressbar/clip.lua new file mode 100644 index 00000000..08f48466 --- /dev/null +++ b/tests/examples/wibox/widget/progressbar/clip.lua @@ -0,0 +1,27 @@ +local parent = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE +local gears = {shape = require("gears.shape") } --DOC_HIDE +local beautiful = require("beautiful") --DOC_HIDE + +parent:add( --DOC_HIDE + +wibox.widget { + value = 75, + max_value = 100, + border_width = 2, + border_color = beautiful.border_color, + color = beautiful.border_color, + shape = gears.shape.rounded_bar, + bar_shape = gears.shape.rounded_bar, + clip = false, + forced_height = 30, + forced_width = 100, + paddings = 5, + margins = { + top = 12, + bottom = 12, + }, + widget = wibox.widget.progressbar, +} + +) --DOC_HIDE