tests: Test the spacing widgets

This commit is contained in:
Emmanuel Lepage Vallee 2017-08-07 16:50:11 -04:00
parent e12c000b97
commit f1b4850bdc
6 changed files with 295 additions and 0 deletions

View File

@ -0,0 +1,28 @@
local generic_widget = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local first, second, third = generic_widget("first"), --DOC_HIDE
generic_widget("second"), generic_widget("third") --DOC_HIDE
local ret = wibox.layout.fixed.vertical() --DOC_HIDE
for i=1, 5 do
ret:add(wibox.widget { --DOC_HIDE
markup = "<b>Iteration " .. i ..":</b>", --DOC_HIDE
widget = wibox.widget.textbox --DOC_HIDE
}) --DOC_HIDE
local w = wibox.widget {
first,
second,
third,
spacing = i*3,
layout = wibox.layout.fixed.horizontal
}
ret:add(w) --DOC_HIDE
end
return ret, 200, 200 --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,70 @@
local generic_widget = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local gears = {shape = require("gears.shape")}--DOC_HIDE
local l = wibox.layout.flex.vertical() --DOC_HIDE
-- Use the separator widget directly
local w1 = wibox.widget {
generic_widget( "first" , nil, 0), --DOC_HIDE
generic_widget( "second" , nil, 0), --DOC_HIDE
generic_widget( "third" , nil, 0), --DOC_HIDE
spacing = 10,
spacing_widget = wibox.widget.separator,
layout = wibox.layout.fixed.horizontal
}
l:add(w1) --DOC_HIDE
-- Use a standard declarative widget construct
local w2 = wibox.widget {
generic_widget( "first" ), --DOC_HIDE
generic_widget( "second" ), --DOC_HIDE
generic_widget( "third" ), --DOC_HIDE
spacing = 10,
spacing_widget = {
color = "#00ff00",
shape = gears.shape.circle,
widget = wibox.widget.separator,
},
layout = wibox.layout.fixed.horizontal
}
l:add(w2) --DOC_HIDE
-- Use composed widgets
local w3 = wibox.widget {
generic_widget( "first" ), --DOC_HIDE
generic_widget( "second" ), --DOC_HIDE
generic_widget( "third" ), --DOC_HIDE
spacing = 10,
spacing_widget = {
{
text = "F",
widget = wibox.widget.textbox,
},
bg = "#ff0000",
widget = wibox.container.background,
},
layout = wibox.layout.fixed.horizontal
}
l:add(w3) --DOC_HIDE
-- Use negative spacing to create a powerline effect
local w4 = wibox.widget {
generic_widget( " first " , nil, 0), --DOC_HIDE
generic_widget( " second " , nil, 0), --DOC_HIDE
generic_widget( " third " , nil, 0), --DOC_HIDE
spacing = -12,
spacing_widget = {
color = "#ff0000",
shape = gears.shape.powerline,
widget = wibox.widget.separator,
},
layout = wibox.layout.fixed.horizontal
}
l:add(w4) --DOC_HIDE
return l, 250, 4*30 --DOC_HIDE

View File

