2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Tests sticky windows.
23 ###############################################################################
24 # 1: Given a sticky tiling container, when the workspace is switched, then
26 ###############################################################################
28 open_window(wm_class => 'findme');
30 $ws = fresh_workspace;
32 is(@{get_ws($ws)->{nodes}}, 0, 'tiling sticky container did not move');
33 is(@{get_ws($ws)->{floating_nodes}}, 0, 'tiling sticky container did not move');
34 cmd '[class="findme"] kill';
36 ###############################################################################
37 # 2: Given a sticky floating container, when the workspace is switched, then
38 # the container moves to the new workspace.
39 ###############################################################################
40 $ws = fresh_workspace;
41 open_floating_window(wm_class => 'findme');
42 $focused = get_focused($ws);
44 $ws = fresh_workspace;
46 is(@{get_ws($ws)->{floating_nodes}}, 1, 'floating sticky container moved to new workspace');
47 is(get_focused($ws), $focused, 'sticky container has focus');
48 cmd '[class="findme"] kill';
50 ###############################################################################
51 # 3: Given two sticky floating containers, when the workspace is switched,
52 # then both containers move to the new workspace.
53 ###############################################################################
55 open_floating_window(wm_class => 'findme');
57 open_floating_window(wm_class => 'findme');
59 $ws = fresh_workspace;
61 is(@{get_ws($ws)->{floating_nodes}}, 2, 'multiple sticky windows can be used at the same time');
62 cmd '[class="findme"] kill';
64 ###############################################################################
65 # 4: Given a sticky floating container and a tiling container on the target
66 # workspace, when the workspace is switched, then the tiling container is
68 ###############################################################################
69 $ws = fresh_workspace;
71 $focused = get_focused($ws);
73 open_floating_window(wm_class => 'findme');
75 cmd 'workspace ' . $ws;
77 is(get_focused($ws), $focused, 'the tiling container has focus');
78 cmd '[class="findme"] kill';
80 ###############################################################################
81 # 5: Given a floating container on a non-visible workspace, when the window
82 # is made sticky, then the window immediately jumps to the currently
84 ###############################################################################
86 open_floating_window(wm_class => 'findme');
88 $ws = fresh_workspace;
89 cmd '[con_mark=sticky] sticky enable';
91 is(@{get_ws($ws)->{floating_nodes}}, 1, 'the sticky window jumps to the front');
92 cmd '[class="findme"] kill';
94 ###############################################################################