tests: Add tests for swapping a client.

This commit is contained in:
Emmanuel Lepage Vallee 2021-10-15 19:59:24 -07:00
parent 785ca98337
commit 667a0dfc18
3 changed files with 123 additions and 0 deletions

View File

@ -0,0 +1,41 @@
--DOC_GEN_IMAGE --DOC_ASTERISK
local module = ... --DOC_HIDE
require("ruled.client") --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
awful.placement = require("awful.placement") --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]:fake_resize(0, 0, 800, 480) --DOC_HIDE
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=screen[1]} --DOC_HIDE
end --DOC_HIDE
--DOC_NEWLINE
module.add_event("Spawn 5 clients in a `awful.layout.suit.tile` layout.", function() --DOC_HIDE
-- Spawn 5 clients.
for i=1, 5 do
awful.spawn("Client #"..i)
end
--DOC_NEWLINE
client.get()[2]:activate {}
client.get()[2].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Call `:swap()` on the second client.", function() --DOC_HIDE
client.get()[2]:swap(client.get()[4])
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = true , display_clients = true, --DOC_HIDE
display_label = false, display_client_name = true, --DOC_HIDE
display_mouse = true , --DOC_HIDE
} --DOC_HIDE

View File

@ -0,0 +1,41 @@
--DOC_GEN_IMAGE
local module = ... --DOC_HIDE
require("ruled.client") --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
awful.placement = require("awful.placement") --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]:fake_resize(0, 0, 800, 480) --DOC_HIDE
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=screen[1]} --DOC_HIDE
end --DOC_HIDE
--DOC_NEWLINE
module.add_event("Spawn 5 clients in a `awful.layout.suit.tile` layout.", function() --DOC_HIDE
-- Spawn a client on screen #3
for i=1, 5 do
awful.spawn("Client #"..i)
end
--DOC_NEWLINE
client.get()[5]:activate {}
client.get()[5].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Call `:to_primary_section()` on the 5th client.", function() --DOC_HIDE
client.get()[5]:to_primary_section()
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = true , display_clients = true, --DOC_HIDE
display_label = false, display_client_name = true, --DOC_HIDE
display_mouse = true , --DOC_HIDE
} --DOC_HIDE

View File

@ -0,0 +1,41 @@
--DOC_GEN_IMAGE
local module = ... --DOC_HIDE
require("ruled.client") --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
awful.placement = require("awful.placement") --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]:fake_resize(0, 0, 800, 480) --DOC_HIDE
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=screen[1]} --DOC_HIDE
end --DOC_HIDE
--DOC_NEWLINE
module.add_event("Spawn 5 clients in a `awful.layout.suit.tile` layout.", function() --DOC_HIDE
-- Spawn a client on screen #3
for i=1, 5 do
awful.spawn("Client #"..i)
end
--DOC_NEWLINE
client.get()[1]:activate {}
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Call `:to_secondary_section()` on the 1st client.", function() --DOC_HIDE
client.get()[1]:to_secondary_section()
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = true , display_clients = true, --DOC_HIDE
display_label = false, display_client_name = true, --DOC_HIDE
display_mouse = true , --DOC_HIDE
} --DOC_HIDE