From 2a976951ea5ab3bf2a337566c9d360ca3a2897b9 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Thu, 8 Sep 2016 02:32:53 -0400 Subject: [PATCH] tests: The the piechart widget. --- .../wibox/widget/piechart/border_color.lua | 27 ++++++++ .../wibox/widget/piechart/border_width.lua | 26 +++++++ .../examples/wibox/widget/piechart/label.lua | 68 +++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 tests/examples/wibox/widget/piechart/border_color.lua create mode 100644 tests/examples/wibox/widget/piechart/border_width.lua create mode 100644 tests/examples/wibox/widget/piechart/label.lua diff --git a/tests/examples/wibox/widget/piechart/border_color.lua b/tests/examples/wibox/widget/piechart/border_color.lua new file mode 100644 index 000000000..d69375d17 --- /dev/null +++ b/tests/examples/wibox/widget/piechart/border_color.lua @@ -0,0 +1,27 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require( "wibox" ) +local beautiful = require( "beautiful" ) + +local l = wibox.layout.fixed.horizontal() +parent:add(l) + +for _, v in ipairs {"#ff0000", "#00ff00", "#0000ff"} do + l:add(wibox.widget { + data = { + ['L1'] = 100, + ['L2'] = 200, + ['L3'] = 300, + }, + border_width = 1, + border_color = v, + forced_height = 50, + forced_width = 100, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }) +end diff --git a/tests/examples/wibox/widget/piechart/border_width.lua b/tests/examples/wibox/widget/piechart/border_width.lua new file mode 100644 index 000000000..88a86b620 --- /dev/null +++ b/tests/examples/wibox/widget/piechart/border_width.lua @@ -0,0 +1,26 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require( "wibox" ) +local beautiful = require( "beautiful" ) + +local l = wibox.layout.fixed.horizontal() +parent:add(l) + +for _, v in ipairs {0,1,3,5} do + l:add(wibox.widget { + data = { + ['L1'] = 100, + ['L2'] = 200, + ['L3'] = 300, + }, + border_width = v, + forced_height = 50, + forced_width = 100, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }) +end diff --git a/tests/examples/wibox/widget/piechart/label.lua b/tests/examples/wibox/widget/piechart/label.lua new file mode 100644 index 000000000..1315eb221 --- /dev/null +++ b/tests/examples/wibox/widget/piechart/label.lua @@ -0,0 +1,68 @@ +--DOC_HIDE_ALL +local parent = ... +local wibox = require( "wibox" ) +local beautiful = require( "beautiful" ) + +parent:add(wibox.widget { + { + { + markup = "display_labels = false", + widget = wibox.widget.textbox + }, + { + { + data = { + ['L1'] = 100, + ['L2'] = 200, + ['L3'] = 300, + }, + border_width = 1, + forced_height = 50, + forced_width = 100, + display_labels = false, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }, + margins = 1, + color = beautiful.border_color, + layout = wibox.container.margin, + }, + layout = wibox.layout.fixed.vertical + }, + { + { + markup = "display_labels = true", + widget = wibox.widget.textbox + }, + { + { + data = { + ['L1'] = 100, + ['L2'] = 200, + ['L3'] = 300, + }, + border_width = 1, + forced_height = 50, + forced_width = 100, + display_labels = true, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }, + margins = 1, + color = beautiful.border_color, + layout = wibox.container.margin, + }, + layout = wibox.layout.fixed.vertical + }, + layout = wibox.layout.flex.horizontal +}) + +return 500, 60