From 68de588f210aa7e540b1ceba815db6afc8ef2c67 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 27 Dec 2016 21:39:08 +0100 Subject: [PATCH] tests: fix indenting/style (#1303) Basically: > for f in **/*.lua; do vim '+set sw=4' '+norm gg=G' '+wq' "$f"; done --- tests/_multi_screen.lua | 190 ++++----- tests/_runner.lua | 128 +++--- tests/examples/awful/mouse/coords.lua | 4 +- tests/examples/awful/placement/align.lua | 14 +- tests/examples/awful/placement/bottom.lua | 4 +- .../examples/awful/placement/bottom_left.lua | 10 +- .../awful/placement/closest_mouse.lua | 6 +- tests/examples/awful/placement/compose.lua | 8 +- tests/examples/awful/placement/compose2.lua | 12 +- tests/examples/awful/placement/left.lua | 2 +- tests/examples/awful/placement/maximize.lua | 12 +- .../awful/placement/resize_to_mouse.lua | 4 +- tests/examples/awful/placement/stretch.lua | 10 +- .../examples/awful/placement/stretch_down.lua | 2 +- tests/examples/awful/placement/top_right.lua | 2 +- tests/examples/gears/shape/infobubble.lua | 4 +- tests/examples/shims/client.lua | 6 +- tests/examples/shims/drawin.lua | 10 +- tests/examples/shims/screen.lua | 40 +- tests/examples/shims/tag.lua | 10 +- .../examples/text/gears/object/properties.lua | 8 +- tests/examples/text/gears/object/signal.lua | 14 +- .../examples/wibox/container/arcchart/bg.lua | 48 +-- .../wibox/container/arcchart/border_width.lua | 60 +-- .../wibox/container/arcchart/paddings.lua | 126 +++--- .../wibox/container/arcchart/rounded_edge.lua | 146 +++---- .../wibox/container/arcchart/start_angle.lua | 42 +- .../wibox/container/arcchart/thickness.lua | 50 +-- .../wibox/container/arcchart/value.lua | 28 +- .../wibox/container/defaults/template.lua | 6 +- tests/examples/wibox/logo/logo.lua | 16 +- tests/examples/wibox/logo/logo_and_name.lua | 20 +- tests/examples/wibox/widget/checkbox/bg.lua | 30 +- .../wibox/widget/checkbox/check_shape.lua | 22 +- .../examples/wibox/widget/checkbox/custom.lua | 54 +-- .../examples/wibox/widget/checkbox/shape.lua | 22 +- .../wibox/widget/defaults/checkbox.lua | 48 +-- .../wibox/widget/defaults/imagebox.lua | 12 +- .../wibox/widget/defaults/piechart.lua | 34 +- .../wibox/widget/defaults/progressbar.lua | 22 +- .../examples/wibox/widget/defaults/slider.lua | 28 +- .../wibox/widget/defaults/textbox.lua | 14 +- .../wibox/widget/piechart/border_color.lua | 32 +- .../wibox/widget/piechart/border_width.lua | 30 +- .../examples/wibox/widget/piechart/label.lua | 120 +++--- .../wibox/widget/progressbar/bar_shape.lua | 20 +- .../wibox/widget/progressbar/clip.lua | 38 +- .../wibox/widget/progressbar/shape.lua | 14 +- .../wibox/widget/progressbar/text.lua | 36 +- .../wibox/widget/progressbar/vertical.lua | 24 +- .../wibox/widget/slider/bar_margins.lua | 10 +- .../wibox/widget/slider/handle_margins.lua | 10 +- tests/test-awesomerc.lua | 388 +++++++++--------- tests/test-awful-client.lua | 268 ++++++------ tests/test-awful-layout.lua | 24 +- tests/test-awful-screen.lua | 127 +++--- tests/test-awful-tag.lua | 170 ++++---- tests/test-awful-widget-button.lua | 30 +- tests/test-benchmark.lua | 2 +- tests/test-client-swap.lua | 46 +-- tests/test-dbus-error.lua | 14 +- tests/test-drawable-bgimage.lua | 48 +-- tests/test-focus.lua | 54 +-- tests/test-geometry.lua | 40 +- tests/test-leak-client.lua | 24 +- tests/test-resize.lua | 36 +- tests/test-signal.lua | 14 +- tests/test-spawn-snid.lua | 70 ++-- tests/test-spawn.lua | 146 +++---- tests/test-struts.lua | 144 +++---- tests/test-urgent.lua | 144 +++---- tests/test-wallpaper.lua | 76 ++-- 72 files changed, 1757 insertions(+), 1770 deletions(-) diff --git a/tests/_multi_screen.lua b/tests/_multi_screen.lua index c333db872..82aa7fe86 100644 --- a/tests/_multi_screen.lua +++ b/tests/_multi_screen.lua @@ -355,16 +355,16 @@ local function clear_screen() return end for s in screen do - local sur = surface.widget_to_surface( - wibox.widget { - bg = "#000000", - widget = wibox.container.background - }, - s.geometry.width, - s.geometry.height - ) - wallpaper.fit(sur, s, "#000000") - end + local sur = surface.widget_to_surface( + wibox.widget { + bg = "#000000", + widget = wibox.container.background + }, + s.geometry.width, + s.geometry.height + ) + wallpaper.fit(sur, s, "#000000") + end end -- Make it easier to debug the tests by showing the screen geometry when the @@ -419,97 +419,97 @@ local function add_steps(real_steps, new_steps) end) table.insert(real_steps, function() - clear_screen() - local keep = dispo.keep or false - local old = {} - local geos = {} + clear_screen() + local keep = dispo.keep or false + local old = {} + local geos = {} + + check_tag_indexes() + + if keep then + for _, sf in ipairs(dispo) do + local geo = sf and sf() or nil + + -- If the function return nothing, assume the screen need to + -- be destroyed. + table.insert(geos, geo or false) + end + + -- Removed screens need to be explicit. + assert(#geos >= screen.count()) + + -- Keep a cache to avoid working with invalid data + local old_screens = {} + for s in screen do + table.insert(old_screens, s) + end + + for i, s in ipairs(old_screens) do + -- Remove the screen (if no new geometry is given + if not geos[i] then + s:fake_remove() + else + local cur_geo = s.geometry + for _, v in ipairs {"x", "y", "width", "height" } do + cur_geo[v] = geos[i][v] or cur_geo[v] + end + s:fake_resize( + cur_geo.x, + cur_geo.y, + cur_geo.width, + cur_geo.height + ) + end + end + + -- Add the remaining screens + for i=#old_screens + 1, #geos do + local geo = geos[i] + screen.fake_add(geo.x, geo.y, geo.width, geo.height) + end check_tag_indexes() - - if keep then - for _, sf in ipairs(dispo) do - local geo = sf and sf() or nil - - -- If the function return nothing, assume the screen need to - -- be destroyed. - table.insert(geos, geo or false) - end - - -- Removed screens need to be explicit. - assert(#geos >= screen.count()) - - -- Keep a cache to avoid working with invalid data - local old_screens = {} - for s in screen do - table.insert(old_screens, s) - end - - for i, s in ipairs(old_screens) do - -- Remove the screen (if no new geometry is given - if not geos[i] then - s:fake_remove() - else - local cur_geo = s.geometry - for _, v in ipairs {"x", "y", "width", "height" } do - cur_geo[v] = geos[i][v] or cur_geo[v] - end - s:fake_resize( - cur_geo.x, - cur_geo.y, - cur_geo.width, - cur_geo.height - ) - end - end - - -- Add the remaining screens - for i=#old_screens + 1, #geos do - local geo = geos[i] - screen.fake_add(geo.x, geo.y, geo.width, geo.height) - end - - check_tag_indexes() - else - -- Move all existing screens out of the way (to avoid temporary overlapping) - for s in screen do - s:fake_resize(canvas_w, canvas_h, 1, 1) - table.insert(old, s) - end - - -- Add the new screens - for _, sf in ipairs(dispo) do - local geo = sf() - screen.fake_add(geo.x, geo.y, geo.width, geo.height) - table.insert(geos, geo) - end - - -- Remove old screens - for _, s in ipairs(old) do - s:fake_remove() - end + else + -- Move all existing screens out of the way (to avoid temporary overlapping) + for s in screen do + s:fake_resize(canvas_w, canvas_h, 1, 1) + table.insert(old, s) end - show_screens() - - -- Check the result is correct - local expected_count = 0 - for _,v in ipairs(geos) do - expected_count = expected_count + (v and 1 or 0) + -- Add the new screens + for _, sf in ipairs(dispo) do + local geo = sf() + screen.fake_add(geo.x, geo.y, geo.width, geo.height) + table.insert(geos, geo) end - assert(expected_count == screen.count()) - for k, geo in ipairs(geos) do - if geo then - local sgeo = screen[k].geometry - assert(geo.x == sgeo.x) - assert(geo.y == sgeo.y) - assert(geo.width == sgeo.width ) - assert(geo.height == sgeo.height) - end + -- Remove old screens + for _, s in ipairs(old) do + s:fake_remove() end + end - return true - end) + show_screens() + + -- Check the result is correct + local expected_count = 0 + for _,v in ipairs(geos) do + expected_count = expected_count + (v and 1 or 0) + end + + assert(expected_count == screen.count()) + for k, geo in ipairs(geos) do + if geo then + local sgeo = screen[k].geometry + assert(geo.x == sgeo.x) + assert(geo.y == sgeo.y) + assert(geo.width == sgeo.width ) + assert(geo.height == sgeo.height) + end + end + + return true + end) for _, step in ipairs(new_steps) do table.insert(real_steps, step) @@ -518,5 +518,5 @@ local function add_steps(real_steps, new_steps) end return setmetatable(module, { - __call = function(_,...) return add_steps(...) end -}) + __call = function(_,...) return add_steps(...) end + }) diff --git a/tests/_runner.lua b/tests/_runner.lua index 9023a2486..c446c04b4 100644 --- a/tests/_runner.lua +++ b/tests/_runner.lua @@ -2,7 +2,7 @@ local timer = require("gears.timer") local awful = require("awful") local runner = { - quit_awesome_on_error = os.getenv('TEST_PAUSE_ON_ERRORS') ~= '1', + quit_awesome_on_error = os.getenv('TEST_PAUSE_ON_ERRORS') ~= '1', } -- Helpers. @@ -10,8 +10,8 @@ local runner = { --- Add some rules to awful.rules.rules, after the defaults. local default_rules = awful.util.table.clone(awful.rules.rules) runner.add_to_default_rules = function(r) - awful.rules.rules = awful.util.table.clone(default_rules) - table.insert(awful.rules.rules, r) + awful.rules.rules = awful.util.table.clone(default_rules) + table.insert(awful.rules.rules, r) end -- Was the runner started already? @@ -30,72 +30,72 @@ timer.start_new(1, function() end) runner.run_steps = function(steps) - -- Setup timer/timeout to limit waiting for signal and quitting awesome. - -- This would be common for all tests. - local t = timer({timeout=0.1}) - local wait=20 - local step=1 - local step_count=0 - assert(not running, "run_steps() was called twice") - running = true - t:connect_signal("timeout", function() timer.delayed_call(function() - io.flush() -- for "tail -f". - step_count = step_count + 1 - local step_as_string = step..'/'..#steps..' (@'..step_count..')' + -- Setup timer/timeout to limit waiting for signal and quitting awesome. + -- This would be common for all tests. + local t = timer({timeout=0.1}) + local wait=20 + local step=1 + local step_count=0 + assert(not running, "run_steps() was called twice") + running = true + t:connect_signal("timeout", function() timer.delayed_call(function() + io.flush() -- for "tail -f". + step_count = step_count + 1 + local step_as_string = step..'/'..#steps..' (@'..step_count..')' - -- Call the current step's function. - local success, result = xpcall(function() - return steps[step](step_count) - end, debug.traceback) + -- Call the current step's function. + local success, result = xpcall(function() + return steps[step](step_count) + end, debug.traceback) - if not success then - io.stderr:write('Error: running function for step ' - ..step_as_string..': '..tostring(result)..'!\n') - t:stop() - if not runner.quit_awesome_on_error then - io.stderr:write("Keeping awesome open...\n") - return -- keep awesome open on error. - end + if not success then + io.stderr:write('Error: running function for step ' + ..step_as_string..': '..tostring(result)..'!\n') + t:stop() + if not runner.quit_awesome_on_error then + io.stderr:write("Keeping awesome open...\n") + return -- keep awesome open on error. + end - elseif result then - -- true: test succeeded. - if step < #steps then - -- Next step. - step = step+1 - step_count = 0 - wait = 5 - t:again() - return - end + elseif result then + -- true: test succeeded. + if step < #steps then + -- Next step. + step = step+1 + step_count = 0 + wait = 5 + t:again() + return + end - elseif result == false then - io.stderr:write("Step "..step_as_string.." failed (returned false).") - if not runner.quit_awesome_on_error then - io.stderr:write("Keeping awesome open...\n") - return - end + elseif result == false then + io.stderr:write("Step "..step_as_string.." failed (returned false).") + if not runner.quit_awesome_on_error then + io.stderr:write("Keeping awesome open...\n") + return + end - else - wait = wait-1 - if wait > 0 then - t:again() - else - io.stderr:write("Error: timeout waiting for signal in step " - ..step_as_string..".\n") - t:stop() - end - return - end - -- Remove any clients. - for _,c in ipairs(client.get()) do - c:kill() - end - if success and result then - io.stderr:write("Test finished successfully\n") - end - awesome.quit() - end) end) - t:start() + else + wait = wait-1 + if wait > 0 then + t:again() + else + io.stderr:write("Error: timeout waiting for signal in step " + ..step_as_string..".\n") + t:stop() + end + return + end + -- Remove any clients. + for _,c in ipairs(client.get()) do + c:kill() + end + if success and result then + io.stderr:write("Test finished successfully\n") + end + awesome.quit() + end) end) + t:start() end return runner diff --git a/tests/examples/awful/mouse/coords.lua b/tests/examples/awful/mouse/coords.lua index 4a40430ff..c6cf46fe2 100644 --- a/tests/examples/awful/mouse/coords.lua +++ b/tests/examples/awful/mouse/coords.lua @@ -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 diff --git a/tests/examples/awful/placement/align.lua b/tests/examples/awful/placement/align.lua index 7502ff74b..24570cee8 100644 --- a/tests/examples/awful/placement/align.lua +++ b/tests/examples/awful/placement/align.lua @@ -2,13 +2,13 @@ local placement = require("awful.placement") 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) + "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) end screen._add_screen {x = 70, y = 260 , width = 128, height = 96} diff --git a/tests/examples/awful/placement/bottom.lua b/tests/examples/awful/placement/bottom.lua index 6af09262b..cc56c10a8 100644 --- a/tests/examples/awful/placement/bottom.lua +++ b/tests/examples/awful/placement/bottom.lua @@ -12,5 +12,5 @@ local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE awful.placement.bottom(client.focus) assert(c.x == screen[1].geometry.width/2-40/2-c.border_width--DOC_HIDE - and c.y==screen[1].geometry.height-30-2*c.border_width--DOC_HIDE - and c.width==40 and c.height==30)--DOC_HIDE + and c.y==screen[1].geometry.height-30-2*c.border_width--DOC_HIDE + and c.width==40 and c.height==30)--DOC_HIDE diff --git a/tests/examples/awful/placement/bottom_left.lua b/tests/examples/awful/placement/bottom_left.lua index 4d4cff377..a06abe28b 100644 --- a/tests/examples/awful/placement/bottom_left.lua +++ b/tests/examples/awful/placement/bottom_left.lua @@ -12,8 +12,8 @@ local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE awful.placement.bottom_left(client.focus) assert( --DOC_HIDE - c.x == 0 --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 + c.x == 0 --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 diff --git a/tests/examples/awful/placement/closest_mouse.lua b/tests/examples/awful/placement/closest_mouse.lua index 6d6941c15..9c37ac296 100644 --- a/tests/examples/awful/placement/closest_mouse.lua +++ b/tests/examples/awful/placement/closest_mouse.lua @@ -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}} diff --git a/tests/examples/awful/placement/compose.lua b/tests/examples/awful/placement/compose.lua index f67107625..1e547e8c0 100644 --- a/tests/examples/awful/placement/compose.lua +++ b/tests/examples/awful/placement/compose.lua @@ -2,10 +2,10 @@ 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 - and c.width==40 and c.height==30)--DOC_HIDE + and c.width==40 and c.height==30)--DOC_HIDE diff --git a/tests/examples/awful/placement/compose2.lua b/tests/examples/awful/placement/compose2.lua index 88d0c998c..4a49f6634 100644 --- a/tests/examples/awful/placement/compose2.lua +++ b/tests/examples/awful/placement/compose2.lua @@ -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 diff --git a/tests/examples/awful/placement/left.lua b/tests/examples/awful/placement/left.lua index d3e4e6981..f16ba7b53 100644 --- a/tests/examples/awful/placement/left.lua +++ b/tests/examples/awful/placement/left.lua @@ -12,4 +12,4 @@ local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE awful.placement.left(client.focus) assert(c.x == 0 and c.y==screen[1].geometry.height/2-30/2-c.border_width--DOC_HIDE - and c.width==40 and c.height==30)--DOC_HIDE + and c.width==40 and c.height==30)--DOC_HIDE diff --git a/tests/examples/awful/placement/maximize.lua b/tests/examples/awful/placement/maximize.lua index 5a7bfe735..aecb52274 100644 --- a/tests/examples/awful/placement/maximize.lua +++ b/tests/examples/awful/placement/maximize.lua @@ -4,15 +4,15 @@ screen._add_screen {x = 280, y = 0, width = 128, height = 96} --DOC_HIDE 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 - x = screen[k].geometry.x+40, --DOC_HIDE - y = screen[k].geometry.y+40, width=75, height=50, screen=screen[k]} --DOC_HIDE + "", "vertical", "horizontal" --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 if k == 1 then --DOC_HIDE assert(c1.width+2*c1.border_width == screen[1].geometry.width and --DOC_HIDE - c1.height+2*c1.border_width == screen[1].geometry.height) --DOC_HIDE + c1.height+2*c1.border_width == screen[1].geometry.height) --DOC_HIDE end --DOC_HIDE end --DOC_HIDE diff --git a/tests/examples/awful/placement/resize_to_mouse.lua b/tests/examples/awful/placement/resize_to_mouse.lua index 63dfda59a..a7f1a1a29 100644 --- a/tests/examples/awful/placement/resize_to_mouse.lua +++ b/tests/examples/awful/placement/resize_to_mouse.lua @@ -8,8 +8,8 @@ local function test_touch_mouse(c) local coords = mouse.coords() return c:geometry().x == coords.x or c:geometry().y == coords.y - or c:geometry().x+c:geometry().width+2*c.border_width == coords.x - or c:geometry().y+c:geometry().height+2*c.border_width == coords.y + or c:geometry().x+c:geometry().width+2*c.border_width == coords.x + or c:geometry().y+c:geometry().height+2*c.border_width == coords.y end for s=1, 8 do diff --git a/tests/examples/awful/placement/stretch.lua b/tests/examples/awful/placement/stretch.lua index 3857bf8ef..fca27952d 100644 --- a/tests/examples/awful/placement/stretch.lua +++ b/tests/examples/awful/placement/stretch.lua @@ -6,11 +6,11 @@ screen._add_screen {x = 140, y = 110, width = 128, height = 96} local placement = require("awful.placement") for k, pos in ipairs{ - "up", "down", "left", "right" - } 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]} + "up", "down", "left", "right" +} 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]} placement.stretch(c1, {direction=pos}) end diff --git a/tests/examples/awful/placement/stretch_down.lua b/tests/examples/awful/placement/stretch_down.lua index 720da36d6..76a56f7db 100644 --- a/tests/examples/awful/placement/stretch_down.lua +++ b/tests/examples/awful/placement/stretch_down.lua @@ -15,4 +15,4 @@ assert(c.x==45) --DOC_HIDE assert(c.y==35) --DOC_HIDE assert(c.width == 40) --DOC_HIDE assert(c.y+c.height+2*c.border_width == --DOC_HIDE - screen[1].geometry.y + screen[1].geometry.height) --DOC_HIDE + screen[1].geometry.y + screen[1].geometry.height) --DOC_HIDE diff --git a/tests/examples/awful/placement/top_right.lua b/tests/examples/awful/placement/top_right.lua index ef6fc8338..2ef1634c7 100644 --- a/tests/examples/awful/placement/top_right.lua +++ b/tests/examples/awful/placement/top_right.lua @@ -12,4 +12,4 @@ local c = client.gen_fake {x = 45, y = 35, width=40, height=30} --DOC_HIDE awful.placement.top_right(client.focus) assert(c.x == screen[1].geometry.width-40-2*c.border_width and c.y==0 --DOC_HIDE - and c.width==40 and c.height==30)--DOC_HIDE + and c.width==40 and c.height==30)--DOC_HIDE diff --git a/tests/examples/gears/shape/infobubble.lua b/tests/examples/gears/shape/infobubble.lua index c78ed8e0f..5612eb64a 100644 --- a/tests/examples/gears/shape/infobubble.lua +++ b/tests/examples/gears/shape/infobubble.lua @@ -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 diff --git a/tests/examples/shims/client.lua b/tests/examples/shims/client.lua index d99411660..f5b61fad0 100644 --- a/tests/examples/shims/client.lua +++ b/tests/examples/shims/client.lua @@ -105,9 +105,9 @@ function client.gen_fake(args) assert(not args.screen or (args.screen == ret.screen)) return setmetatable(ret, { - __index = function(...) return meta.__index(...) end, - __newindex = function(...) return meta.__newindex(...) end - }) + __index = function(...) return meta.__index(...) end, + __newindex = function(...) return meta.__newindex(...) end + }) end function client.get(s) diff --git a/tests/examples/shims/drawin.lua b/tests/examples/shims/drawin.lua index 6003f975e..e96ebd6de 100644 --- a/tests/examples/shims/drawin.lua +++ b/tests/examples/shims/drawin.lua @@ -11,14 +11,14 @@ local function new_drawin(_, args) end return setmetatable(ret, { - __index = function(...) return meta.__index(...) end, - __newindex = function(...) return meta.__newindex(...) end - }) + __index = function(...) return meta.__index(...) end, + __newindex = function(...) return meta.__newindex(...) end + }) end return setmetatable(drawin, { - __call = new_drawin, -}) + __call = new_drawin, + }) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/shims/screen.lua b/tests/examples/shims/screen.lua index 09dc622c1..1e487e373 100644 --- a/tests/examples/shims/screen.lua +++ b/tests/examples/shims/screen.lua @@ -26,26 +26,26 @@ local function create_screen(args) local wa = args.workarea_sides or 10 return setmetatable(s,{ __index = function(_, key) - if key == "geometry" then - return { - x = geo.x or 0, - y = geo.y or 0, - width = geo.width , - height = geo.height, - } - elseif key == "workarea" then - return { - x = (geo.x or 0) + wa , - y = (geo.y or 0) + wa , - width = geo.width - 2*wa, - height = geo.height - 2*wa, - } - else - return meta.__index(_, key) - end - end, - __newindex = function(...) return meta.__newindex(...) end - }) + if key == "geometry" then + return { + x = geo.x or 0, + y = geo.y or 0, + width = geo.width , + height = geo.height, + } + elseif key == "workarea" then + return { + x = (geo.x or 0) + wa , + y = (geo.y or 0) + wa , + width = geo.width - 2*wa, + height = geo.height - 2*wa, + } + else + return meta.__index(_, key) + end + end, + __newindex = function(...) return meta.__newindex(...) end +}) end local screens = {} diff --git a/tests/examples/shims/tag.lua b/tests/examples/shims/tag.lua index aaac467ec..cb1b1f4ca 100644 --- a/tests/examples/shims/tag.lua +++ b/tests/examples/shims/tag.lua @@ -24,14 +24,14 @@ local function new_tag(_, args) table.insert(root._tags, ret) return setmetatable(ret, { - __index = function(...) return meta.__index(...) end, - __newindex = function(...) return meta.__newindex(...) end - }) + __index = function(...) return meta.__index(...) end, + __newindex = function(...) return meta.__newindex(...) end + }) end return setmetatable(tag, { - __call = new_tag, -}) + __call = new_tag, + }) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/text/gears/object/properties.lua b/tests/examples/text/gears/object/properties.lua index 5a4e9cd4e..97690967c 100644 --- a/tests/examples/text/gears/object/properties.lua +++ b/tests/examples/text/gears/object/properties.lua @@ -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) diff --git a/tests/examples/text/gears/object/signal.lua b/tests/examples/text/gears/object/signal.lua index ca83f1e16..2a67b3783 100644 --- a/tests/examples/text/gears/object/signal.lua +++ b/tests/examples/text/gears/object/signal.lua @@ -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" diff --git a/tests/examples/wibox/container/arcchart/bg.lua b/tests/examples/wibox/container/arcchart/bg.lua index 3288a5dd3..686c394ba 100644 --- a/tests/examples/wibox/container/arcchart/bg.lua +++ b/tests/examples/wibox/container/arcchart/bg.lua @@ -9,30 +9,30 @@ parent:add(l) for _, v in ipairs {"", "#00ff00", "#0000ff"} do l:add(wibox.widget { - { - text = v~="" and v or "nil", - align = "center", - valign = "center", - widget = wibox.widget.textbox, - }, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - values = { - 1, - 2, - 3, - }, - max_value = 10, - min_value = 0, - rounded_edge = false, - bg = v~="" and v or nil, - border_width = 0.5, - border_color = "#000000", - widget = wibox.container.arcchart - }) + { + text = v~="" and v or "nil", + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + values = { + 1, + 2, + 3, + }, + max_value = 10, + min_value = 0, + rounded_edge = false, + bg = v~="" and v or nil, + border_width = 0.5, + border_color = "#000000", + widget = wibox.container.arcchart + }) end return nil, 60 diff --git a/tests/examples/wibox/container/arcchart/border_width.lua b/tests/examples/wibox/container/arcchart/border_width.lua index e553b4874..c74a51195 100644 --- a/tests/examples/wibox/container/arcchart/border_width.lua +++ b/tests/examples/wibox/container/arcchart/border_width.lua @@ -11,38 +11,38 @@ parent:add(l) for _, v in ipairs {0,1,3,6.5} do l:add(wibox.widget { - { - { - { - text = v, - align = "center", - valign = "center", - widget = wibox.widget.textbox, - }, - bg= "#ff000044", - widget = wibox.container.background, - }, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - values = { - 1, - 2, - 3, - }, - max_value = 10, - min_value = 0, - rounded_edge = false, - bg = "#00ff0033", - border_width = v, - border_color = "#000000", - widget = wibox.container.arcchart - }, + { + { + { + text = v, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + bg= "#ff000044", + widget = wibox.container.background, + }, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + values = { + 1, + 2, + 3, + }, + max_value = 10, + min_value = 0, + rounded_edge = false, + bg = "#00ff0033", + border_width = v, + border_color = "#000000", + widget = wibox.container.arcchart + }, bg = cols[_], widget = wibox.container.background - }) + }) end return nil, 60 diff --git a/tests/examples/wibox/container/arcchart/paddings.lua b/tests/examples/wibox/container/arcchart/paddings.lua index 7b989d008..f427797ba 100644 --- a/tests/examples/wibox/container/arcchart/paddings.lua +++ b/tests/examples/wibox/container/arcchart/paddings.lua @@ -9,71 +9,71 @@ parent:add(l) for _, v in ipairs {0, 2, 4} do l:add(wibox.widget { - { - { - text = v, - align = "center", - valign = "center", - widget = wibox.widget.textbox, - }, - bg= beautiful.bg_normal, - widget = wibox.container.background, - }, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - values = { - 1, - 2, - 3, - }, - max_value = 10, - min_value = 0, - rounded_edge = false, - bg = "#ff000033", - border_width = 0.5, - border_color = "#000000", - paddings = v, - widget = wibox.container.arcchart - }) + { + { + text = v, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + bg= beautiful.bg_normal, + widget = wibox.container.background, + }, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + values = { + 1, + 2, + 3, + }, + max_value = 10, + min_value = 0, + rounded_edge = false, + bg = "#ff000033", + border_width = 0.5, + border_color = "#000000", + paddings = v, + widget = wibox.container.arcchart + }) end l:add(wibox.widget { - { - { - text = 6, - align = "center", - valign = "center", - widget = wibox.widget.textbox, - }, - bg= beautiful.bg_normal, - widget = wibox.container.background, - }, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - values = { - 1, - 2, - 3, - }, - max_value = 10, - min_value = 0, - rounded_edge = false, - bg = "#ff000033", - border_width = 0.5, - border_color = "#000000", - paddings = { - left = 6, - right = 6, - top = 6, - bottom = 6, - }, - widget = wibox.container.arcchart - }) + { + { + text = 6, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + bg= beautiful.bg_normal, + widget = wibox.container.background, + }, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + values = { + 1, + 2, + 3, + }, + max_value = 10, + min_value = 0, + rounded_edge = false, + bg = "#ff000033", + border_width = 0.5, + border_color = "#000000", + paddings = { + left = 6, + right = 6, + top = 6, + bottom = 6, + }, + widget = wibox.container.arcchart + }) return nil, 60 diff --git a/tests/examples/wibox/container/arcchart/rounded_edge.lua b/tests/examples/wibox/container/arcchart/rounded_edge.lua index 36eb68a93..fabeb0bc9 100644 --- a/tests/examples/wibox/container/arcchart/rounded_edge.lua +++ b/tests/examples/wibox/container/arcchart/rounded_edge.lua @@ -4,78 +4,78 @@ local wibox = require( "wibox" ) local beautiful = require( "beautiful" ) parent:add(wibox.widget { - { - { - markup = "rounded_edge = false", - widget = wibox.widget.textbox - }, - { - { - { - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - values = { - 1, - 2, - 3, - }, - max_value = 10, - min_value = 0, - rounded_edge = false, - bg = "#ff000033", - border_width = 0.5, - border_color = "#000000", - widget = wibox.container.arcchart - }, - margins = 2, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - layout = wibox.container.margin - }, - margins = 1, - color = beautiful.border_color, - layout = wibox.container.margin, - }, - layout = wibox.layout.fixed.vertical - }, - { - { - markup = "rounded_edge = true", - widget = wibox.widget.textbox - }, - { - { - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - values = { - 1, - 2, - 3, - }, - max_value = 10, - min_value = 0, - rounded_edge = true, - bg = "#ff000033", - border_width = 0.5, - border_color = "#000000", - widget = wibox.container.arcchart - }, - margins = 1, - color = beautiful.border_color, - layout = wibox.container.margin, - }, - layout = wibox.layout.fixed.vertical - }, - layout = wibox.layout.flex.horizontal -}) + { + { + markup = "rounded_edge = false", + widget = wibox.widget.textbox + }, + { + { + { + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + values = { + 1, + 2, + 3, + }, + max_value = 10, + min_value = 0, + rounded_edge = false, + bg = "#ff000033", + border_width = 0.5, + border_color = "#000000", + widget = wibox.container.arcchart + }, + margins = 2, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + layout = wibox.container.margin + }, + margins = 1, + color = beautiful.border_color, + layout = wibox.container.margin, + }, + layout = wibox.layout.fixed.vertical + }, + { + { + markup = "rounded_edge = true", + widget = wibox.widget.textbox + }, + { + { + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + values = { + 1, + 2, + 3, + }, + max_value = 10, + min_value = 0, + rounded_edge = true, + bg = "#ff000033", + border_width = 0.5, + border_color = "#000000", + widget = wibox.container.arcchart + }, + margins = 1, + color = beautiful.border_color, + layout = wibox.container.margin, + }, + layout = wibox.layout.fixed.vertical + }, + layout = wibox.layout.flex.horizontal + }) return 500, 60 diff --git a/tests/examples/wibox/container/arcchart/start_angle.lua b/tests/examples/wibox/container/arcchart/start_angle.lua index 244ec527a..baa8612ea 100644 --- a/tests/examples/wibox/container/arcchart/start_angle.lua +++ b/tests/examples/wibox/container/arcchart/start_angle.lua @@ -9,27 +9,27 @@ parent:add(l) for _, v in ipairs {0, math.pi/2, math.pi} do l:add(wibox.widget { - { - text = v, - align = "center", - valign = "center", - widget = wibox.widget.textbox, - }, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - value = 1, - max_value = 10, - min_value = 0, - rounded_edge = false, - bg = "#ff000033", - start_angle = v, - border_width = 0.5, - border_color = "#000000", - widget = wibox.container.arcchart - }) + { + text = v, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + value = 1, + max_value = 10, + min_value = 0, + rounded_edge = false, + bg = "#ff000033", + start_angle = v, + border_width = 0.5, + border_color = "#000000", + widget = wibox.container.arcchart + }) end return nil, 60 diff --git a/tests/examples/wibox/container/arcchart/thickness.lua b/tests/examples/wibox/container/arcchart/thickness.lua index 432e642f3..ab431de35 100644 --- a/tests/examples/wibox/container/arcchart/thickness.lua +++ b/tests/examples/wibox/container/arcchart/thickness.lua @@ -9,31 +9,31 @@ parent:add(l) for _, v in ipairs {1,3,7,10} do l:add(wibox.widget { - { - text = v, - align = "center", - valign = "center", - widget = wibox.widget.textbox, - }, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - values = { - 1, - 2, - 3, - }, - max_value = 10, - min_value = 0, - rounded_edge = false, - thickness = v, - bg = "#ff000033", - border_width = 0.5, - border_color = "#000000", - widget = wibox.container.arcchart - }) + { + text = v, + align = "center", + valign = "center", + widget = wibox.widget.textbox, + }, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + values = { + 1, + 2, + 3, + }, + max_value = 10, + min_value = 0, + rounded_edge = false, + thickness = v, + bg = "#ff000033", + border_width = 0.5, + border_color = "#000000", + widget = wibox.container.arcchart + }) end return nil, 60 diff --git a/tests/examples/wibox/container/arcchart/value.lua b/tests/examples/wibox/container/arcchart/value.lua index 256224fcd..048007976 100644 --- a/tests/examples/wibox/container/arcchart/value.lua +++ b/tests/examples/wibox/container/arcchart/value.lua @@ -9,20 +9,20 @@ parent:add(l) for _, v in ipairs {0,1,7,99} do l:add(wibox.widget { - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - value = v, - max_value = 10, - min_value = 0, - rounded_edge = false, - bg = "#ff000033", - border_width = 0.5, - border_color = "#000000", - widget = wibox.container.arcchart - }) + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + value = v, + max_value = 10, + min_value = 0, + rounded_edge = false, + bg = "#ff000033", + border_width = 0.5, + border_color = "#000000", + widget = wibox.container.arcchart + }) end return nil, 60 diff --git a/tests/examples/wibox/container/defaults/template.lua b/tests/examples/wibox/container/defaults/template.lua index 56d2ef8e6..e1fe7842c 100644 --- a/tests/examples/wibox/container/defaults/template.lua +++ b/tests/examples/wibox/container/defaults/template.lua @@ -35,9 +35,9 @@ local container = wibox.widget { shape_border_width = beautiful.border_width, widget = wibox.container.background, shape = shape.transform(shape.arrow) - : rotate_at(15,15,math.pi/2) - : translate(0,-8) - : scale(0.9, 0.9), + : rotate_at(15,15,math.pi/2) + : translate(0,-8) + : scale(0.9, 0.9), }, strategy = 'exact', width = 42, diff --git a/tests/examples/wibox/logo/logo.lua b/tests/examples/wibox/logo/logo.lua index 734ad2b89..2a0688cc6 100644 --- a/tests/examples/wibox/logo/logo.lua +++ b/tests/examples/wibox/logo/logo.lua @@ -4,12 +4,12 @@ local assets = require( "xresources.assets" ) --DOC_HIDE parent:add( --DOC_HIDE -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 -} + 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 diff --git a/tests/examples/wibox/logo/logo_and_name.lua b/tests/examples/wibox/logo/logo_and_name.lua index 126d7dbe4..fe1eb674a 100644 --- a/tests/examples/wibox/logo/logo_and_name.lua +++ b/tests/examples/wibox/logo/logo_and_name.lua @@ -4,14 +4,14 @@ local assets = require( "xresources.assets" ) --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget { - fit = function() return 148, 128 end, - draw = function(_, _, cr) - assets.gen_logo(cr, 128, 128, nil, "#535d6c") - cr:translate(128 + 128/16, 0) - assets.gen_awesome_name(cr, 158, nil, "#535d6c", nil) - end, - widget = wibox.widget.base.make_widget -} + wibox.widget { + fit = function() return 148, 128 end, + draw = function(_, _, cr) + assets.gen_logo(cr, 128, 128, nil, "#535d6c") + cr:translate(128 + 128/16, 0) + assets.gen_awesome_name(cr, 158, nil, "#535d6c", nil) + end, + widget = wibox.widget.base.make_widget + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/checkbox/bg.lua b/tests/examples/wibox/widget/checkbox/bg.lua index 059c376d0..8410223db 100644 --- a/tests/examples/wibox/widget/checkbox/bg.lua +++ b/tests/examples/wibox/widget/checkbox/bg.lua @@ -3,18 +3,18 @@ local wibox = require( "wibox" ) --DOC_HIDE local beautiful = require( "beautiful" ) --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget { - checked = true, - color = beautiful.bg_normal, - bg = "#ff00ff", - border_width = 3, - paddings = 4, - border_color = "#0000ff", - check_color = "#ff0000", - forced_width = 20, --DOC_HIDE - forced_height = 20, --DOC_HIDE - check_border_color = "#ffff00", - check_border_width = 1, - widget = wibox.widget.checkbox -} -) --DOC_HIDE + wibox.widget { + checked = true, + color = beautiful.bg_normal, + bg = "#ff00ff", + border_width = 3, + paddings = 4, + border_color = "#0000ff", + check_color = "#ff0000", + forced_width = 20, --DOC_HIDE + forced_height = 20, --DOC_HIDE + check_border_color = "#ffff00", + check_border_width = 1, + widget = wibox.widget.checkbox + } + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/checkbox/check_shape.lua b/tests/examples/wibox/widget/checkbox/check_shape.lua index 8c953e890..a0be1267a 100644 --- a/tests/examples/wibox/widget/checkbox/check_shape.lua +++ b/tests/examples/wibox/widget/checkbox/check_shape.lua @@ -10,17 +10,17 @@ local l = wibox.widget { --DOC_HIDE for _, s in ipairs {"rectangle", "circle", "losange", "octogon"} do -l:add( --DOC_HIDE - wibox.widget { - checked = true, - color = beautiful.bg_normal, - paddings = 2, - forced_width = 20, --DOC_HIDE - forced_height = 20, --DOC_HIDE - check_shape = gears.shape[s], - widget = wibox.widget.checkbox - } -) --DOC_HIDE + l:add( --DOC_HIDE + wibox.widget { + checked = true, + color = beautiful.bg_normal, + paddings = 2, + forced_width = 20, --DOC_HIDE + forced_height = 20, --DOC_HIDE + check_shape = gears.shape[s], + widget = wibox.widget.checkbox + } + ) --DOC_HIDE end diff --git a/tests/examples/wibox/widget/checkbox/custom.lua b/tests/examples/wibox/widget/checkbox/custom.lua index f88fd8df4..4f0531af9 100644 --- a/tests/examples/wibox/widget/checkbox/custom.lua +++ b/tests/examples/wibox/widget/checkbox/custom.lua @@ -3,31 +3,31 @@ local wibox = require( "wibox" ) --DOC_HIDE local beautiful = require( "beautiful" ) --DOC_HIDE parent:add( --DOC_HIDE - wibox.widget { - checked = true, - color = beautiful.bg_normal, - paddings = 2, - forced_width = 20, --DOC_HIDE - forced_height = 20, --DOC_HIDE - check_shape = function(cr, width, height) - local rs = math.min(width, height) + wibox.widget { + checked = true, + color = beautiful.bg_normal, + paddings = 2, + forced_width = 20, --DOC_HIDE + forced_height = 20, --DOC_HIDE + check_shape = function(cr, width, height) + local rs = math.min(width, height) - cr:move_to( 0 , 0 ) - cr:line_to( rs , 0 ) - cr:move_to( 0 , 0 ) - cr:line_to( 0 , rs ) - cr:move_to( 0 , rs ) - cr:line_to( rs , rs ) - cr:move_to( rs , 0 ) - cr:line_to( rs , rs ) - cr:move_to( 0 , 0 ) - cr:line_to( rs , rs ) - cr:move_to( 0 , rs ) - cr:line_to( rs , 0 ) - end, - check_border_color = "#ff0000", - check_color = "#00000000", - check_border_width = 1, - widget = wibox.widget.checkbox - } -) --DOC_HIDE + cr:move_to( 0 , 0 ) + cr:line_to( rs , 0 ) + cr:move_to( 0 , 0 ) + cr:line_to( 0 , rs ) + cr:move_to( 0 , rs ) + cr:line_to( rs , rs ) + cr:move_to( rs , 0 ) + cr:line_to( rs , rs ) + cr:move_to( 0 , 0 ) + cr:line_to( rs , rs ) + cr:move_to( 0 , rs ) + cr:line_to( rs , 0 ) + end, + check_border_color = "#ff0000", + check_color = "#00000000", + check_border_width = 1, + widget = wibox.widget.checkbox + } + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/checkbox/shape.lua b/tests/examples/wibox/widget/checkbox/shape.lua index 680f474b1..096549882 100644 --- a/tests/examples/wibox/widget/checkbox/shape.lua +++ b/tests/examples/wibox/widget/checkbox/shape.lua @@ -10,17 +10,17 @@ local l = wibox.widget { --DOC_HIDE for _, s in ipairs {"rectangle", "circle", "losange", "octogon"} do -l:add( --DOC_HIDE - wibox.widget { - checked = true, - color = beautiful.bg_normal, - paddings = 2, - forced_width = 20, --DOC_HIDE - forced_height = 20, --DOC_HIDE - shape = gears.shape[s], - widget = wibox.widget.checkbox - } -) --DOC_HIDE + l:add( --DOC_HIDE + wibox.widget { + checked = true, + color = beautiful.bg_normal, + paddings = 2, + forced_width = 20, --DOC_HIDE + forced_height = 20, --DOC_HIDE + shape = gears.shape[s], + widget = wibox.widget.checkbox + } + ) --DOC_HIDE end diff --git a/tests/examples/wibox/widget/defaults/checkbox.lua b/tests/examples/wibox/widget/defaults/checkbox.lua index 981aa4e03..c18e641b8 100644 --- a/tests/examples/wibox/widget/defaults/checkbox.lua +++ b/tests/examples/wibox/widget/defaults/checkbox.lua @@ -4,28 +4,28 @@ local beautiful = require( "beautiful" ) --DOC_HIDE local gears = {shape = require("gears.shape")} --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget { --DOC_HIDE -wibox.widget { - checked = true, - color = beautiful.bg_normal, - paddings = 2, - forced_width = 20, --DOC_HIDE - forced_height = 20, --DOC_HIDE - shape = gears.shape.circle, - widget = wibox.widget.checkbox -} -, --DOC_HIDE -wibox.widget { --DOC_HIDE - checked = false, --DOC_HIDE - color = beautiful.bg_normal, --DOC_HIDE - paddings = 2, --DOC_HIDE - forced_width = 20, --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 + wibox.widget { --DOC_HIDE + wibox.widget { + checked = true, + color = beautiful.bg_normal, + paddings = 2, + forced_width = 20, --DOC_HIDE + forced_height = 20, --DOC_HIDE + shape = gears.shape.circle, + widget = wibox.widget.checkbox + } + , --DOC_HIDE + wibox.widget { --DOC_HIDE + checked = false, --DOC_HIDE + color = beautiful.bg_normal, --DOC_HIDE + paddings = 2, --DOC_HIDE + forced_width = 20, --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 + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/defaults/imagebox.lua b/tests/examples/wibox/widget/defaults/imagebox.lua index 9e995225d..13d5ef041 100644 --- a/tests/examples/wibox/widget/defaults/imagebox.lua +++ b/tests/examples/wibox/widget/defaults/imagebox.lua @@ -4,10 +4,10 @@ local beautiful = require( "beautiful" ) --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget { - image = beautiful.awesome_icon, - resize = false, - widget = wibox.widget.imagebox -} + wibox.widget { + image = beautiful.awesome_icon, + resize = false, + widget = wibox.widget.imagebox + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/defaults/piechart.lua b/tests/examples/wibox/widget/defaults/piechart.lua index 408224a1e..293b1ded6 100644 --- a/tests/examples/wibox/widget/defaults/piechart.lua +++ b/tests/examples/wibox/widget/defaults/piechart.lua @@ -4,21 +4,21 @@ local beautiful = require( "beautiful" ) --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget { - data_list = { - { 'L1', 100 }, - { 'L2', 200 }, - { 'L3', 300 }, - }, - border_width = 1, - forced_height = 50, --DOC_HIDE - forced_width = 100, --DOC_HIDE - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - widget = wibox.widget.piechart -} + wibox.widget { + data_list = { + { 'L1', 100 }, + { 'L2', 200 }, + { 'L3', 300 }, + }, + border_width = 1, + forced_height = 50, --DOC_HIDE + forced_width = 100, --DOC_HIDE + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/defaults/progressbar.lua b/tests/examples/wibox/widget/defaults/progressbar.lua index f833edc8e..0f90b62cb 100644 --- a/tests/examples/wibox/widget/defaults/progressbar.lua +++ b/tests/examples/wibox/widget/defaults/progressbar.lua @@ -5,15 +5,15 @@ local beautiful = require("beautiful") --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget { - max_value = 1, - value = 0.33, - forced_height = 20, - forced_width = 100, - shape = gears.shape.rounded_bar, - border_width = 2, - border_color = beautiful.border_color, - widget = wibox.widget.progressbar, -} + wibox.widget { + max_value = 1, + value = 0.33, + forced_height = 20, + forced_width = 100, + shape = gears.shape.rounded_bar, + border_width = 2, + border_color = beautiful.border_color, + widget = wibox.widget.progressbar, + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/defaults/slider.lua b/tests/examples/wibox/widget/defaults/slider.lua index 9fd266dc3..2dfc1e08f 100644 --- a/tests/examples/wibox/widget/defaults/slider.lua +++ b/tests/examples/wibox/widget/defaults/slider.lua @@ -5,18 +5,18 @@ 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 -} + 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 + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/defaults/textbox.lua b/tests/examples/wibox/widget/defaults/textbox.lua index 7de6f9d02..3997a99ff 100644 --- a/tests/examples/wibox/widget/defaults/textbox.lua +++ b/tests/examples/wibox/widget/defaults/textbox.lua @@ -3,11 +3,11 @@ local wibox = require("wibox") --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget{ - markup = "This is a textbox!!!", - align = "center", - valign = "center", - widget = wibox.widget.textbox -} + wibox.widget{ + markup = "This is a textbox!!!", + align = "center", + valign = "center", + widget = wibox.widget.textbox + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/piechart/border_color.lua b/tests/examples/wibox/widget/piechart/border_color.lua index cf4022fab..43b1b10b6 100644 --- a/tests/examples/wibox/widget/piechart/border_color.lua +++ b/tests/examples/wibox/widget/piechart/border_color.lua @@ -8,20 +8,20 @@ parent:add(l) for _, v in ipairs {"#ff0000", "#00ff00", "#0000ff"} do l:add(wibox.widget { - data_list = { - { 'L1', 100 }, - { 'L2', 200 }, - { 'L3', 300 }, - }, - border_width = 1, - border_color = v, - forced_height = 50, - forced_width = 100, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - widget = wibox.widget.piechart - }) + data_list = { + { 'L1', 100 }, + { 'L2', 200 }, + { 'L3', 300 }, + }, + border_width = 1, + border_color = v, + forced_height = 50, + forced_width = 100, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }) end diff --git a/tests/examples/wibox/widget/piechart/border_width.lua b/tests/examples/wibox/widget/piechart/border_width.lua index b876c5953..a8c4430b9 100644 --- a/tests/examples/wibox/widget/piechart/border_width.lua +++ b/tests/examples/wibox/widget/piechart/border_width.lua @@ -8,19 +8,19 @@ parent:add(l) for _, v in ipairs {0,1,3,5} do l:add(wibox.widget { - data_list = { - { 'L1', 100 }, - { 'L2', 200 }, - { 'L3', 300 }, - }, - border_width = v, - forced_height = 50, - forced_width = 100, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - widget = wibox.widget.piechart - }) + data_list = { + { 'L1', 100 }, + { 'L2', 200 }, + { 'L3', 300 }, + }, + border_width = v, + forced_height = 50, + forced_width = 100, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }) end diff --git a/tests/examples/wibox/widget/piechart/label.lua b/tests/examples/wibox/widget/piechart/label.lua index d96d87c37..b9852807e 100644 --- a/tests/examples/wibox/widget/piechart/label.lua +++ b/tests/examples/wibox/widget/piechart/label.lua @@ -4,65 +4,65 @@ local wibox = require( "wibox" ) local beautiful = require( "beautiful" ) parent:add(wibox.widget { - { - { - markup = "display_labels = false", - widget = wibox.widget.textbox - }, - { - { - data_list = { - { 'L1', 100 }, - { 'L2', 200 }, - { 'L3', 300 }, - }, - border_width = 1, - forced_height = 50, - forced_width = 100, - display_labels = false, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - widget = wibox.widget.piechart - }, - margins = 1, - color = beautiful.border_color, - layout = wibox.container.margin, - }, - layout = wibox.layout.fixed.vertical - }, - { - { - markup = "display_labels = true", - widget = wibox.widget.textbox - }, - { - { - data_list = { - { 'L1', 100 }, - { 'L2', 200 }, - { 'L3', 300 }, - }, - border_width = 1, - forced_height = 50, - forced_width = 100, - display_labels = true, - colors = { - beautiful.bg_normal, - beautiful.bg_highlight, - beautiful.border_color, - }, - widget = wibox.widget.piechart - }, - margins = 1, - color = beautiful.border_color, - layout = wibox.container.margin, - }, - layout = wibox.layout.fixed.vertical - }, - layout = wibox.layout.flex.horizontal -}) + { + { + markup = "display_labels = false", + widget = wibox.widget.textbox + }, + { + { + data_list = { + { 'L1', 100 }, + { 'L2', 200 }, + { 'L3', 300 }, + }, + border_width = 1, + forced_height = 50, + forced_width = 100, + display_labels = false, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }, + margins = 1, + color = beautiful.border_color, + layout = wibox.container.margin, + }, + layout = wibox.layout.fixed.vertical + }, + { + { + markup = "display_labels = true", + widget = wibox.widget.textbox + }, + { + { + data_list = { + { 'L1', 100 }, + { 'L2', 200 }, + { 'L3', 300 }, + }, + border_width = 1, + forced_height = 50, + forced_width = 100, + display_labels = true, + colors = { + beautiful.bg_normal, + beautiful.bg_highlight, + beautiful.border_color, + }, + widget = wibox.widget.piechart + }, + margins = 1, + color = beautiful.border_color, + layout = wibox.container.margin, + }, + layout = wibox.layout.fixed.vertical + }, + layout = wibox.layout.flex.horizontal + }) return 500, 60 diff --git a/tests/examples/wibox/widget/progressbar/bar_shape.lua b/tests/examples/wibox/widget/progressbar/bar_shape.lua index 8b6ba991d..47d5717cd 100644 --- a/tests/examples/wibox/widget/progressbar/bar_shape.lua +++ b/tests/examples/wibox/widget/progressbar/bar_shape.lua @@ -12,16 +12,16 @@ local l = wibox.layout { --DOC_HIDE for _, shape in ipairs {"rounded_bar", "octogon", "hexagon", "powerline" } do l:add(wibox.widget { - value = 0.33, - bar_shape = gears.shape[shape], - bar_border_color = beautiful.border_color, - bar_border_width = 1, - border_width = 2, - border_color = beautiful.border_color, - margins = 5, --DOC_HIDE - paddings = 1, - widget = wibox.widget.progressbar, - }) + value = 0.33, + bar_shape = gears.shape[shape], + bar_border_color = beautiful.border_color, + bar_border_width = 1, + border_width = 2, + border_color = beautiful.border_color, + margins = 5, --DOC_HIDE + paddings = 1, + widget = wibox.widget.progressbar, + }) end parent:add(l) --DOC_HIDE diff --git a/tests/examples/wibox/widget/progressbar/clip.lua b/tests/examples/wibox/widget/progressbar/clip.lua index 08f48466a..695d87f9c 100644 --- a/tests/examples/wibox/widget/progressbar/clip.lua +++ b/tests/examples/wibox/widget/progressbar/clip.lua @@ -5,23 +5,23 @@ local beautiful = require("beautiful") --DOC_HIDE parent:add( --DOC_HIDE -wibox.widget { - value = 75, - max_value = 100, - border_width = 2, - border_color = beautiful.border_color, - color = beautiful.border_color, - shape = gears.shape.rounded_bar, - bar_shape = gears.shape.rounded_bar, - clip = false, - forced_height = 30, - forced_width = 100, - paddings = 5, - margins = { - top = 12, - bottom = 12, - }, - widget = wibox.widget.progressbar, -} + wibox.widget { + value = 75, + max_value = 100, + border_width = 2, + border_color = beautiful.border_color, + color = beautiful.border_color, + shape = gears.shape.rounded_bar, + bar_shape = gears.shape.rounded_bar, + clip = false, + forced_height = 30, + forced_width = 100, + paddings = 5, + margins = { + top = 12, + bottom = 12, + }, + widget = wibox.widget.progressbar, + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/progressbar/shape.lua b/tests/examples/wibox/widget/progressbar/shape.lua index 596034297..d53c950a6 100644 --- a/tests/examples/wibox/widget/progressbar/shape.lua +++ b/tests/examples/wibox/widget/progressbar/shape.lua @@ -12,13 +12,13 @@ local l = wibox.layout { --DOC_HIDE for _, shape in ipairs {"rounded_bar", "octogon", "hexagon", "powerline" } do l:add(wibox.widget { - value = 0.33, - shape = gears.shape[shape], - border_width = 2, - border_color = beautiful.border_color, - margins = 5, --DOC_HIDE - widget = wibox.widget.progressbar, - }) + value = 0.33, + shape = gears.shape[shape], + border_width = 2, + border_color = beautiful.border_color, + margins = 5, --DOC_HIDE + widget = wibox.widget.progressbar, + }) end parent:add(l) --DOC_HIDE diff --git a/tests/examples/wibox/widget/progressbar/text.lua b/tests/examples/wibox/widget/progressbar/text.lua index f502939e5..d854a4b1d 100644 --- a/tests/examples/wibox/widget/progressbar/text.lua +++ b/tests/examples/wibox/widget/progressbar/text.lua @@ -4,22 +4,22 @@ local beautiful = require("beautiful") --DOC_HIDE parent:add( --DOC_HIDE - wibox.widget { - { - max_value = 1, - value = 0.5, - forced_height = 20, - forced_width = 100, - paddings = 1, - border_width = 1, - border_color = beautiful.border_color, - widget = wibox.widget.progressbar, - }, - { - text = "50%", - widget = wibox.widget.textbox, - }, - layout = wibox.layout.stack - } + wibox.widget { + { + max_value = 1, + value = 0.5, + forced_height = 20, + forced_width = 100, + paddings = 1, + border_width = 1, + border_color = beautiful.border_color, + widget = wibox.widget.progressbar, + }, + { + text = "50%", + widget = wibox.widget.textbox, + }, + layout = wibox.layout.stack + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/progressbar/vertical.lua b/tests/examples/wibox/widget/progressbar/vertical.lua index eb0d060fb..ae1844194 100644 --- a/tests/examples/wibox/widget/progressbar/vertical.lua +++ b/tests/examples/wibox/widget/progressbar/vertical.lua @@ -3,16 +3,16 @@ local wibox = require("wibox") --DOC_HIDE parent:add( --DOC_HIDE - wibox.widget { - { - max_value = 1, - value = 0.33, - widget = wibox.widget.progressbar, - }, - forced_height = 100, - forced_width = 20, - direction = "east", - layout = wibox.container.rotate, - } + wibox.widget { + { + max_value = 1, + value = 0.33, + widget = wibox.widget.progressbar, + }, + forced_height = 100, + forced_width = 20, + direction = "east", + layout = wibox.container.rotate, + } -) --DOC_HIDE + ) --DOC_HIDE diff --git a/tests/examples/wibox/widget/slider/bar_margins.lua b/tests/examples/wibox/widget/slider/bar_margins.lua index 68428e7c5..d03f69101 100644 --- a/tests/examples/wibox/widget/slider/bar_margins.lua +++ b/tests/examples/wibox/widget/slider/bar_margins.lua @@ -17,11 +17,11 @@ end local l = wibox.layout { gen(0), gen(3), gen(6), gen({ - top = 12, - bottom = 12, - left = 12, - right = 12, - }), + top = 12, + bottom = 12, + left = 12, + right = 12, + }), forced_height = 30, forced_width = 400, spacing = 5, diff --git a/tests/examples/wibox/widget/slider/handle_margins.lua b/tests/examples/wibox/widget/slider/handle_margins.lua index 4da171bba..69be2289d 100644 --- a/tests/examples/wibox/widget/slider/handle_margins.lua +++ b/tests/examples/wibox/widget/slider/handle_margins.lua @@ -17,11 +17,11 @@ end local l = wibox.layout { gen(0), gen(3), gen(6), gen({ - top = 12, - bottom = 12, - left = 12, - right = 12, - }), + top = 12, + bottom = 12, + left = 12, + right = 12, + }), forced_height = 30, forced_width = 400, spacing = 5, diff --git a/tests/test-awesomerc.lua b/tests/test-awesomerc.lua index 445d1c09a..9e88f9556 100644 --- a/tests/test-awesomerc.lua +++ b/tests/test-awesomerc.lua @@ -26,203 +26,203 @@ end local steps = { -function(count) - if count <= 5 then - awful.spawn("xterm") - elseif #client.get() >= 5 then - local c, _ = get_c_and_t() - old_c = c + function(count) + if count <= 5 then + awful.spawn("xterm") + elseif #client.get() >= 5 then + local c, _ = get_c_and_t() + old_c = c + + return true + end + end, + + -- Wait for the focus to change + function() + assert(old_c) + + -- Test layout + -- local cb = get_callback({modkey}, " ") + -- assert(cb) + + --TODO use the key once the bug is fixed + local l = old_c.screen.selected_tag.layout + assert(l) + + -- cb() + awful.layout.inc(1) + + assert(old_c.screen.selected_tag.layout ~= l) + + -- Test ontop + + assert(not old_c.ontop) + get_callback({modkey}, "t")() + + return true + end, + + -- Ok, no now ontop should be true + function() + local _, t = get_c_and_t() + + -- Give awesome some time + if not old_c.ontop then return nil end + + assert(old_c.ontop) + + -- Now, test the master_width_factor + assert(t.master_width_factor == 0.5) + + get_callback({modkey}, "l")() + + return true + end, + + -- The master width factor should now be bigger + function() + local _, t = get_c_and_t() + + assert(t.master_width_factor == 0.55) + + -- Now, test the master_count + assert(t.master_count == 1) + + get_callback({modkey, "Shift"}, "h")() + + return true + end, + + -- The number of master client should now be 2 + function() + local _, t = get_c_and_t() + + assert(t.master_count == 2) + + -- Now, test the column_count + assert(t.column_count == 1) + + get_callback({modkey, "Control"}, "h")() + get_callback({modkey, "Shift" }, "l")() + + return true + end, + + -- The number of columns should now be 2 + function() + local _, t = get_c_and_t() + + assert(t.column_count == 2) + + -- Now, test the switching tag + assert(t.index == 1) + + get_callback({modkey, }, "Right")() + + return true + end, + + -- The tag index should now be 2 + function() + local tags = mouse.screen.tags + -- local t = awful.screen.focused().selected_tag + + -- assert(t.index == 2)--FIXME + + assert(tags[1].index == 1) + tags[1]:view_only() + + return true + end, + + -- Before testing tags, lets make sure everything is still right + function() + local tags = mouse.screen.tags + + assert(tags[1].selected) + + local clients = mouse.screen.clients + + -- Make sure the clients are all on the same screen, they should be + local c_scr = client.get()[1].screen + + for _, c in ipairs(client.get()) do + assert(c_scr == c.screen) + end + + -- Then this should be true + assert(#clients == #client.get()) + + assert(#mouse.screen.all_clients == #clients) + + assert(#mouse.screen.all_clients - #mouse.screen.hidden_clients == #clients) + + return true + end, + + -- Now, test switching tags + function() + local tags = mouse.screen.tags + local clients = mouse.screen.all_clients + + assert(#tags == 9) + + assert(#clients == 5) + + assert(mouse.screen.selected_tag == tags[1]) + + for i=1, 9 do + -- Check that assertion, because if it's false, the other assert() + -- wont make any sense. + assert(tags[i].index == i) + end + + for i=1, 9 do + tags[i]:view_only() + assert(tags[i].selected) + assert(#mouse.screen.selected_tags == 1) + end + + tags[1]:view_only() + + return true + end, + + -- Lets shift some clients around + function() + local tags = mouse.screen.tags + + -- Given all tags have been selected, the selection should be back on + -- tags[1] and the client history should be kept + assert(client.focus == old_c) + + --get_callback({modkey, "Shift" }, "#"..(9+i))() --FIXME + client.focus:move_to_tag(tags[2]) + + assert(not client.focus) + + return true + end, + + -- The client should be on tag 5 + function() + -- Confirm the move did happen + local tags = mouse.screen.tags + assert(tags[1].selected) + assert(#old_c:tags() == 1) + assert(old_c:tags()[1] ~= tags[1]) + assert(not old_c:tags()[1].selected) + + -- The focus should have changed by now, as the tag isn't visible + assert(client.focus ~= old_c) + + assert(old_c:tags()[1] == tags[2]) + + assert(#tags[2]:clients() == 1) + assert(#tags[1]:clients() == 4) return true end -end, - --- Wait for the focus to change -function() - assert(old_c) - - -- Test layout - -- local cb = get_callback({modkey}, " ") - -- assert(cb) - - --TODO use the key once the bug is fixed - local l = old_c.screen.selected_tag.layout - assert(l) - - -- cb() - awful.layout.inc(1) - - assert(old_c.screen.selected_tag.layout ~= l) - - -- Test ontop - - assert(not old_c.ontop) - get_callback({modkey}, "t")() - - return true -end, - --- Ok, no now ontop should be true -function() - local _, t = get_c_and_t() - - -- Give awesome some time - if not old_c.ontop then return nil end - - assert(old_c.ontop) - - -- Now, test the master_width_factor - assert(t.master_width_factor == 0.5) - - get_callback({modkey}, "l")() - - return true -end, - --- The master width factor should now be bigger -function() - local _, t = get_c_and_t() - - assert(t.master_width_factor == 0.55) - - -- Now, test the master_count - assert(t.master_count == 1) - - get_callback({modkey, "Shift"}, "h")() - - return true -end, - --- The number of master client should now be 2 -function() - local _, t = get_c_and_t() - - assert(t.master_count == 2) - - -- Now, test the column_count - assert(t.column_count == 1) - - get_callback({modkey, "Control"}, "h")() - get_callback({modkey, "Shift" }, "l")() - - return true -end, - --- The number of columns should now be 2 -function() - local _, t = get_c_and_t() - - assert(t.column_count == 2) - - -- Now, test the switching tag - assert(t.index == 1) - - get_callback({modkey, }, "Right")() - - return true -end, - --- The tag index should now be 2 -function() - local tags = mouse.screen.tags --- local t = awful.screen.focused().selected_tag - --- assert(t.index == 2)--FIXME - - assert(tags[1].index == 1) - tags[1]:view_only() - - return true -end, - --- Before testing tags, lets make sure everything is still right -function() - local tags = mouse.screen.tags - - assert(tags[1].selected) - - local clients = mouse.screen.clients - - -- Make sure the clients are all on the same screen, they should be - local c_scr = client.get()[1].screen - - for _, c in ipairs(client.get()) do - assert(c_scr == c.screen) - end - - -- Then this should be true - assert(#clients == #client.get()) - - assert(#mouse.screen.all_clients == #clients) - - assert(#mouse.screen.all_clients - #mouse.screen.hidden_clients == #clients) - - return true -end, - --- Now, test switching tags -function() - local tags = mouse.screen.tags - local clients = mouse.screen.all_clients - - assert(#tags == 9) - - assert(#clients == 5) - - assert(mouse.screen.selected_tag == tags[1]) - - for i=1, 9 do - -- Check that assertion, because if it's false, the other assert() - -- wont make any sense. - assert(tags[i].index == i) - end - - for i=1, 9 do - tags[i]:view_only() - assert(tags[i].selected) - assert(#mouse.screen.selected_tags == 1) - end - - tags[1]:view_only() - - return true -end, - --- Lets shift some clients around -function() - local tags = mouse.screen.tags - - -- Given all tags have been selected, the selection should be back on - -- tags[1] and the client history should be kept - assert(client.focus == old_c) - - --get_callback({modkey, "Shift" }, "#"..(9+i))() --FIXME - client.focus:move_to_tag(tags[2]) - - assert(not client.focus) - - return true -end, - --- The client should be on tag 5 -function() - -- Confirm the move did happen - local tags = mouse.screen.tags - assert(tags[1].selected) - assert(#old_c:tags() == 1) - assert(old_c:tags()[1] ~= tags[1]) - assert(not old_c:tags()[1].selected) - - -- The focus should have changed by now, as the tag isn't visible - assert(client.focus ~= old_c) - - assert(old_c:tags()[1] == tags[2]) - - assert(#tags[2]:clients() == 1) - assert(#tags[1]:clients() == 4) - - return true -end } require("_runner").run_steps(steps) diff --git a/tests/test-awful-client.lua b/tests/test-awful-client.lua index 6bd9e681a..86ba04330 100644 --- a/tests/test-awful-client.lua +++ b/tests/test-awful-client.lua @@ -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 - awful.spawn("xterm") - awful.spawn("xterm") - has_spawned = true -elseif #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 --- 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 - assert(v == 100) -end -awful.client.moveresize(-25, -25, -25, -25, c ) -for _,v in pairs(c:geometry()) do - assert(v == 75) -end + -- 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 + assert(v == 75) + 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 @@ -154,8 +154,8 @@ table.insert(multi_screen_steps, function() for i=1, screen.count() do local s = screen[i] test_client("screen"..i, nil, { - screen = s, - }) + screen = s, + }) end return true @@ -218,92 +218,92 @@ table.insert(multi_screen_steps, function() for i=1, screen.count() do local s = screen[i] test_client("screen"..i, nil, { - new_tag = { - name = "NEW_AT_"..i, - screen = s, - } + new_tag = { + name = "NEW_AT_"..i, + screen = s, + } + }) + end + + return true +end) + +table.insert(multi_screen_steps, function() +if #client.get() ~= screen.count() then return end + +for _, c in ipairs(client.get()) do + assert(#c:tags() == 1) + assert(c.first_tag.name == "NEW_AT_"..c.screen.index) +end + +-- Kill the client +for _, c in ipairs(client.get()) do + c:kill() +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, { + tag = screen[2].tags[2], + screen = screen[1], }) - end - return true -end) +-- 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], + }) -table.insert(multi_screen_steps, function() - if #client.get() ~= screen.count() then return end +-- Identical, but using the tag names +test_client("test_tags2", nil, { + tags = { "3", "4" }, + screen = screen[2], + }) - for _, c in ipairs(client.get()) do - assert(#c:tags() == 1) - assert(c.first_tag.name == "NEW_AT_"..c.screen.index) - end +-- 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], + }) - -- Kill the client - for _, c in ipairs(client.get()) do - c:kill() - end +-- Another test for tags, but with no matching names +test_client("test_tags4", nil, { + tags = { "foobar", "bobcat" }, + screen = screen[1], + }) - 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, { - 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, { - tags = { screen[1].tags[3], screen[1].tags[4] }, - screen = screen[2], - }) - - -- 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, { - 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, { - 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 - c_by_class[c.class] = c - end +for _, c in ipairs(client.get()) do + c_by_class[c.class] = c +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) diff --git a/tests/test-awful-layout.lua b/tests/test-awful-layout.lua index cac28935b..56713f119 100644 --- a/tests/test-awful-layout.lua +++ b/tests/test-awful-layout.lua @@ -11,20 +11,20 @@ local has_spawned = false local steps = { --- Add enough clients -function(count) - if count <= 1 and not has_spawned then - for _=1, 5 do awful.spawn("xterm") end - has_spawned = true - elseif #client.get() >= 5 then + -- Add enough clients + function(count) + if count <= 1 and not has_spawned then + for _=1, 5 do awful.spawn("xterm") end + has_spawned = true + elseif #client.get() >= 5 then - first_layout = client.focus:tags()[1].layout + first_layout = client.focus:tags()[1].layout - t = client.focus:tags()[1] + t = client.focus:tags()[1] - return true - end -end, + return true + end + end, } @@ -77,7 +77,7 @@ local common_steps = { end, function() t.master_fill_policy = t.master_fill_policy == "master_width_factor" and - "expand" or "master_width_factor" + "expand" or "master_width_factor" return true end, diff --git a/tests/test-awful-screen.lua b/tests/test-awful-screen.lua index 47a2d43fb..b57e1cc25 100644 --- a/tests/test-awful-screen.lua +++ b/tests/test-awful-screen.lua @@ -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 + awful.spawn("xterm") + awful.spawn("xterm") + has_spawned = true -function(count) + elseif #client.get() >= 2 then + -- Test properties + client.focus = client.get()[1] -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 + local s = mouse.screen + assert(s) + assert(s == screen[s]) --- Test properties -client.focus = client.get()[1] + -- Test padding + s.padding = 42 + local counter = 0 + for _, v in pairs(s.padding) do + assert(v == 42) + counter = counter + 1 + end + assert(counter == 4) -local s = mouse.screen + awful.screen.padding(s, { + left = 1337, + right = 1337, + top = 1337, + bottom = 1337, + }) + counter = 0 + for _, v in pairs(s.padding) do + assert(v == 1337) + counter = counter + 1 + end + assert(counter == 4) -assert(s) + counter = 0 + for _, v in pairs(awful.screen.padding(s)) do + assert(v == 1337) + counter = counter + 1 + end + assert(counter == 4) -assert(s == screen[s]) + -- 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 padding + -- Test count + counter = 0 + for _ in screen do + counter = counter + 1 + end -s.padding = 42 + assert(screen.count() == counter) -local counter = 0 -for _, v in pairs(s.padding) do - assert(v == 42) - counter = counter + 1 -end + counter = 0 + awful.screen.connect_for_each_screen(function() + counter = counter + 1 + end) + assert(screen.count() == counter) -assert(counter == 4) - -awful.screen.padding(s, { - left = 1337, - right = 1337, - top = 1337, - bottom = 1337, -}) - -counter = 0 -for _, v in pairs(s.padding) do - assert(v == 1337) - counter = counter + 1 -end - -assert(counter == 4) - -counter = 0 -for _, v in pairs(awful.screen.padding(s)) do - assert(v == 1337) - counter = counter + 1 -end - -assert(counter == 4) - --- 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 - counter = counter + 1 -end - -assert(screen.count() == counter) - -counter = 0 -awful.screen.connect_for_each_screen(function() - counter = counter + 1 -end) - -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 diff --git a/tests/test-awful-tag.lua b/tests/test-awful-tag.lua index d58a9898f..e6601ab43 100644 --- a/tests/test-awful-tag.lua +++ b/tests/test-awful-tag.lua @@ -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 - awful.spawn("xterm") - awful.spawn("xterm") - has_spawned = true -elseif #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 --- 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 - if t == v then - found = true - break + for _, v in ipairs(tags) do + if t == v then + found = true + break + end + end + + assert(found) + + assert(t:clients()[1] == c) + assert(c:tags()[2] == t) + assert(t.icon == beautiful.awesome_icon) + + t:delete() + + tags = mouse.screen.tags + assert(#tags == 9) + + found = false + + for _, v in ipairs(tags) do + if t == v then + found = true + break + end + end + + assert(not found) + + -- Test selected tags, view only and selected() + + t = tags[2] + + assert(not t.selected) + + assert(t.screen.selected_tag == tags[1]) + + t:view_only() + + assert(t.selected) + + assert(not tags[1].selected) + + assert(#t.screen.selected_tags == 1) + + return true + end end -end - -assert(found) - -assert(t:clients()[1] == c) -assert(c:tags()[2] == t) -assert(t.icon == beautiful.awesome_icon) - -t:delete() - -tags = mouse.screen.tags -assert(#tags == 9) - -found = false - -for _, v in ipairs(tags) do - if t == v then - found = true - break - end -end - -assert(not found) - --- Test selected tags, view only and selected() - -t = tags[2] - -assert(not t.selected) - -assert(t.screen.selected_tag == tags[1]) - -t:view_only() - -assert(t.selected) - -assert(not tags[1].selected) - -assert(#t.screen.selected_tags == 1) - -return true -end -end } local multi_screen_steps = {} diff --git a/tests/test-awful-widget-button.lua b/tests/test-awful-widget-button.lua index be99c5653..b7051547f 100644 --- a/tests/test-awful-widget-button.lua +++ b/tests/test-awful-widget-button.lua @@ -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) diff --git a/tests/test-benchmark.lua b/tests/test-benchmark.lua index c725de976..55d9f919d 100644 --- a/tests/test-benchmark.lua +++ b/tests/test-benchmark.lua @@ -35,7 +35,7 @@ do time_per_iter, time_total = measure(f, iters) end print(string.format("%20s: %-10.6g sec/iter (%3d iters, %.4g sec for benchmark)", - msg, time_per_iter, iters, timer_benchmark:elapsed())) + msg, time_per_iter, iters, timer_benchmark:elapsed())) end end diff --git a/tests/test-client-swap.lua b/tests/test-client-swap.lua index 6ed96828c..a9261bc7f 100644 --- a/tests/test-client-swap.lua +++ b/tests/test-client-swap.lua @@ -4,30 +4,30 @@ local runner = require("_runner") local test_client = require("_client") runner.run_steps({ - -- Spawn two clients - function(count) - if count == 1 then - test_client() - test_client() - end - if #client.get() >= 2 then - return true - end - end, + -- Spawn two clients + function(count) + if count == 1 then + test_client() + test_client() + end + if #client.get() >= 2 then + return true + end + end, - -- Swap them - function() - assert(#client.get() == 2, #client.get()) - local c1 = client.get()[1] - local c2 = client.get()[2] + -- Swap them + function() + assert(#client.get() == 2, #client.get()) + local c1 = client.get()[1] + local c2 = client.get()[2] - c2:swap(c1) - c1:swap(c2) - c1:swap(c2) - c1:swap(c2) - c2:swap(c1) - return true - end, -}) + c2:swap(c1) + c1:swap(c2) + c1:swap(c2) + c1:swap(c2) + c2:swap(c1) + return true + end, + }) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/test-dbus-error.lua b/tests/test-dbus-error.lua index 818db787e..0d0acbc0b 100644 --- a/tests/test-dbus-error.lua +++ b/tests/test-dbus-error.lua @@ -17,13 +17,13 @@ dbus.connect_signal("org.awesomewm.test", dbus_callback) for _=1, 2 do awful.spawn({ - "dbus-send", - "--dest=org.awesomewm.test", - "--type=method_call", - "/", - "org.awesomewm.test.Ping", - "string:foo" - }) + "dbus-send", + "--dest=org.awesomewm.test", + "--type=method_call", + "/", + "org.awesomewm.test.Ping", + "string:foo" + }) end runner.run_steps({ function() diff --git a/tests/test-drawable-bgimage.lua b/tests/test-drawable-bgimage.lua index b3fb7a74f..ed6bd1d9d 100644 --- a/tests/test-drawable-bgimage.lua +++ b/tests/test-drawable-bgimage.lua @@ -25,32 +25,32 @@ local function callback(context, cr, width, height, arg) end runner.run_steps({ - -- Set some bg image - function() - local img = assert(beautiful.titlebar_close_button_normal) - w:set_bgimage(img) - return true - end, + -- Set some bg image + function() + local img = assert(beautiful.titlebar_close_button_normal) + w:set_bgimage(img) + return true + end, - -- Do nothing for a while iteration to give the repaint some time to happen - function(arg) - if arg == 3 then - return true - end - end, + -- Do nothing for a while iteration to give the repaint some time to happen + function(arg) + if arg == 3 then + return true + end + end, - -- Set some bg image function - function() - w:set_bgimage(callback, "argument: 42") - return true - end, + -- Set some bg image function + function() + w:set_bgimage(callback, "argument: 42") + return true + end, - -- Wait for the function to be done - function() - if callback_called then - return true - end - end, -}) + -- Wait for the function to be done + function() + if callback_called then + return true + end + end, + }) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/test-focus.lua b/tests/test-focus.lua index 41b3cd561..91b39f2ce 100644 --- a/tests/test-focus.lua +++ b/tests/test-focus.lua @@ -9,40 +9,40 @@ beautiful.border_normal = "#0000ff" beautiful.border_focus = "#00ff00" client.connect_signal("focus", function(c) - c.border_color = "#ff0000" + c.border_color = "#ff0000" end) local steps = { - -- border_color should get applied via focus signal for first client on tag. - function(count) - if count == 1 then - awful.spawn("xterm") - else - local c = client.get()[1] - if c then - assert(c.border_color == "#ff0000") - return true - end - end - end, - - -- border_color should get applied via focus signal for second client on tag. - function(count) - if count == 1 then - awful.spawn("xterm") - else - if #client.get() == 2 then - local c = client.get()[1] - assert(c == client.focus) - if c then - assert(c.border_color == "#ff0000") - return true + -- border_color should get applied via focus signal for first client on tag. + function(count) + if count == 1 then + awful.spawn("xterm") + else + local c = client.get()[1] + if c then + assert(c.border_color == "#ff0000") + return true + end end + end, - end + -- border_color should get applied via focus signal for second client on tag. + function(count) + if count == 1 then + awful.spawn("xterm") + else + if #client.get() == 2 then + local c = client.get()[1] + assert(c == client.focus) + if c then + assert(c.border_color == "#ff0000") + return true + end + + end + end end - end } runner.run_steps(steps) diff --git a/tests/test-geometry.lua b/tests/test-geometry.lua index 0a36aa5e0..7b6bf19c7 100644 --- a/tests/test-geometry.lua +++ b/tests/test-geometry.lua @@ -11,14 +11,14 @@ local w1_draw, w2_draw -- Disable automatic placement awful.rules.rules = { { rule = { }, properties = { - border_width = 0, - size_hints_honor = false, - x = 0, - y = 0, - width = 100, - height = 100, - border_color = beautiful.border_normal - } + border_width = 0, + size_hints_honor = false, + x = 0, + y = 0, + width = 100, + height = 100, + border_color = beautiful.border_normal +} } } @@ -55,22 +55,22 @@ local steps = { awful.rules.rules = { -- All clients will match this rule. { rule = { },properties = { - titlebars_enabled = true, - border_width = 10, - border_color = "#00ff00", - size_hints_honor = false, - x = 0, - y = 0, - width = 100, - height = 100 - } - } + titlebars_enabled = true, + border_width = 10, + border_color = "#00ff00", + size_hints_honor = false, + x = 0, + y = 0, + width = 100, + height = 100 } - return true + } +} +return true end, function(count) if count == 1 then - awful.spawn("xterm") + awful.spawn("xterm") else local c = client.get()[1] if c then diff --git a/tests/test-leak-client.lua b/tests/test-leak-client.lua index c6d209bf4..09e2d2906 100644 --- a/tests/test-leak-client.lua +++ b/tests/test-leak-client.lua @@ -6,17 +6,17 @@ local wibox = require("wibox") -- "Enable" titlebars (so that the titlebar can prevent garbage collection) client.connect_signal("manage", function (c) local buttons = awful.util.table.join( - awful.button({ }, 1, function() - client.focus = c - c:raise() - awful.mouse.client.move(c) - end), - awful.button({ }, 3, function() - client.focus = c - c:raise() - awful.mouse.client.resize(c) - end) - ) + awful.button({ }, 1, function() + client.focus = c + c:raise() + awful.mouse.client.move(c) + end), + awful.button({ }, 3, function() + client.focus = c + c:raise() + awful.mouse.client.resize(c) + end) + ) -- Widgets that are aligned to the left local left_layout = wibox.layout.fixed.horizontal(awful.titlebar.widget.iconwidget(c)) @@ -37,7 +37,7 @@ client.connect_signal("manage", function (c) awful.titlebar.widget.stickybutton(c), awful.titlebar.widget.ontopbutton(c), awful.titlebar.widget.closebutton(c) - )), { position = "bottom"}) + )), { position = "bottom"}) end) -- We tell the garbage collector when to work, disable it diff --git a/tests/test-resize.lua b/tests/test-resize.lua index a1681890f..7753570a0 100644 --- a/tests/test-resize.lua +++ b/tests/test-resize.lua @@ -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() @@ -143,7 +143,7 @@ table.insert(steps, function() placement.bottom_right(c) mouse.coords {x = c.screen.geometry.width -150, - y = c.screen.geometry.height-150} + y = c.screen.geometry.height-150} return true diff --git a/tests/test-signal.lua b/tests/test-signal.lua index f88c7c259..b12065f2f 100644 --- a/tests/test-signal.lua +++ b/tests/test-signal.lua @@ -10,15 +10,15 @@ local function exit_callback(cause, signal) done = true end local pid = awesome.spawn({"/bin/sh", "-c", "sleep 60"}, false, false, - false, false, exit_callback) + false, false, exit_callback) awesome.kill(pid, awesome.unix_signal.SIGKILL) runner.run_steps({ - function() - if done then - return true - end - end -}) + function() + if done then + return true + end + end + }) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/test-spawn-snid.lua b/tests/test-spawn-snid.lua index 838906619..1a4530701 100644 --- a/tests/test-spawn-snid.lua +++ b/tests/test-spawn-snid.lua @@ -6,10 +6,10 @@ local test_client = require("_client") local manage_called, c_snid client.connect_signal("manage", function(c) - manage_called = true - c_snid = c.startup_id - assert(c.machine == awesome.hostname, - tostring(c.machine) .. " ~= " .. tostring(awesome.hostname)) + manage_called = true + c_snid = c.startup_id + assert(c.machine == awesome.hostname, + tostring(c.machine) .. " ~= " .. tostring(awesome.hostname)) end) local snid @@ -20,39 +20,39 @@ local function callback(c) end local steps = { - function(count) - if count == 1 then - snid = test_client("foo", "bar", true) - elseif manage_called then - assert(snid) - assert(snid == c_snid) - return true - end - end, + function(count) + if count == 1 then + snid = test_client("foo", "bar", true) + elseif manage_called then + assert(snid) + assert(snid == c_snid) + return true + end + end, - -- Test that c.startup_id is nil for a client without startup notifications, - -- and especially not the one from the previous spawn. - function(count) - if count == 1 then - manage_called = false - test_client("bar", "foo", false) - elseif manage_called then - assert(c_snid == nil, "c.startup_snid should be nil!") - return true - end - end, + -- Test that c.startup_id is nil for a client without startup notifications, + -- and especially not the one from the previous spawn. + function(count) + if count == 1 then + manage_called = false + test_client("bar", "foo", false) + elseif manage_called then + assert(c_snid == nil, "c.startup_snid should be nil!") + return true + end + end, - function(count) - if count == 1 then - manage_called = false - snid = test_client("baz", "barz", false, callback) - elseif manage_called then - assert(snid) - assert(snid == c_snid) - assert(num_callbacks == 1, num_callbacks) - return true - end - end, + function(count) + if count == 1 then + manage_called = false + snid = test_client("baz", "barz", false, callback) + elseif manage_called then + assert(snid) + assert(snid == c_snid) + assert(num_callbacks == 1, num_callbacks) + return true + end + end, } runner.run_steps(steps) diff --git a/tests/test-spawn.lua b/tests/test-spawn.lua index bc89936b2..a859214fd 100644 --- a/tests/test-spawn.lua +++ b/tests/test-spawn.lua @@ -10,89 +10,89 @@ local exit_yay, exit_snd = nil, nil -- * spawn with startup notification is covered by test-spawn-snid.lua local steps = { - function() - -- Test various error conditions. There are quite a number of them... - local error_message + function() + -- Test various error conditions. There are quite a number of them... + local error_message - error_message = spawn("this_does_not_exist_and_should_fail") - assert(string.find(error_message, 'No such file or directory'), error_message) + error_message = spawn("this_does_not_exist_and_should_fail") + assert(string.find(error_message, 'No such file or directory'), error_message) - error_message = spawn({"this_does_not_exist_and_should_fail"}) - assert(string.find(error_message, 'No such file or directory'), error_message) + error_message = spawn({"this_does_not_exist_and_should_fail"}) + assert(string.find(error_message, 'No such file or directory'), error_message) - error_message = spawn("foo '") - assert(string.find(error_message, 'parse error: Text ended before matching quote was found'), error_message) + error_message = spawn("foo '") + assert(string.find(error_message, 'parse error: Text ended before matching quote was found'), error_message) - error_message = spawn() - assert(string.find(error_message, 'No command to execute'), error_message) + error_message = spawn() + assert(string.find(error_message, 'No command to execute'), error_message) - error_message = spawn(" ") - assert(string.find(error_message, 'Text was empty'), error_message) + error_message = spawn(" ") + assert(string.find(error_message, 'Text was empty'), error_message) - error_message = spawn("") - assert(string.find(error_message, 'No command to execute'), error_message) + error_message = spawn("") + assert(string.find(error_message, 'No command to execute'), error_message) - error_message = spawn{} - assert(string.find(error_message, 'There is nothing to execute'), error_message) + error_message = spawn{} + assert(string.find(error_message, 'There is nothing to execute'), error_message) - return true - end, + return true + end, - function(count) - if count == 1 then - local steps_yay = 0 - spawn.with_line_callback("echo yay", { - stdout = function(line) - assert(line == "yay", "line == '" .. tostring(line) .. "'") - assert(steps_yay == 0) - steps_yay = steps_yay + 1 - end, - output_done = function() - assert(steps_yay == 1) - steps_yay = steps_yay + 1 - spawns_done = spawns_done + 1 - end, - exit = function(reason, code) - assert(reason == "exit") - assert(exit_yay == nil) - assert(code == 0) - exit_yay = code - end - }) + function(count) + if count == 1 then + local steps_yay = 0 + spawn.with_line_callback("echo yay", { + stdout = function(line) + assert(line == "yay", "line == '" .. tostring(line) .. "'") + assert(steps_yay == 0) + steps_yay = steps_yay + 1 + end, + output_done = function() + assert(steps_yay == 1) + steps_yay = steps_yay + 1 + spawns_done = spawns_done + 1 + end, + exit = function(reason, code) + assert(reason == "exit") + assert(exit_yay == nil) + assert(code == 0) + exit_yay = code + end + }) - local steps_count = 0 - local err_count = 0 - spawn.with_line_callback({ "sh", "-c", "printf line1\\\\nline2\\\\nline3 ; echo err >&2 ; exit 42" }, { - stdout = function(line) - assert(steps_count < 3) - steps_count = steps_count + 1 - assert(line == "line" .. steps_count, "line == '" .. tostring(line) .. "'") - end, - stderr = function(line) - assert(err_count == 0) - err_count = err_count + 1 - assert(line == "err", "line == '" .. tostring(line) .. "'") - end, - output_done = function() - assert(steps_count == 3) - assert(err_count == 1) - steps_count = steps_count + 1 - spawns_done = spawns_done + 1 - end, - exit = function(reason, code) - assert(reason == "exit") - assert(exit_snd == nil) - assert(code == 42) - exit_snd = code - end - }) - end - if spawns_done == 2 then - assert(exit_yay == 0) - assert(exit_snd == 42) - return true - end - end, + local steps_count = 0 + local err_count = 0 + spawn.with_line_callback({ "sh", "-c", "printf line1\\\\nline2\\\\nline3 ; echo err >&2 ; exit 42" }, { + stdout = function(line) + assert(steps_count < 3) + steps_count = steps_count + 1 + assert(line == "line" .. steps_count, "line == '" .. tostring(line) .. "'") + end, + stderr = function(line) + assert(err_count == 0) + err_count = err_count + 1 + assert(line == "err", "line == '" .. tostring(line) .. "'") + end, + output_done = function() + assert(steps_count == 3) + assert(err_count == 1) + steps_count = steps_count + 1 + spawns_done = spawns_done + 1 + end, + exit = function(reason, code) + assert(reason == "exit") + assert(exit_snd == nil) + assert(code == 42) + exit_snd = code + end + }) + end + if spawns_done == 2 then + assert(exit_yay == 0) + assert(exit_snd == 42) + return true + end + end, } runner.run_steps(steps) diff --git a/tests/test-struts.lua b/tests/test-struts.lua index 2d48d4332..af0f5d4eb 100644 --- a/tests/test-struts.lua +++ b/tests/test-struts.lua @@ -78,49 +78,49 @@ 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 { - bg = "#ff0000", - height = 50, - width = 50, - ontop = true, - visible = true, - } +-- 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() assert( ( - parent:geometry().y + parent:geometry().y + parent:geometry().height - small :geometry().height - ) == small:geometry().y + ) == small:geometry().y ) assert(math.abs(parent:geometry().x + math.ceil(parent:geometry().width/2) - small:geometry().x) <= 1) @@ -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 - w.position = "right" - end +for _, w in ipairs {twibar, lwibar, rwibar, bwibar} do + w.position = "right" +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) diff --git a/tests/test-urgent.lua b/tests/test-urgent.lua index 089eb9b2a..c19087306 100644 --- a/tests/test-urgent.lua +++ b/tests/test-urgent.lua @@ -11,100 +11,100 @@ assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == nil) -- TODO: generalize and move to runner. local urgent_cb_done client.connect_signal("property::urgent", function (c) - urgent_cb_done = true - assert(c.class == "XTerm", "Client should be xterm!") + urgent_cb_done = true + assert(c.class == "XTerm", "Client should be xterm!") end) local manage_cb_done client.connect_signal("manage", function (c) - manage_cb_done = true - assert(c.class == "XTerm", "Client should be xterm!") + manage_cb_done = true + assert(c.class == "XTerm", "Client should be xterm!") end) -- Steps to do for this test. local steps = { - -- Step 1: tag 2 should become urgent, when a client gets tagged via rules. - function(count) - if count == 1 then -- Setup. - urgent_cb_done = false - -- Select first tag. - awful.screen.focused().tags[1]:view_only() + -- Step 1: tag 2 should become urgent, when a client gets tagged via rules. + function(count) + if count == 1 then -- Setup. + urgent_cb_done = false + -- Select first tag. + awful.screen.focused().tags[1]:view_only() - runner.add_to_default_rules({ rule = { class = "XTerm" }, - properties = { tag = "2", focus = true } }) + runner.add_to_default_rules({ rule = { class = "XTerm" }, + properties = { tag = "2", focus = true } }) - awful.spawn("xterm") - end - if urgent_cb_done then - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == true) - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 1) - return true - end - end, + awful.spawn("xterm") + end + if urgent_cb_done then + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == true) + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 1) + return true + end + end, - -- Step 2: when switching to tag 2, it should not be urgent anymore. - function(count) - if count == 1 then - -- Setup: switch to tag. - root.fake_input("key_press", "Super_L") - root.fake_input("key_press", "2") - root.fake_input("key_release", "2") - root.fake_input("key_release", "Super_L") + -- Step 2: when switching to tag 2, it should not be urgent anymore. + function(count) + if count == 1 then + -- Setup: switch to tag. + root.fake_input("key_press", "Super_L") + root.fake_input("key_press", "2") + root.fake_input("key_release", "2") + root.fake_input("key_release", "Super_L") - elseif awful.screen.focused().selected_tags[1] == awful.screen.focused().tags[2] then - assert(#client.get() == 1) - local c = client.get()[1] - assert(not c.urgent, "Client is not urgent anymore.") - assert(c == client.focus, "Client is focused.") - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false) - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0) - return true - end - end, + elseif awful.screen.focused().selected_tags[1] == awful.screen.focused().tags[2] then + assert(#client.get() == 1) + local c = client.get()[1] + assert(not c.urgent, "Client is not urgent anymore.") + assert(c == client.focus, "Client is focused.") + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false) + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0) + return true + end + end, - -- Step 3: tag 2 should not be urgent, but switched to. - function(count) - if count == 1 then -- Setup. - urgent_cb_done = false + -- Step 3: tag 2 should not be urgent, but switched to. + function(count) + if count == 1 then -- Setup. + urgent_cb_done = false - -- Select first tag. - awful.screen.focused().tags[1]:view_only() + -- Select first tag. + awful.screen.focused().tags[1]:view_only() - runner.add_to_default_rules({ rule = { class = "XTerm" }, - properties = { tag = "2", focus = true, switchtotag = true }}) + runner.add_to_default_rules({ rule = { class = "XTerm" }, + properties = { tag = "2", focus = true, switchtotag = true }}) - awful.spawn("xterm") + awful.spawn("xterm") - elseif awful.screen.focused().selected_tags[1] == awful.screen.focused().tags[2] then - assert(not urgent_cb_done) - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false) - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0) - assert(awful.screen.focused().selected_tags[2] == nil) - return true - end - end, + elseif awful.screen.focused().selected_tags[1] == awful.screen.focused().tags[2] then + assert(not urgent_cb_done) + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false) + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0) + assert(awful.screen.focused().selected_tags[2] == nil) + return true + end + end, - -- Step 4: tag 2 should not become urgent, when a client gets tagged via - -- rules with focus=false. - function(count) - if count == 1 then -- Setup. - client.get()[1]:kill() - manage_cb_done = false + -- Step 4: tag 2 should not become urgent, when a client gets tagged via + -- rules with focus=false. + function(count) + if count == 1 then -- Setup. + client.get()[1]:kill() + manage_cb_done = false - runner.add_to_default_rules({rule = { class = "XTerm" }, - properties = { tag = "2", focus = false }}) + runner.add_to_default_rules({rule = { class = "XTerm" }, + properties = { tag = "2", focus = false }}) - awful.spawn("xterm") - end - if manage_cb_done then - assert(client.get()[1].urgent == false) - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false) - assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0) - return true - end - end, + awful.spawn("xterm") + end + if manage_cb_done then + assert(client.get()[1].urgent == false) + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false) + assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0) + return true + end + end, } runner.run_steps(steps) diff --git a/tests/test-wallpaper.lua b/tests/test-wallpaper.lua index bae1782aa..c337d9dbb 100644 --- a/tests/test-wallpaper.lua +++ b/tests/test-wallpaper.lua @@ -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 - wp.set(c) - end +for _, c in ipairs(colors) do + wp.set(c) +end - return true +return true end)