tests: Add more textbox tests.
This commit is contained in:
parent
d7f6410e09
commit
b16505733a
|
@ -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",
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue