]> git.sur5r.net Git - i3/i3/blob - testcases/t/232-cmd-move-criteria.t
Remove trailing whitespace from Perl scripts
[i3/i3] / testcases / t / 232-cmd-move-criteria.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 # Test that the `move [direction]` command works with criteria
18 # Bug still in: 4.8-16-g6888a1f
19 use i3test;
20
21 my ($ws, $win1, $win2, $win3, $ws_con);
22
23 ###############################################################################
24 # Tets moving with 'id' criterion.
25 ###############################################################################
26
27 $ws = fresh_workspace;
28
29 $win1 = open_window;
30 $win2 = open_window;
31 $win3 = open_window;
32
33 # move win1 from the left to the right
34 cmd '[id="' . $win1->{id} . '"] move right';
35
36 # now they should be switched, with win2 still being focused
37 $ws_con = get_ws($ws);
38
39 # win2 should be on the left
40 is($ws_con->{nodes}[0]->{window}, $win2->{id}, 'the `move [direction]` command should work with criteria');
41 is($x->input_focus, $win3->{id}, 'it should not disturb focus');
42
43 ###############################################################################
44 # Tets moving with 'window_type' criterion.
45 ###############################################################################
46
47 # test all window types
48 my %window_types = (
49     'normal'        => '_NET_WM_WINDOW_TYPE_NORMAL',
50     'dialog'        => '_NET_WM_WINDOW_TYPE_DIALOG',
51     'utility'       => '_NET_WM_WINDOW_TYPE_UTILITY',
52     'toolbar'       => '_NET_WM_WINDOW_TYPE_TOOLBAR',
53     'splash'        => '_NET_WM_WINDOW_TYPE_SPLASH',
54     'menu'          => '_NET_WM_WINDOW_TYPE_MENU',
55     'dropdown_menu' => '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU',
56     'popup_menu'    => '_NET_WM_WINDOW_TYPE_POPUP_MENU',
57     'tooltip'       => '_NET_WM_WINDOW_TYPE_TOOLTIP',
58     'notification'  => '_NET_WM_WINDOW_TYPE_NOTIFICATION'
59 );
60
61 while (my ($window_type, $atom) = each %window_types) {
62
63     $ws = fresh_workspace;
64
65     $win1 = open_window(window_type => $x->atom(name => $atom));
66     $win2 = open_window;
67     $win3 = open_window;
68
69     cmd '[window_type="' . $window_type . '"] move right';
70
71     $ws_con = get_ws($ws);
72     is($ws_con->{nodes}[0]->{window}, $win2->{id}, 'the `move [direction]` command should work with window_type = ' . $window_type);
73     is($x->input_focus, $win3->{id}, 'it should not disturb focus');
74
75 }
76
77 ###############################################################################
78
79 done_testing;