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.
21 my ($ws, $tmp, $focused);
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 an unfocused sticky floating container and a tiling container on the
66 # target workspace, when the workspace is switched, then the tiling container
68 ###############################################################################
69 $ws = fresh_workspace;
71 $focused = get_focused($ws);
73 open_floating_window(wm_class => 'findme');
76 cmd 'workspace ' . $ws;
78 is(get_focused($ws), $focused, 'the tiling container has focus');
79 cmd '[class="findme"] kill';
81 ###############################################################################
82 # 5: Given a focused sticky floating container and a tiling container on the
83 # target workspace, when the workspace is switched, then the tiling container
85 ###############################################################################
86 $ws = fresh_workspace;
88 $tmp = fresh_workspace;
89 open_floating_window(wm_class => 'findme');
90 $focused = get_focused($tmp);
92 cmd 'workspace ' . $ws;
94 is(get_focused($ws), $focused, 'the sticky container has focus');
95 cmd '[class="findme"] kill';
97 ###############################################################################
98 # 6: Given a floating container on a non-visible workspace, when the window
99 # is made sticky, then the window immediately jumps to the currently
101 ###############################################################################
103 open_floating_window(wm_class => 'findme');
105 $ws = fresh_workspace;
106 cmd '[con_mark=sticky] sticky enable';
108 is(@{get_ws($ws)->{floating_nodes}}, 1, 'the sticky window jumps to the front');
109 cmd '[class="findme"] kill';
111 ###############################################################################