From: Ingo Bürk Date: Sun, 23 Aug 2015 20:19:20 +0000 (+0200) Subject: Added tests for sticky windows. X-Git-Tag: 4.11~18^2~1 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=23a1dadaae73260b951a3c6449b071f0530d3efb Added tests for sticky windows. --- diff --git a/testcases/t/251-sticky.t b/testcases/t/251-sticky.t new file mode 100644 index 00000000..ada8c9ac --- /dev/null +++ b/testcases/t/251-sticky.t @@ -0,0 +1,82 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Please read the following documents before working on tests: +# • http://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • http://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • http://build.i3wm.org/docs/ipc.html +# (or docs/ipc) +# +# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf +# (unless you are already familiar with Perl) +# +# Tests sticky windows. +# Ticket: #1455 +use i3test; + +my ($ws, $focused); + +############################################################################### +# 1: Given a sticky tiling container, when the workspace is switched, then +# nothing happens. +############################################################################### +fresh_workspace; +open_window(wm_class => 'findme'); +cmd 'sticky enable'; +$ws = fresh_workspace; + +is(@{get_ws($ws)->{nodes}}, 0, 'tiling sticky container did not move'); +is(@{get_ws($ws)->{floating_nodes}}, 0, 'tiling sticky container did not move'); +cmd '[class="findme"] kill'; + +############################################################################### +# 2: Given a sticky floating container, when the workspace is switched, then +# the container moves to the new workspace. +############################################################################### +$ws = fresh_workspace; +open_floating_window(wm_class => 'findme'); +$focused = get_focused($ws); +cmd 'sticky enable'; +$ws = fresh_workspace; + +is(@{get_ws($ws)->{floating_nodes}}, 1, 'floating sticky container moved to new workspace'); +is(get_focused($ws), $focused, 'sticky container has focus'); +cmd '[class="findme"] kill'; + +############################################################################### +# 3: Given two sticky floating containers, when the workspace is switched, +# then both containers move to the new workspace. +############################################################################### +fresh_workspace; +open_floating_window(wm_class => 'findme'); +cmd 'sticky enable'; +open_floating_window(wm_class => 'findme'); +cmd 'sticky enable'; +$ws = fresh_workspace; + +is(@{get_ws($ws)->{floating_nodes}}, 2, 'multiple sticky windows can be used at the same time'); +cmd '[class="findme"] kill'; + +############################################################################### +# 4: Given a sticky floating container and a tiling container on the target +# workspace, when the workspace is switched, then the tiling container is +# focused. +############################################################################### +$ws = fresh_workspace; +open_window; +$focused = get_focused($ws); +fresh_workspace; +open_floating_window(wm_class => 'findme'); +cmd 'sticky enable'; +cmd 'workspace ' . $ws; + +is(get_focused($ws), $focused, 'the tiling container has focus'); +cmd '[class="findme"] kill'; + +############################################################################### + +done_testing;