]> git.sur5r.net Git - i3/i3/blob - testcases/t/206-fullscreen-scratchpad.t
Merge pull request #2953 from CyberShadow/focus_wrapping
[i3/i3] / testcases / t / 206-fullscreen-scratchpad.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 #   Assure that no window is in fullscreen mode after showing a scratchpad window
18 # Bug still in: 4.5.1-54-g0f6b5fe
19
20 use i3test;
21
22 my $tmp = fresh_workspace;
23
24 sub fullscreen_windows {
25     my $ws = $tmp;
26     $ws = shift if @_;
27
28     my $nodes = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)->[0]->{nodes}};
29     my $cons = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)};
30     return $nodes + $cons;
31 }
32
33 ##########################################################################################
34 # map two windows in one container, fullscreen one of them and then move it to scratchpad
35 ##########################################################################################
36
37 my $first_win = open_window;
38 my $second_win = open_window;
39
40 # fullscreen the focused window
41 cmd 'fullscreen';
42
43 # see if the window really is in fullscreen mode
44 is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscreen');
45
46 # move window to scratchpad
47 cmd 'move scratchpad';
48
49 ###############################################################################
50 # show the scratchpad window again; it should not be in fullscreen mode anymore
51 ###############################################################################
52
53 # show window from scratchpad
54 cmd 'scratchpad show';
55
56 # switch window back to tiling mode
57 cmd 'floating toggle';
58
59 # see if no window is in fullscreen mode
60 is(fullscreen_windows(), 0, 'amount of fullscreen windows after showing previously fullscreened scratchpad window');
61
62 ########################################################################################
63 # move a window to scratchpad, focus parent container, make it fullscreen, focus a child
64 ########################################################################################
65
66 # make layout tabbed
67 cmd 'layout tabbed';
68
69 # move one window to scratchpad
70 cmd 'move scratchpad';
71
72 # focus parent
73 cmd 'focus parent';
74
75 # fullscreen the container
76 cmd 'fullscreen';
77
78 # focus child
79 cmd 'focus child';
80
81 # see if the window really is in fullscreen mode
82 is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscreen on parent');
83
84 ##########################################################################
85 # show a scratchpad window; no window should be in fullscreen mode anymore
86 ##########################################################################
87
88 # show the scratchpad window
89 cmd 'scratchpad show';
90
91 # see if no window is in fullscreen mode
92 is(fullscreen_windows(), 0, 'amount of fullscreen windows after showing a scratchpad window while a parent container was in fullscreen mode');
93
94 done_testing;