From 6128e995f24e08aa4a528c6389ab5a174d5b276b Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 25 Jul 2016 00:16:37 -0400 Subject: [PATCH] tests: Test the radical progressbar --- .../container/defaults/radialprogressbar.lua | 25 ++++++++++++++ .../radialprogressbar/border_color.lua | 26 +++++++++++++++ .../radialprogressbar/border_width.lua | 29 ++++++++++++++++ .../container/radialprogressbar/color.lua | 26 +++++++++++++++ .../container/radialprogressbar/padding.lua | 33 +++++++++++++++++++ .../container/radialprogressbar/value.lua | 28 ++++++++++++++++ 6 files changed, 167 insertions(+) create mode 100644 tests/examples/wibox/container/defaults/radialprogressbar.lua create mode 100644 tests/examples/wibox/container/radialprogressbar/border_color.lua create mode 100644 tests/examples/wibox/container/radialprogressbar/border_width.lua create mode 100644 tests/examples/wibox/container/radialprogressbar/color.lua create mode 100644 tests/examples/wibox/container/radialprogressbar/padding.lua create mode 100644 tests/examples/wibox/container/radialprogressbar/value.lua diff --git a/tests/examples/wibox/container/defaults/radialprogressbar.lua b/tests/examples/wibox/container/defaults/radialprogressbar.lua new file mode 100644 index 00000000..5ae4190e --- /dev/null +++ b/tests/examples/wibox/container/defaults/radialprogressbar.lua @@ -0,0 +1,25 @@ +--DOC_HIDE_ALL +local wibox = require("wibox") + +return { + text = "Before", + align = "center", + valign = "center", + widget = wibox.widget.textbox, +}, +{ + { + { + text = "After", + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + value = 0.5, + max_value = 1, + min_value = 0, + widget = wibox.container.radialprogressbar + }, + margins = 5, + layout = wibox.container.margin +} diff --git a/tests/examples/wibox/container/radialprogressbar/border_color.lua b/tests/examples/wibox/container/radialprogressbar/border_color.lua new file mode 100644 index 00000000..6885a706 --- /dev/null +++ b/tests/examples/wibox/container/radialprogressbar/border_color.lua @@ -0,0 +1,26 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require("wibox") + +local function gen(val) + return wibox.widget { + { + text = "Value: "..val, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + border_color = val, + value = 0.75, + widget = wibox.container.radialprogressbar + } +end + +local l = wibox.layout { + gen("#ff0000"),gen("#00ff00"),gen("#0000ff"), + forced_height = 30, + forced_width = 400, + layout = wibox.layout.flex.horizontal +} + +parent:add(l) diff --git a/tests/examples/wibox/container/radialprogressbar/border_width.lua b/tests/examples/wibox/container/radialprogressbar/border_width.lua new file mode 100644 index 00000000..b13bddf7 --- /dev/null +++ b/tests/examples/wibox/container/radialprogressbar/border_width.lua @@ -0,0 +1,29 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require("wibox") + +local function gen(val) + return wibox.widget { + { + text = "Value: "..val, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + paddings = 0, + border_width = val, + value = 0.75, + max_value = 1, + min_value = 0, + widget = wibox.container.radialprogressbar + } +end + +local l = wibox.layout { + gen(1),gen(3),gen(5), + forced_height = 30, + forced_width = 400, + layout = wibox.layout.flex.horizontal +} + +parent:add(l) diff --git a/tests/examples/wibox/container/radialprogressbar/color.lua b/tests/examples/wibox/container/radialprogressbar/color.lua new file mode 100644 index 00000000..7c097af5 --- /dev/null +++ b/tests/examples/wibox/container/radialprogressbar/color.lua @@ -0,0 +1,26 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require("wibox") + +local function gen(val) + return wibox.widget { + { + text = "Value: "..val, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + color = val, + value = 0.75, + widget = wibox.container.radialprogressbar + } +end + +local l = wibox.layout { + gen("#ff0000"),gen("#00ff00"),gen("#0000ff"), + forced_height = 30, + forced_width = 400, + layout = wibox.layout.flex.horizontal +} + +parent:add(l) diff --git a/tests/examples/wibox/container/radialprogressbar/padding.lua b/tests/examples/wibox/container/radialprogressbar/padding.lua new file mode 100644 index 00000000..9e46370f --- /dev/null +++ b/tests/examples/wibox/container/radialprogressbar/padding.lua @@ -0,0 +1,33 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require("wibox") +local beautiful = require("beautiful") + +local function gen(val) + return wibox.widget { + { + { + text = "Value: "..val, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + bg = beautiful.bg_normal, + widget = wibox.widget.background, + }, + paddings = val, + value = 0.75, + max_value = 1, + min_value = 0, + widget = wibox.container.radialprogressbar + } +end + +local l = wibox.layout { + gen(0),gen(5),gen(10), + forced_height = 30, + forced_width = 400, + layout = wibox.layout.flex.horizontal +} + +parent:add(l) diff --git a/tests/examples/wibox/container/radialprogressbar/value.lua b/tests/examples/wibox/container/radialprogressbar/value.lua new file mode 100644 index 00000000..a3e7c944 --- /dev/null +++ b/tests/examples/wibox/container/radialprogressbar/value.lua @@ -0,0 +1,28 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require("wibox") + +local function gen(val) + return wibox.widget { + { + text = "Value: "..(val*100).."%", + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + padding = 5, + value = val, + max_value = 1, + min_value = 0, + widget = wibox.container.radialprogressbar + } +end + +local l = wibox.layout { + gen(0.0),gen(0.3),gen(1.0), + forced_height = 30, + forced_width = 400, + layout = wibox.layout.flex.horizontal +} + +parent:add(l)