diff --git a/tests/examples/wibox/widget/textbox/ellipsize.lua b/tests/examples/wibox/widget/textbox/ellipsize.lua index f684a59e9..350e6384b 100644 --- a/tests/examples/wibox/widget/textbox/ellipsize.lua +++ b/tests/examples/wibox/widget/textbox/ellipsize.lua @@ -3,6 +3,7 @@ --DOC_HIDE_START local parent = ... local wibox = require("wibox") +local beautiful = require("beautiful") local widget = function(inner) return wibox.widget { @@ -13,6 +14,7 @@ local widget = function(inner) widget = wibox.container.margin, }, border_width = 2, + border_color = beautiful.border_color, widget = wibox.container.background, }, strategy = "max", diff --git a/tests/examples/wibox/widget/textbox/indent.lua b/tests/examples/wibox/widget/textbox/indent.lua new file mode 100644 index 000000000..e13767aa5 --- /dev/null +++ b/tests/examples/wibox/widget/textbox/indent.lua @@ -0,0 +1,47 @@ +--DOC_GEN_IMAGE --DOC_HIDE + +--DOC_HIDE_START +local parent = ... +local wibox = require("wibox") +local beautiful = require("beautiful") + +local widget = function(inner) + return wibox.widget { + { + inner, + margins = 5, + widget = wibox.container.margin, + }, + border_width = 1, + forced_width = 150, + forced_height = 150, + border_color = beautiful.border_color, + widget = wibox.container.background, + } +end + +local l = wibox.layout.grid.horizontal(2) +l. homogeneous = false +--DOC_HIDE_END + +local lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ".. + "do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad ".. + "minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ".. + "ea commodo consequat." + +for _, indent in ipairs { -10, 0, 10 } do + l:add(wibox.widget.textbox("indent = "..indent)) --DOC_HIDE + l:add( --DOC_HIDE + widget{ + text = lorem_ipsum, + indent = indent, + widget = wibox.widget.textbox, + } + ) --DOC_HIDE +end +--DOC_HIDE_START + +parent:add(l) + + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/widget/textbox/justify.lua b/tests/examples/wibox/widget/textbox/justify.lua new file mode 100644 index 000000000..44da5fcc0 --- /dev/null +++ b/tests/examples/wibox/widget/textbox/justify.lua @@ -0,0 +1,52 @@ +--DOC_GEN_IMAGE --DOC_HIDE + +--DOC_HIDE_START +local parent = ... +local wibox = require("wibox") +local beautiful = require("beautiful") + +local widget = function(inner) + return wibox.widget { + { + inner, + margins = 5, + widget = wibox.container.margin, + }, + border_width = 1, + border_color = beautiful.border_color, + widget = wibox.container.background, + } +end + +local l = wibox.layout.flex.horizontal() + +--DOC_HIDE_END + +local lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ".. + "do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad ".. + "minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ".. + "ea commodo consequat." +--DOC_NEWLINE + +l:add( --DOC_HIDE +widget{ + text = lorem_ipsum, + justify = false, + widget = wibox.widget.textbox, +} +) --DOC_HIDE +--DOC_NEWLINE +l:add( --DOC_HIDE +widget{ + text = lorem_ipsum, + justify = true, + widget = wibox.widget.textbox, +} +) --DOC_HIDE +--DOC_HIDE_START + +parent:add(l) + +return 320 + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/widget/textbox/line_spacing.lua b/tests/examples/wibox/widget/textbox/line_spacing.lua new file mode 100644 index 000000000..accf15547 --- /dev/null +++ b/tests/examples/wibox/widget/textbox/line_spacing.lua @@ -0,0 +1,41 @@ +--DOC_GEN_IMAGE --DOC_HIDE + +--DOC_HIDE_START +local parent = ... +local wibox = require("wibox") +local beautiful = require("beautiful") + +local widget = function(inner) + return wibox.widget { + { + inner, + margins = 5, + widget = wibox.container.margin, + }, + border_width = 1, + border_color = beautiful.border_color, + widget = wibox.container.background, + } +end + +local l = wibox.layout.grid.vertical(4) +--DOC_HIDE_END + +for _, spacing in ipairs {0.0, 0.1, 0.5, 0.9, 1, 1.5, 2.0, 2.5} do + local text = "This text shas a line\nspacing of "..tostring(spacing).. "\nunits." + --DOC_NEWLINE + l:add( --DOC_HIDE + widget{ + text = text, + font = "sans 10", + line_spacing_factor = spacing, + widget = wibox.widget.textbox, + } + ) --DOC_HIDE +end +--DOC_HIDE_START + +parent:add(l) + + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80