@ -0,0 +1,28 @@
local generic_widget = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local first, second, third = generic_widget("first"), --DOC_HIDE
generic_widget("second"), generic_widget("third") --DOC_HIDE
local ret = wibox.layout.fixed.vertical() --DOC_HIDE
for i=1, 5 do
ret:add(wibox.widget { --DOC_HIDE
markup = "<b>Iteration " .. i ..":</b>", --DOC_HIDE
widget = wibox.widget.textbox --DOC_HIDE
}) --DOC_HIDE
local w = wibox.widget {
first,
second,
third,
spacing = i*5,
layout = wibox.layout.flex.horizontal
}
ret:add(w) --DOC_HIDE
end
return ret, 200, 200 --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,70 @@
local generic_widget = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local gears = {shape = require("gears.shape")}--DOC_HIDE
local l = wibox.layout.flex.vertical() --DOC_HIDE
-- Use the separator widget directly
local w1 = wibox.widget {
generic_widget( "first" , nil, 0), --DOC_HIDE
generic_widget( "second" , nil, 0), --DOC_HIDE
generic_widget( "third" , nil, 0), --DOC_HIDE
spacing = 10,
spacing_widget = wibox.widget.separator,
layout = wibox.layout.flex.horizontal
}
l:add(w1) --DOC_HIDE
-- Use a standard declarative widget construct
local w2 = wibox.widget {
generic_widget( "first" ), --DOC_HIDE
generic_widget( "second" ), --DOC_HIDE
generic_widget( "third" ), --DOC_HIDE
spacing = 10,
spacing_widget = {
color = "#00ff00",
shape = gears.shape.circle,
widget = wibox.widget.separator,
},
layout = wibox.layout.flex.horizontal
}
l:add(w2) --DOC_HIDE
-- Use composed widgets
local w3 = wibox.widget {
generic_widget( "first" ), --DOC_HIDE
generic_widget( "second" ), --DOC_HIDE
generic_widget( "third" ), --DOC_HIDE
spacing = 10,
spacing_widget = {
{
text = "F",
widget = wibox.widget.textbox,
},
bg = "#ff0000",
widget = wibox.container.background,
},
layout = wibox.layout.flex.horizontal
}
l:add(w3) --DOC_HIDE
-- Use negative spacing to create a powerline effect
local w4 = wibox.widget {
generic_widget( " first " , nil, 0), --DOC_HIDE
generic_widget( " second " , nil, 0), --DOC_HIDE
generic_widget( " third " , nil, 0), --DOC_HIDE
spacing = -12,
spacing_widget = {
color = "#ff0000",
shape = gears.shape.powerline,
widget = wibox.widget.separator,
},
layout = wibox.layout.flex.horizontal
}
l:add(w4) --DOC_HIDE
return l, 250, 4*30 --DOC_HIDE

View File

@ -0,0 +1,29 @@
local generic_widget = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local first, second, third = generic_widget("first"), --DOC_HIDE
generic_widget("second"), generic_widget("third") --DOC_HIDE
local ret = wibox.layout.fixed.vertical() --DOC_HIDE
for i=1, 5 do
ret:add(wibox.widget { --DOC_HIDE
markup = "<b>Iteration " .. i ..":</b>", --DOC_HIDE
widget = wibox.widget.textbox --DOC_HIDE
}) --DOC_HIDE
local w = wibox.widget {
first,
second,
third,
spacing = i*3,
force_width = 200, --DOC_HIDE
layout = wibox.layout.ratio.horizontal
}
ret:add(w) --DOC_HIDE
end
return ret, 200, 200 --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,70 @@
local generic_widget = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local gears = {shape = require("gears.shape")}--DOC_HIDE
local l = wibox.layout.flex.vertical() --DOC_HIDE
-- Use the separator widget directly
local w1 = wibox.widget {
generic_widget( "first" , nil, 0), --DOC_HIDE
generic_widget( "second" , nil, 0), --DOC_HIDE
generic_widget( "third" , nil, 0), --DOC_HIDE
spacing = 10,
spacing_widget = wibox.widget.separator,
layout = wibox.layout.ratio.horizontal
}
l:add(w1) --DOC_HIDE
-- Use a standard declarative widget construct
local w2 = wibox.widget {
generic_widget( "first" ), --DOC_HIDE
generic_widget( "second" ), --DOC_HIDE
generic_widget( "third" ), --DOC_HIDE
spacing = 10,
spacing_widget = {
color = "#00ff00",
shape = gears.shape.circle,
widget = wibox.widget.separator,
},
layout = wibox.layout.ratio.horizontal
}
l:add(w2) --DOC_HIDE
-- Use composed widgets
local w3 = wibox.widget {
generic_widget( "first" ), --DOC_HIDE
generic_widget( "second" ), --DOC_HIDE
generic_widget( "third" ), --DOC_HIDE
spacing = 10,
spacing_widget = {
{
text = "F",
widget = wibox.widget.textbox,
},
bg = "#ff0000",
widget = wibox.container.background,
},
layout = wibox.layout.ratio.horizontal
}
l:add(w3) --DOC_HIDE
-- Use negative spacing to create a powerline effect
local w4 = wibox.widget {
generic_widget( " first " , nil, 0), --DOC_HIDE
generic_widget( " second " , nil, 0), --DOC_HIDE
generic_widget( " third " , nil, 0), --DOC_HIDE
spacing = -12,
spacing_widget = {
color = "#ff0000",
shape = gears.shape.powerline,
widget = wibox.widget.separator,
},
layout = wibox.layout.ratio.horizontal
}
l:add(w4) --DOC_HIDE
return l, 250, 4*30 --DOC_HIDE