X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=testcases%2Ft%2F232-cmd-move-criteria.t;h=312c9660e51a0af91f3950aa5262684247d0317f;hb=3f4268561d4482e2c770d7c6b7b32d7ce8c82568;hp=22a2eb4e2504c2e531ecb3ec76877be48930178d;hpb=db62b5a4df3d7ee7ac9363e4c430ea0155abba25;p=i3%2Fi3 diff --git a/testcases/t/232-cmd-move-criteria.t b/testcases/t/232-cmd-move-criteria.t index 22a2eb4e..312c9660 100644 --- a/testcases/t/232-cmd-move-criteria.t +++ b/testcases/t/232-cmd-move-criteria.t @@ -2,13 +2,13 @@ # vim:ts=4:sw=4:expandtab # # Please read the following documents before working on tests: -# • http://build.i3wm.org/docs/testsuite.html +# • https://build.i3wm.org/docs/testsuite.html # (or docs/testsuite) # -# • http://build.i3wm.org/docs/lib-i3test.html +# • https://build.i3wm.org/docs/lib-i3test.html # (alternatively: perldoc ./testcases/lib/i3test.pm) # -# • http://build.i3wm.org/docs/ipc.html +# • https://build.i3wm.org/docs/ipc.html # (or docs/ipc) # # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf @@ -18,20 +18,62 @@ # Bug still in: 4.8-16-g6888a1f use i3test; -my $ws = fresh_workspace; +my ($ws, $win1, $win2, $win3, $ws_con); -my $win1 = open_window; -my $win2 = open_window; -my $win3 = open_window; +############################################################################### +# Tets moving with 'id' criterion. +############################################################################### + +$ws = fresh_workspace; + +$win1 = open_window; +$win2 = open_window; +$win3 = open_window; # move win1 from the left to the right cmd '[id="' . $win1->{id} . '"] move right'; # now they should be switched, with win2 still being focused -my $ws_con = get_ws($ws); +$ws_con = get_ws($ws); # win2 should be on the left is($ws_con->{nodes}[0]->{window}, $win2->{id}, 'the `move [direction]` command should work with criteria'); is($x->input_focus, $win3->{id}, 'it should not disturb focus'); +############################################################################### +# Tets moving with 'window_type' criterion. +############################################################################### + +# test all window types +my %window_types = ( + 'normal' => '_NET_WM_WINDOW_TYPE_NORMAL', + 'dialog' => '_NET_WM_WINDOW_TYPE_DIALOG', + 'utility' => '_NET_WM_WINDOW_TYPE_UTILITY', + 'toolbar' => '_NET_WM_WINDOW_TYPE_TOOLBAR', + 'splash' => '_NET_WM_WINDOW_TYPE_SPLASH', + 'menu' => '_NET_WM_WINDOW_TYPE_MENU', + 'dropdown_menu' => '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU', + 'popup_menu' => '_NET_WM_WINDOW_TYPE_POPUP_MENU', + 'tooltip' => '_NET_WM_WINDOW_TYPE_TOOLTIP', + 'notification' => '_NET_WM_WINDOW_TYPE_NOTIFICATION' +); + +while (my ($window_type, $atom) = each %window_types) { + + $ws = fresh_workspace; + + $win1 = open_window(window_type => $x->atom(name => $atom)); + $win2 = open_window; + $win3 = open_window; + + cmd '[window_type="' . $window_type . '"] move right'; + + $ws_con = get_ws($ws); + is($ws_con->{nodes}[0]->{window}, $win2->{id}, 'the `move [direction]` command should work with window_type = ' . $window_type); + is($x->input_focus, $win3->{id}, 'it should not disturb focus'); + +} + +############################################################################### + done_testing;