tests: fix indenting/style (#1303)

Basically:

> for f in **/*.lua; do vim '+set sw=4' '+norm gg=G' '+wq' "$f"; done
This commit is contained in:
Daniel Hahler 2016-12-27 21:39:08 +01:00 committed by GitHub
parent bdb7e90b74
commit 68de588f21
72 changed files with 1757 additions and 1770 deletions

View File

@ -519,4 +519,4 @@ end
return setmetatable(module, {
__call = function(_,...) return add_steps(...) end
})
})

View File

@ -1,10 +1,10 @@
screen[1]._resize {x = 175, width = 128, height = 96} --DOC_HIDE
mouse.coords {x=175+60,y=60} --DOC_HIDE
-- Get the position
-- Get the position
print(mouse.coords().x)
-- Change the position
-- Change the position
mouse.coords {
x = 185,
y = 10

View File

@ -4,11 +4,11 @@ screen[1]._resize {x= 50}
for _, pos in ipairs{
"top_left", "top_right", "bottom_left", "bottom_right",
"left", "right", "top", "bottom", "centered",
} do
local c1 = client.gen_fake {x = 80, y = 55, width=75, height=50}
c1:_hide()
placement.align(client.focus, {position = pos, honor_workarea=true})
c1:set_label(pos)
} do
local c1 = client.gen_fake {x = 80, y = 55, width=75, height=50}
c1:_hide()
placement.align(client.focus, {position = pos, honor_workarea=true})
c1:set_label(pos)
end
screen._add_screen {x = 70, y = 260 , width = 128, height = 96}

View File

@ -16,4 +16,4 @@ assert( --DOC_HIDE
and c.y+2*c.border_width == screen[1].geometry.height-30 --DOC_HIDE
and c.width == 40--DOC_HIDE
and c.height == 30--DOC_HIDE
) --DOC_HIDE
) --DOC_HIDE

View File

@ -5,7 +5,7 @@ local bw = c.border_width --DOC_HIDE
-- Left --DOC_HIDE
mouse.coords {x=100,y=100} --DOC_HIDE
-- Move the mouse to the closest corner of the focused client
-- Move the mouse to the closest corner of the focused client
awful.placement.closest_corner(mouse, {include_sides=true, parent=c})
mouse.push_history() --DOC_HIDE
assert(mouse.coords().x == c.x) --DOC_HIDE
@ -53,8 +53,8 @@ awful.placement.closest_corner(mouse, {include_sides=true, parent=c}) --DOC_HIDE
mouse.push_history() --DOC_HIDE
assert(mouse.coords().x == c.x and mouse.coords().y == c.y+c.height+2*bw) --DOC_HIDE
-- It is possible to emulate the mouse API to get the closest corner of
-- random area
-- It is possible to emulate the mouse API to get the closest corner of
-- random area
local _, corner = awful.placement.closest_corner(
{coords=function() return {x = 100, y=100} end},
{include_sides = true, bounding_rect = {x=0, y=0, width=200, height=200}}

View File

@ -2,9 +2,9 @@ screen[1]._resize {x = 175, width = 128, height = 96} --DOC_NO_USAGE --DOC_HIDE
local awful = {placement = require("awful.placement")} --DOC_HIDE
local c = client.gen_fake {x = 220, y = 35, width=40, height=30} --DOC_HIDE
-- "right" will be replaced by "left"
local f = (awful.placement.right + awful.placement.left)
f(client.focus)
-- "right" will be replaced by "left"
local f = (awful.placement.right + awful.placement.left)
f(client.focus)
local sg = screen[1].geometry--DOC_HIDE
assert(c.x == sg.x and c.y==sg.height/2-30/2-c.border_width--DOC_HIDE

View File

@ -2,14 +2,14 @@ screen[1]._resize {x = 175, width = 128, height = 96} --DOC_NO_USAGE --DOC_HIDE
local awful = {placement = require("awful.placement")} --DOC_HIDE
local c = client.gen_fake {x = 220, y = 35, width=40, height=30} --DOC_HIDE
-- Simulate Windows 7 "edge snap" (also called aero snap) feature
local axis = "vertically"
-- Simulate Windows 7 "edge snap" (also called aero snap) feature
local axis = "vertically"
local f = awful.placement.scale
+ awful.placement.left
+ (axis and awful.placement["maximize_"..axis] or nil)
local f = awful.placement.scale
+ awful.placement.left
+ (axis and awful.placement["maximize_"..axis] or nil)
local geo = f(client.focus, {honor_workarea=true, to_percent = 0.5})
local geo = f(client.focus, {honor_workarea=true, to_percent = 0.5})
local wa = screen[1].workarea--DOC_HIDE
assert(c.x == wa.x and geo.x == wa.x)--DOC_HIDE

View File

@ -5,8 +5,8 @@ local placement = require("awful.placement") --DOC_HIDE
for k, pos in ipairs{ --DOC_HIDE
"", "vertical", "horizontal" --DOC_HIDE
} do --DOC_HIDE
local c1 = client.gen_fake {--DOC_HIDE
} do --DOC_HIDE
local c1 = client.gen_fake {--DOC_HIDE
x = screen[k].geometry.x+40, --DOC_HIDE
y = screen[k].geometry.y+40, width=75, height=50, screen=screen[k]} --DOC_HIDE
placement.maximize(c1, {axis = pos ~= "" and pos or nil}) --DOC_HIDE

View File

@ -7,8 +7,8 @@ local placement = require("awful.placement")
for k, pos in ipairs{
"up", "down", "left", "right"
} do
local c1 = client.gen_fake {--DOC_HIDE
} do
local c1 = client.gen_fake {--DOC_HIDE
x = screen[k].geometry.x+20,
y = screen[k].geometry.y+20, width=75, height=50, screen=screen[k]}

View File

@ -4,9 +4,9 @@ shape.infobubble(cr, 70, 70)
show(cr) --DOC_HIDE
shape.transform(shape.infobubble) : translate(0, 20)
: rotate_at(35,35,math.pi) (cr,70,20,10, 5, 35 - 5)
: rotate_at(35,35,math.pi) (cr,70,20,10, 5, 35 - 5)
show(cr) --DOC_HIDE
shape.transform(shape.infobubble)
: rotate_at(35,35,3*math.pi/2) (cr,70,70, nil, nil, 40)
: rotate_at(35,35,3*math.pi/2) (cr,70,70, nil, nil, 40)
show(cr) --DOC_HIDE

View File

@ -18,7 +18,7 @@ end
return setmetatable(drawin, {
__call = new_drawin,
})
})
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -45,7 +45,7 @@ local function create_screen(args)
end
end,
__newindex = function(...) return meta.__newindex(...) end
})
})
end
local screens = {}

View File

@ -31,7 +31,7 @@ end
return setmetatable(tag, {
__call = new_tag,
})
})
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,8 +1,8 @@
local gears = require("gears") --DOC_HIDE
-- Create a class for this object. It will be used as a backup source for
-- methods and accessors. It is also possible to set them directly on the
-- object.
-- Create a class for this object. It will be used as a backup source for
-- methods and accessors. It is also possible to set them directly on the
-- object.
local class = {}
function class:get_foo()
@ -39,7 +39,7 @@ print(o.foo)
o:method(1, 2, 3)
-- Random properties can also be added, the signal will be emitted automatically.
-- Random properties can also be added, the signal will be emitted automatically.
o:connect_signal("property::something", function(obj, value)
assert(obj == o)

View File

@ -2,23 +2,23 @@ local gears = require("gears") --DOC_HIDE
local o = gears.object{}
-- Function can be attached to signals
-- Function can be attached to signals
local function slot(obj, a, b, c)
print("In slot", obj, a, b, c)
end
o:connect_signal("my_signal", slot)
-- Emitting can be done without arguments. In that case, the object will be
-- implicitly added as an argument.
-- Emitting can be done without arguments. In that case, the object will be
-- implicitly added as an argument.
o:emit_signal "my_signal"
-- It is also possible to add as many random arguments are required.
-- It is also possible to add as many random arguments are required.
o:emit_signal("my_signal", "foo", "bar", 42)
-- Finally, to allow the object to be garbage collected (the memory freed), it
-- is necessary to disconnect the signal or use `weak_connect_signal`
-- Finally, to allow the object to be garbage collected (the memory freed), it
-- is necessary to disconnect the signal or use `weak_connect_signal`
o:disconnect_signal("my_signal", slot)
-- This time, the `slot` wont be called as it is no longer connected.
-- This time, the `slot` wont be called as it is no longer connected.
o:emit_signal "my_signal"

View File

@ -76,6 +76,6 @@ parent:add(wibox.widget {
layout = wibox.layout.fixed.vertical
},
layout = wibox.layout.flex.horizontal
})
})
return 500, 60

View File

@ -4,12 +4,12 @@ local assets = require( "xresources.assets" ) --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
fit = function() return 128, 128 end,
draw = function(_, _, cr)
assets.gen_logo(cr, 128, 128, nil, "#535d6c")
end,
widget = wibox.widget.base.make_widget
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -4,7 +4,7 @@ local assets = require( "xresources.assets" ) --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
fit = function() return 148, 128 end,
draw = function(_, _, cr)
assets.gen_logo(cr, 128, 128, nil, "#535d6c")
@ -12,6 +12,6 @@ wibox.widget {
assets.gen_awesome_name(cr, 158, nil, "#535d6c", nil)
end,
widget = wibox.widget.base.make_widget
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -3,7 +3,7 @@ local wibox = require( "wibox" ) --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
checked = true,
color = beautiful.bg_normal,
bg = "#ff00ff",
@ -16,5 +16,5 @@ wibox.widget {
check_border_color = "#ffff00",
check_border_width = 1,
widget = wibox.widget.checkbox
}
) --DOC_HIDE
}
) --DOC_HIDE

View File

@ -10,7 +10,7 @@ local l = wibox.widget { --DOC_HIDE
for _, s in ipairs {"rectangle", "circle", "losange", "octogon"} do
l:add( --DOC_HIDE
l:add( --DOC_HIDE
wibox.widget {
checked = true,
color = beautiful.bg_normal,
@ -20,7 +20,7 @@ l:add( --DOC_HIDE
check_shape = gears.shape[s],
widget = wibox.widget.checkbox
}
) --DOC_HIDE
) --DOC_HIDE
end

View File

@ -30,4 +30,4 @@ parent:add( --DOC_HIDE
check_border_width = 1,
widget = wibox.widget.checkbox
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -10,7 +10,7 @@ local l = wibox.widget { --DOC_HIDE
for _, s in ipairs {"rectangle", "circle", "losange", "octogon"} do
l:add( --DOC_HIDE
l:add( --DOC_HIDE
wibox.widget {
checked = true,
color = beautiful.bg_normal,
@ -20,7 +20,7 @@ l:add( --DOC_HIDE
shape = gears.shape[s],
widget = wibox.widget.checkbox
}
) --DOC_HIDE
) --DOC_HIDE
end

View File

@ -4,8 +4,8 @@ local beautiful = require( "beautiful" ) --DOC_HIDE
local gears = {shape = require("gears.shape")} --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget { --DOC_HIDE
wibox.widget {
wibox.widget { --DOC_HIDE
wibox.widget {
checked = true,
color = beautiful.bg_normal,
paddings = 2,
@ -13,9 +13,9 @@ wibox.widget {
forced_height = 20, --DOC_HIDE
shape = gears.shape.circle,
widget = wibox.widget.checkbox
}
, --DOC_HIDE
wibox.widget { --DOC_HIDE
}
, --DOC_HIDE
wibox.widget { --DOC_HIDE
checked = false, --DOC_HIDE
color = beautiful.bg_normal, --DOC_HIDE
paddings = 2, --DOC_HIDE
@ -23,9 +23,9 @@ wibox.widget { --DOC_HIDE
forced_height = 20, --DOC_HIDE
shape = gears.shape.circle, --DOC_HIDE
widget = wibox.widget.checkbox --DOC_HIDE
}, --DOC_HIDE
spacing = 4, --DOC_HIDE
layout = wibox.layout.fixed.horizontal --DOC_HIDE
} --DOC_HIDE
}, --DOC_HIDE
spacing = 4, --DOC_HIDE
layout = wibox.layout.fixed.horizontal --DOC_HIDE
} --DOC_HIDE
) --DOC_HIDE
) --DOC_HIDE

View File

@ -4,10 +4,10 @@ local beautiful = require( "beautiful" ) --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
image = beautiful.awesome_icon,
resize = false,
widget = wibox.widget.imagebox
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -4,7 +4,7 @@ local beautiful = require( "beautiful" ) --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
data_list = {
{ 'L1', 100 },
{ 'L2', 200 },
@ -19,6 +19,6 @@ wibox.widget {
beautiful.border_color,
},
widget = wibox.widget.piechart
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -5,7 +5,7 @@ local beautiful = require("beautiful") --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
max_value = 1,
value = 0.33,
forced_height = 20,
@ -14,6 +14,6 @@ wibox.widget {
border_width = 2,
border_color = beautiful.border_color,
widget = wibox.widget.progressbar,
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -5,7 +5,7 @@ local gears = {shape=require("gears.shape") } --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
bar_shape = gears.shape.rounded_rect,
bar_height = 3,
bar_color = beautiful.border_color,
@ -17,6 +17,6 @@ wibox.widget {
widget = wibox.widget.slider,
forced_height = 50, --DOC_HIDE
forced_width = 100, --DOC_HIDE
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -3,11 +3,11 @@ local wibox = require("wibox") --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget{
wibox.widget{
markup = "This <i>is</i> a <b>textbox</b>!!!",
align = "center",
valign = "center",
widget = wibox.widget.textbox
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -63,6 +63,6 @@ parent:add(wibox.widget {
layout = wibox.layout.fixed.vertical
},
layout = wibox.layout.flex.horizontal
})
})
return 500, 60

View File

@ -5,7 +5,7 @@ local beautiful = require("beautiful") --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
wibox.widget {
value = 75,
max_value = 100,
border_width = 2,
@ -22,6 +22,6 @@ wibox.widget {
bottom = 12,
},
widget = wibox.widget.progressbar,
}
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -22,4 +22,4 @@ parent:add( --DOC_HIDE
layout = wibox.layout.stack
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -15,4 +15,4 @@ parent:add( --DOC_HIDE
layout = wibox.container.rotate,
}
) --DOC_HIDE
) --DOC_HIDE

View File

@ -26,7 +26,7 @@ end
local steps = {
function(count)
function(count)
if count <= 5 then
awful.spawn("xterm")
elseif #client.get() >= 5 then
@ -35,10 +35,10 @@ function(count)
return true
end
end,
end,
-- Wait for the focus to change
function()
-- Wait for the focus to change
function()
assert(old_c)
-- Test layout
@ -60,10 +60,10 @@ function()
get_callback({modkey}, "t")()
return true
end,
end,
-- Ok, no now ontop should be true
function()
-- Ok, no now ontop should be true
function()
local _, t = get_c_and_t()
-- Give awesome some time
@ -77,10 +77,10 @@ function()
get_callback({modkey}, "l")()
return true
end,
end,
-- The master width factor should now be bigger
function()
-- The master width factor should now be bigger
function()
local _, t = get_c_and_t()
assert(t.master_width_factor == 0.55)
@ -91,10 +91,10 @@ function()
get_callback({modkey, "Shift"}, "h")()
return true
end,
end,
-- The number of master client should now be 2
function()
-- The number of master client should now be 2
function()
local _, t = get_c_and_t()
assert(t.master_count == 2)
@ -106,10 +106,10 @@ function()
get_callback({modkey, "Shift" }, "l")()
return true
end,
end,
-- The number of columns should now be 2
function()
-- The number of columns should now be 2
function()
local _, t = get_c_and_t()
assert(t.column_count == 2)
@ -120,23 +120,23 @@ function()
get_callback({modkey, }, "Right")()
return true
end,
end,
-- The tag index should now be 2
function()
-- The tag index should now be 2
function()
local tags = mouse.screen.tags
-- local t = awful.screen.focused().selected_tag
-- local t = awful.screen.focused().selected_tag
-- assert(t.index == 2)--FIXME
-- assert(t.index == 2)--FIXME
assert(tags[1].index == 1)
tags[1]:view_only()
return true
end,
end,
-- Before testing tags, lets make sure everything is still right
function()
-- Before testing tags, lets make sure everything is still right
function()
local tags = mouse.screen.tags
assert(tags[1].selected)
@ -158,10 +158,10 @@ function()
assert(#mouse.screen.all_clients - #mouse.screen.hidden_clients == #clients)
return true
end,
end,
-- Now, test switching tags
function()
-- Now, test switching tags
function()
local tags = mouse.screen.tags
local clients = mouse.screen.all_clients
@ -186,10 +186,10 @@ function()
tags[1]:view_only()
return true
end,
end,
-- Lets shift some clients around
function()
-- Lets shift some clients around
function()
local tags = mouse.screen.tags
-- Given all tags have been selected, the selection should be back on
@ -202,10 +202,10 @@ function()
assert(not client.focus)
return true
end,
end,
-- The client should be on tag 5
function()
-- The client should be on tag 5
function()
-- Confirm the move did happen
local tags = mouse.screen.tags
assert(tags[1].selected)
@ -222,7 +222,7 @@ function()
assert(#tags[1]:clients() == 4)
return true
end
end
}
require("_runner").run_steps(steps)

View File

@ -6,75 +6,75 @@ awful.util.deprecate = function() end
local has_spawned = false
local steps = {
function(count)
function(count)
if count <= 1 and not has_spawned and #client.get() < 2 then
if count <= 1 and not has_spawned and #client.get() < 2 then
awful.spawn("xterm")
awful.spawn("xterm")
has_spawned = true
elseif #client.get() >= 2 then
elseif #client.get() >= 2 then
-- Test properties
client.focus = client.get()[1]
local c = client.focus
-- local c2 = client.get()[2]
-- Test properties
client.focus = client.get()[1]
local c = client.focus
-- local c2 = client.get()[2]
c.foo = "bar"
c.foo = "bar"
-- Check if the property system works
assert(c.foo == "bar")
assert(c.foo == awful.client.property.get(c, "foo"))
-- Check if the property system works
assert(c.foo == "bar")
assert(c.foo == awful.client.property.get(c, "foo"))
-- Test jumpto
-- Test jumpto
--FIXME doesn't work
-- c2:jump_to()
-- assert(client.focus == c2)
-- awful.client.jumpto(c)
-- assert(client.focus == c)
--FIXME doesn't work
-- c2:jump_to()
-- assert(client.focus == c2)
-- awful.client.jumpto(c)
-- assert(client.focus == c)
-- Test moveresize
c.size_hints_honor = false
c:geometry {x=0,y=0,width=50,height=50}
c:relative_move( 100, 100, 50, 50 )
for _,v in pairs(c:geometry()) do
-- Test moveresize
c.size_hints_honor = false
c:geometry {x=0,y=0,width=50,height=50}
c:relative_move( 100, 100, 50, 50 )
for _,v in pairs(c:geometry()) do
assert(v == 100)
end
awful.client.moveresize(-25, -25, -25, -25, c )
for _,v in pairs(c:geometry()) do
end
awful.client.moveresize(-25, -25, -25, -25, c )
for _,v in pairs(c:geometry()) do
assert(v == 75)
end
end
-- Test movetotag
-- Test movetotag
local t = mouse.screen.tags[1]
local t2 = mouse.screen.tags[2]
local t = mouse.screen.tags[1]
local t2 = mouse.screen.tags[2]
c:tags{t}
assert(c:tags()[1] == t)
c:move_to_tag(t2)
assert(c:tags()[1] == t2)
awful.client.movetotag(t, c)
assert(c:tags()[1] == t)
c:tags{t}
assert(c:tags()[1] == t)
c:move_to_tag(t2)
assert(c:tags()[1] == t2)
awful.client.movetotag(t, c)
assert(c:tags()[1] == t)
-- Test toggletag
-- Test toggletag
c:tags{t}
c:toggle_tag(t2)
assert(c:tags()[1] == t2 or c:tags()[2] == t2)
awful.client.toggletag(t2, c)
assert(c:tags()[1] == t and c:tags()[1] ~= t2 and c:tags()[2] == nil)
c:tags{t}
c:toggle_tag(t2)
assert(c:tags()[1] == t2 or c:tags()[2] == t2)
awful.client.toggletag(t2, c)
assert(c:tags()[1] == t and c:tags()[1] ~= t2 and c:tags()[2] == nil)
-- Test floating
assert(c.floating ~= nil and type(c.floating) == "boolean")
c.floating = true
assert(awful.client.floating.get(c))
awful.client.floating.set(c, false)
assert(not c.floating)
-- Test floating
assert(c.floating ~= nil and type(c.floating) == "boolean")
c.floating = true
assert(awful.client.floating.get(c))
awful.client.floating.set(c, false)
assert(not c.floating)
return true
end
end
return true
end
end
}
local original_count, c1, c2 = 0
@ -108,21 +108,21 @@ table.insert(steps, function()
end)
table.insert(steps, function()
-- The request should have been denied
assert(client.focus == c2)
-- The request should have been denied
assert(client.focus == c2)
-- Test the remove function
awful.ewmh.remove_activate_filter(function() end)
-- Test the remove function
awful.ewmh.remove_activate_filter(function() end)
awful.ewmh.add_activate_filter(awful.ewmh.generic_activate_filters[1])
awful.ewmh.add_activate_filter(awful.ewmh.generic_activate_filters[1])
awful.ewmh.remove_activate_filter(awful.ewmh.generic_activate_filters[1])
awful.ewmh.remove_activate_filter(awful.ewmh.generic_activate_filters[1])
assert(original_count == #awful.ewmh.generic_activate_filters)
assert(original_count == #awful.ewmh.generic_activate_filters)
c1:emit_signal("request::activate", "i_said_so")
c1:emit_signal("request::activate", "i_said_so")
return client.focus == c1
return client.focus == c1
end)
local has_error
@ -229,81 +229,81 @@ table.insert(multi_screen_steps, function()
end)
table.insert(multi_screen_steps, function()
if #client.get() ~= screen.count() then return end
if #client.get() ~= screen.count() then return end
for _, c in ipairs(client.get()) do
for _, c in ipairs(client.get()) do
assert(#c:tags() == 1)
assert(c.first_tag.name == "NEW_AT_"..c.screen.index)
end
end
-- Kill the client
for _, c in ipairs(client.get()) do
-- Kill the client
for _, c in ipairs(client.get()) do
c:kill()
end
end
if screen.count() < 2 then return true end
if screen.count() < 2 then return true end
-- Now, add client where the target tag and screen don't match
test_client("test_tag1", nil, {
-- Now, add client where the target tag and screen don't match
test_client("test_tag1", nil, {
tag = screen[2].tags[2],
screen = screen[1],
})
-- Add a client with multiple tags on the same screen, but not c.screen
test_client("test_tags1", nil, {
-- Add a client with multiple tags on the same screen, but not c.screen
test_client("test_tags1", nil, {
tags = { screen[1].tags[3], screen[1].tags[4] },
screen = screen[2],
})
-- Identical, but using the tag names
test_client("test_tags2", nil, {
-- Identical, but using the tag names
test_client("test_tags2", nil, {
tags = { "3", "4" },
screen = screen[2],
})
-- Also test tags, but with an invalid screen array
test_client("test_tags3", nil, {
-- Also test tags, but with an invalid screen array
test_client("test_tags3", nil, {
tags = { screen[2].tags[3], screen[1].tags[4] },
screen = screen[1],
})
-- Another test for tags, but with no matching names
test_client("test_tags4", nil, {
-- Another test for tags, but with no matching names
test_client("test_tags4", nil, {
tags = { "foobar", "bobcat" },
screen = screen[1],
})
return true
return true
end)
table.insert(multi_screen_steps, function()
if screen.count() < 2 then return true end
if #client.get() ~= 5 then return end
if screen.count() < 2 then return true end
if #client.get() ~= 5 then return end
local c_by_class = {}
local c_by_class = {}
for _, c in ipairs(client.get()) do
for _, c in ipairs(client.get()) do
c_by_class[c.class] = c
end
end
assert(c_by_class["test_tag1"].screen == screen[2])
assert(#c_by_class["test_tag1"]:tags() == 1)
assert(c_by_class["test_tag1"].screen == screen[2])
assert(#c_by_class["test_tag1"]:tags() == 1)
assert(c_by_class["test_tags1"].screen == screen[1])
assert(#c_by_class["test_tags1"]:tags() == 2)
assert(c_by_class["test_tags1"].screen == screen[1])
assert(#c_by_class["test_tags1"]:tags() == 2)
assert(c_by_class["test_tags2"].screen == screen[2])
assert(#c_by_class["test_tags2"]:tags() == 2)
assert(c_by_class["test_tags2"].screen == screen[2])
assert(#c_by_class["test_tags2"]:tags() == 2)
assert(c_by_class["test_tags3"].screen == screen[2])
assert(#c_by_class["test_tags3"]:tags() == 1)
assert(c_by_class["test_tags3"].screen == screen[2])
assert(#c_by_class["test_tags3"]:tags() == 1)
assert(c_by_class["test_tags4"].screen == screen[1])
assert(#c_by_class["test_tags4"]:tags() == 1)
assert(c_by_class["test_tags4"]:tags()[1] == screen[1].selected_tag)
assert(c_by_class["test_tags4"].screen == screen[1])
assert(#c_by_class["test_tags4"]:tags() == 1)
assert(c_by_class["test_tags4"]:tags()[1] == screen[1].selected_tag)
return true
return true
end)
require("_multi_screen")(steps, multi_screen_steps)

View File

@ -11,8 +11,8 @@ local has_spawned = false
local steps = {
-- Add enough clients
function(count)
-- Add enough clients
function(count)
if count <= 1 and not has_spawned then
for _=1, 5 do awful.spawn("xterm") end
has_spawned = true
@ -24,7 +24,7 @@ function(count)
return true
end
end,
end,
}

View File

@ -4,86 +4,73 @@ awful.util.deprecate = function() end
local has_spawned = false
local steps = {
function(count)
if count <= 1 and not has_spawned and #client.get() < 2 then
function(count)
if count <= 1 and not has_spawned and #client.get() < 2 then
awful.spawn("xterm")
awful.spawn("xterm")
has_spawned = true
elseif #client.get() >= 2 then
-- Test properties
client.focus = client.get()[1]
elseif #client.get() >= 2 then
-- Test properties
client.focus = client.get()[1]
local s = mouse.screen
local s = mouse.screen
assert(s)
assert(s == screen[s])
assert(s)
assert(s == screen[s])
-- Test padding
s.padding = 42
local counter = 0
for _, v in pairs(s.padding) do
-- Test padding
s.padding = 42
local counter = 0
for _, v in pairs(s.padding) do
assert(v == 42)
counter = counter + 1
end
end
assert(counter == 4)
assert(counter == 4)
awful.screen.padding(s, {
awful.screen.padding(s, {
left = 1337,
right = 1337,
top = 1337,
bottom = 1337,
})
counter = 0
for _, v in pairs(s.padding) do
})
counter = 0
for _, v in pairs(s.padding) do
assert(v == 1337)
counter = counter + 1
end
end
assert(counter == 4)
assert(counter == 4)
counter = 0
for _, v in pairs(awful.screen.padding(s)) do
counter = 0
for _, v in pairs(awful.screen.padding(s)) do
assert(v == 1337)
counter = counter + 1
end
end
assert(counter == 4)
assert(counter == 4)
-- Test square distance
assert(s:get_square_distance(9999, 9999))
assert(s:get_square_distance(9999, 9999)
-- Test square distance
assert(s:get_square_distance(9999, 9999))
assert(s:get_square_distance(9999, 9999)
== awful.screen.getdistance_sq(s, 9999, 9999))
-- Test count
counter = 0
for _ in screen do
-- Test count
counter = 0
for _ in screen do
counter = counter + 1
end
end
assert(screen.count() == counter)
assert(screen.count() == counter)
counter = 0
awful.screen.connect_for_each_screen(function()
counter = 0
awful.screen.connect_for_each_screen(function()
counter = counter + 1
end)
end)
assert(screen.count() == counter)
assert(screen.count() == counter)
return true
end
end
return true
end
end
}
require("_runner").run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -14,118 +14,118 @@ end
local has_spawned = false
local steps = {
function(count)
function(count)
if count <= 1 and not has_spawned and #client.get() < 2 then
if count <= 1 and not has_spawned and #client.get() < 2 then
awful.spawn("xterm")
awful.spawn("xterm")
has_spawned = true
elseif #client.get() >= 2 then
elseif #client.get() >= 2 then
-- Test move, swap and index
-- Test move, swap and index
local tags = mouse.screen.tags
local tags = mouse.screen.tags
assert(#mouse.screen.tags == 9)
assert(#mouse.screen.tags == 9)
check_order()
check_order()
tags[7].index = 9
assert(tags[7].index == 9)
tags[7].index = 9
assert(tags[7].index == 9)
check_order()
check_order()
tags[7].index = 4
assert(tags[7].index == 4)
tags[7].index = 4
assert(tags[7].index == 4)
check_order()
check_order()
awful.tag.move(5, tags[7])
assert(tags[7].index == 5)
awful.tag.move(5, tags[7])
assert(tags[7].index == 5)
check_order()
check_order()
tags[1]:swap(tags[3])
tags[1]:swap(tags[3])
check_order()
check_order()
assert(tags[1].index == 3)
assert(tags[3].index == 1)
assert(tags[1].index == 3)
assert(tags[3].index == 1)
check_order()
check_order()
awful.tag.swap(tags[1], tags[3])
awful.tag.swap(tags[1], tags[3])
assert(tags[3].index == 3)
assert(tags[1].index == 1)
assert(tags[3].index == 3)
assert(tags[1].index == 1)
check_order()
check_order()
-- Test add, icon and delete
-- Test add, icon and delete
client.focus = client.get()[1]
local c = client.focus
assert(c and client.focus == c)
assert(beautiful.awesome_icon)
client.focus = client.get()[1]
local c = client.focus
assert(c and client.focus == c)
assert(beautiful.awesome_icon)
local t = awful.tag.add("Test", {clients={c}, icon = beautiful.awesome_icon})
local t = awful.tag.add("Test", {clients={c}, icon = beautiful.awesome_icon})
check_order()
check_order()
local found = false
local found = false
tags = mouse.screen.tags
tags = mouse.screen.tags
assert(#tags == 10)
assert(#tags == 10)
for _, v in ipairs(tags) do
for _, v in ipairs(tags) do
if t == v then
found = true
break
end
end
end
assert(found)
assert(found)
assert(t:clients()[1] == c)
assert(c:tags()[2] == t)
assert(t.icon == beautiful.awesome_icon)
assert(t:clients()[1] == c)
assert(c:tags()[2] == t)
assert(t.icon == beautiful.awesome_icon)
t:delete()
t:delete()
tags = mouse.screen.tags
assert(#tags == 9)
tags = mouse.screen.tags
assert(#tags == 9)
found = false
found = false
for _, v in ipairs(tags) do
for _, v in ipairs(tags) do
if t == v then
found = true
break
end
end
end
assert(not found)
assert(not found)
-- Test selected tags, view only and selected()
-- Test selected tags, view only and selected()
t = tags[2]
t = tags[2]
assert(not t.selected)
assert(not t.selected)
assert(t.screen.selected_tag == tags[1])
assert(t.screen.selected_tag == tags[1])
t:view_only()
t:view_only()
assert(t.selected)
assert(t.selected)
assert(not tags[1].selected)
assert(not tags[1].selected)
assert(#t.screen.selected_tags == 1)
assert(#t.screen.selected_tags == 1)
return true
end
end
return true
end
end
}
local multi_screen_steps = {}

View File

@ -68,7 +68,7 @@ table.insert(steps, function()
awful.button({}, 1, nil, function ()
button:emit_signal_recursive("test::recursive")
end)
))
))
layout:connect_signal("test::recursive", function()
got_called = true
@ -87,9 +87,9 @@ table.insert(steps, function()
end)
table.insert(steps, function()
assert(button._private.image ~= img)
assert(button._private.image ~= img)
return true
return true
end)
-- Test a button release
@ -111,29 +111,29 @@ table.insert(steps, function()
end)
table.insert(steps, function()
assert(button._private.image ~= img)
assert(button._private.image ~= img)
return true
return true
end)
table.insert(steps, function()
-- just make sure the button is not released for nothing
assert(button._private.image ~= img)
-- just make sure the button is not released for nothing
assert(button._private.image ~= img)
-- test if the button is released when the mouse move out
awful.placement.right(mouse--[[, {parent = w}]])
root.fake_input("button_release", 1)
-- test if the button is released when the mouse move out
awful.placement.right(mouse--[[, {parent = w}]])
root.fake_input("button_release", 1)
return true
return true
end)
table.insert(steps, function()
assert(button._private.image == img)
assert(button._private.image == img)
-- The button had plenty of clicks by now. Make sure everything worked
assert(got_called)
-- The button had plenty of clicks by now. Make sure everything worked
assert(got_called)
return true
return true
end)
runner.run_steps(steps)

View File

@ -28,6 +28,6 @@ runner.run_steps({
c2:swap(c1)
return true
end,
})
})
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -51,6 +51,6 @@ runner.run_steps({
return true
end
end,
})
})
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -18,7 +18,7 @@ awful.rules.rules = {
width = 100,
height = 100,
border_color = beautiful.border_normal
}
}
}
}
@ -65,8 +65,8 @@ local steps = {
height = 100
}
}
}
return true
}
return true
end,
function(count)
if count == 1 then

View File

@ -21,23 +21,23 @@ table.insert(steps, function(count)
end)
table.insert(steps, function()
-- The mousegrabber expect a button to be pressed.
root.fake_input("button_press",1)
local c = client.get()[1]
-- The mousegrabber expect a button to be pressed.
root.fake_input("button_press",1)
local c = client.get()[1]
-- Just in case there is an accidental delayed geometry callback
assert(c:geometry().x == 200)
assert(c:geometry().y == 200)
assert(c:geometry().width == 300)
assert(c:geometry().height == 300)
-- Just in case there is an accidental delayed geometry callback
assert(c:geometry().x == 200)
assert(c:geometry().y == 200)
assert(c:geometry().width == 300)
assert(c:geometry().height == 300)
mouse.coords {x = 500+2*c.border_width, y= 500+2*c.border_width}
mouse.coords {x = 500+2*c.border_width, y= 500+2*c.border_width}
local corner = amouse.client.resize(c)
local corner = amouse.client.resize(c)
assert(corner == "bottom_right")
assert(corner == "bottom_right")
return true
return true
end)
-- The geometry should remain the same, as the cursor is placed at the end of
@ -108,8 +108,8 @@ table.insert(steps, function()
assert(c:geometry().x == 100)
assert(c:geometry().y == 200)
-- assert(c:geometry().width == 200-2*c.border_width) --FIXME off by border width...
-- assert(c:geometry().height == 200-2*c.border_width) --FIXME off by border width...
-- assert(c:geometry().width == 200-2*c.border_width) --FIXME off by border width...
-- assert(c:geometry().height == 200-2*c.border_width) --FIXME off by border width...
mouse.coords {x = 300, y= 200}
@ -120,9 +120,9 @@ end)
table.insert(steps, function()
root.fake_input("button_release",1)
-- if not mousegrabber.isrunning then --FIXME it should work, but doesn't
-- return true
-- end
-- if not mousegrabber.isrunning then --FIXME it should work, but doesn't
-- return true
-- end
mousegrabber.stop()

View File

@ -19,6 +19,6 @@ runner.run_steps({
return true
end
end
})
})
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -78,40 +78,40 @@ table.insert(steps, function()
end)
table.insert(steps, function()
assert(parent:geometry().width == 500)
assert(parent:geometry().height == 500)
assert(parent:geometry().width == 500)
assert(parent:geometry().height == 500)
assert(parent:geometry().y == small:geometry().y)
assert(parent:geometry().x == small:geometry().x)
assert(parent:geometry().width == small:geometry().width )
assert(small:geometry().height == 24)
assert(parent:geometry().y == small:geometry().y)
assert(parent:geometry().x == small:geometry().x)
assert(parent:geometry().width == small:geometry().width )
assert(small:geometry().height == 24)
-- Now, move the parent and see of the attached one is correctly updated
placement.stretch_left(parent)
-- Now, move the parent and see of the attached one is correctly updated
placement.stretch_left(parent)
return true
return true
end)
table.insert(steps, function()
assert(parent:geometry().y == small:geometry().y)
assert(parent:geometry().x == small:geometry().x)
assert(parent:geometry().width == small:geometry().width )
assert(small:geometry().height == 24)
assert(parent:geometry().y == small:geometry().y)
assert(parent:geometry().x == small:geometry().x)
assert(parent:geometry().width == small:geometry().width )
assert(small:geometry().height == 24)
-- Do the same, but with placement compositing
small = wibox {
-- Do the same, but with placement compositing
small = wibox {
bg = "#ff0000",
height = 50,
width = 50,
ontop = true,
visible = true,
}
}
local p = placement.bottom_right + placement.scale
local p = placement.bottom_right + placement.scale
p(small, {parent=parent, attach=true, direction="left", to_percent=0.5})
p(small, {parent=parent, attach=true, direction="left", to_percent=0.5})
return true
return true
end)
local function check_ratio()
@ -153,27 +153,27 @@ table.insert(steps, function()
end)
table.insert(steps, function()
local wa = screen.primary.workarea
local sgeo = screen.primary.geometry
local wgeo = twibar:geometry()
local wa = screen.primary.workarea
local sgeo = screen.primary.geometry
local wgeo = twibar:geometry()
assert(wa.width == sgeo.width )
assert(wa.x == sgeo.x )
assert(wa.y == sgeo.y + wgeo.height )
assert(wa.width == sgeo.width )
assert(wa.x == sgeo.x )
assert(wa.y == sgeo.y + wgeo.height )
-- assert(wa.height == sgeo.height - wgeo.height)
-- assert(wgeo.height == sgeo.height - wa.height )
assert(parent.y == wa.y )
assert(parent.x == wa.x )
assert(parent.width == wa.width )
assert(parent.height == wa.height )
assert(parent.y == wa.y )
assert(parent.x == wa.x )
assert(parent.width == wa.width )
assert(parent.height == wa.height )
-- Add more wibars
bwibar = wibar {position = "bottom", bg = "#00ff00"}
lwibar = wibar {position = "left" , bg = "#0000ff"}
rwibar = wibar {position = "right" , bg = "#ff00ff"}
-- Add more wibars
bwibar = wibar {position = "bottom", bg = "#00ff00"}
lwibar = wibar {position = "left" , bg = "#0000ff"}
rwibar = wibar {position = "right" , bg = "#ff00ff"}
return true
return true
end)
-- Make sure the maximized client has the right size and position
@ -217,7 +217,7 @@ table.insert(steps, function()
parent.border_color = "#ffff00"
parent.border_width = 10
parent.ontop = true
-- parent.visible = false
-- parent.visible = false
local wa = screen.primary.workarea
local sgeo = screen.primary.geometry
@ -243,54 +243,54 @@ table.insert(steps, function()
end)
table.insert(steps, function()
check_maximize()
check_maximize()
-- There should be a detach callback
assert(lwibar.detach_callback)
-- There should be a detach callback
assert(lwibar.detach_callback)
-- Begin to move wibars around
lwibar.position = "top"
assert(lwibar.position == "top")
assert(lwibar.y == twibar.height)
-- Begin to move wibars around
lwibar.position = "top"
assert(lwibar.position == "top")
assert(lwibar.y == twibar.height)
return true
return true
end)
table.insert(steps, function()
check_maximize()
check_maximize()
bwibar.position = "right"
bwibar.ontop = true
rwibar.ontop = true
assert(bwibar.position == "right")
bwibar.position = "right"
bwibar.ontop = true
rwibar.ontop = true
assert(bwibar.position == "right")
return true
return true
end)
table.insert(steps, function()
check_maximize()
check_maximize()
rwibar.position = "top"
rwibar.position = "top"
return true
return true
end)
table.insert(steps, function()
check_maximize()
check_maximize()
bwibar.position = "top"
bwibar.position = "top"
return true
return true
end)
table.insert(steps, function()
check_maximize()
check_maximize()
for _, w in ipairs {twibar, lwibar, rwibar, bwibar} do
for _, w in ipairs {twibar, lwibar, rwibar, bwibar} do
w.position = "right"
end
end
return true
return true
end)
-- Test visibility
@ -304,17 +304,17 @@ table.insert(steps, function()
end)
table.insert(steps, function()
check_maximize()
check_maximize()
twibar.visible = true
twibar.visible = true
return true
return true
end)
table.insert(steps, function()
check_maximize()
check_maximize()
return true
return true
end)

View File

@ -54,83 +54,83 @@ table.insert(steps, function()
end)
table.insert(steps, function()
wp.fit(img, screen[1], "#00ff00")
wp.fit(img, screen[1], "#00ff00")
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.centered(img, nil, nil)
wp.centered(img, screen[1], nil)
wp.centered(img, nil, nil)
wp.centered(img, screen[1], nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.centered(img, screen[1], "#00ff00")
wp.centered(img, screen[1], "#00ff00")
return true
return true
end)
table.insert(steps, function()
wp.maximized(img, nil, nil, nil)
wp.maximized(img, nil, nil, nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.maximized(img, screen[1], nil, nil)
wp.maximized(img, screen[1], nil, nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.maximized(img, screen[1], false, nil)
wp.maximized(img, screen[1], true, nil)
wp.maximized(img, screen[1], false, nil)
wp.maximized(img, screen[1], true, nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.maximized(img, screen[1], false, {x=10, y= 10})
wp.maximized(img, screen[1], true, {x=10, y= 10})
wp.maximized(img, screen[1], false, {x=10, y= 10})
wp.maximized(img, screen[1], true, {x=10, y= 10})
return true
return true
end)
table.insert(steps, function()
wp.tiled(img, nil, nil)
wp.tiled(img, screen[1], nil)
wp.tiled(img, nil, nil)
wp.tiled(img, screen[1], nil)
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
-- There is a delayed call for the last call, let it be processed before
-- adding more
return true
end)
table.insert(steps, function()
wp.tiled(img, screen[1], {x=10, y= 10})
wp.tiled(img, screen[1], {x=10, y= 10})
return true
return true
end)
table.insert(steps, function()
for _, c in ipairs(colors) do
for _, c in ipairs(colors) do
wp.set(c)
end
end
return true
return true
end)