tests: Test the slider widget.

This commit is contained in:
Emmanuel Lepage Vallee 2016-08-04 18:12:59 -04:00
parent 4b34e64fe2
commit 072ff10cf0
12 changed files with 324 additions and 0 deletions

View File

@ -0,0 +1,22 @@
local parent = ... --DOC_HIDE
local wibox = require( "wibox" ) --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local gears = {shape=require("gears.shape") } --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
bar_shape = gears.shape.rounded_rect,
bar_height = 3,
bar_color = beautiful.border_color,
handle_color = beautiful.bg_normal,
handle_shape = gears.shape.circle,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
value = 25,
widget = wibox.widget.slider,
forced_height = 50, --DOC_HIDE
forced_width = 100, --DOC_HIDE
}
) --DOC_HIDE

View File

@ -0,0 +1,26 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = val,
bar_border_width = 4,
bar_margins = {},
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen("#ff0000"), gen("#00ff00"), gen("#0000ff"), gen("#ff00ff"),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,26 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 1,
bar_margins = {},
bar_color = val,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen("#ff0000"), gen("#00ff00"), gen("#0000ff"), gen("#ff00ff"),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,26 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 1,
bar_height = val,
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen(3), gen(9), gen(16), gen(nil),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,31 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 2,
bar_margins = val,
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 2,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen(0), gen(3), gen(6), gen({
top = 12,
bottom = 12,
left = 12,
right = 12,
}),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,28 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local gears = {shape = require("gears.shape")}
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_shape = gears.shape[val],
bar_border_color = beautiful.border_color,
bar_border_width = 1,
bar_margins = {},
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen("rectangle"), gen("hexagon"), gen("rounded_bar"), gen("octogon"),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,26 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 1,
bar_margins = {},
handle_color = beautiful.bg_normal,
handle_border_color = val,
handle_border_width = 4,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen("#ff0000"), gen("#00ff00"), gen("#0000ff"), gen("#ff00ff"),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,26 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 1,
bar_margins = {},
handle_color = val,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen("#ff0000"), gen("#00ff00"), gen("#0000ff"), gen("#ff00ff"),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,31 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 2,
handle_margins = val,
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 2,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen(0), gen(3), gen(6), gen({
top = 12,
bottom = 12,
left = 12,
right = 12,
}),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,28 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local gears = {shape = require("gears.shape")}
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 1,
bar_margins = {},
handle_shape = gears.shape[val],
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen("rectangle"), gen("losange"), gen("circle"), gen("isosceles_triangle"),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,27 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
bar_border_width = 2,
handle_width = val,
value = 50,
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 2,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen(0), gen(10), gen(30), gen(50),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)

View File

@ -0,0 +1,27 @@
--DOC_HIDE_ALL
local parent = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local function gen(val)
return wibox.widget {
bar_border_color = beautiful.border_color,
value = val,
bar_border_width = 4,
bar_margins = {},
handle_color = beautiful.bg_normal,
handle_border_color = beautiful.border_color,
handle_border_width = 1,
widget = wibox.widget.slider,
}
end
local l = wibox.layout {
gen(0), gen(33), gen(66), gen(100),
forced_height = 30,
forced_width = 400,
spacing = 5,
layout = wibox.layout.flex.horizontal
}
parent:add(l)