]> git.sur5r.net Git - i3/i3/blob - testcases/t/276-ipc-window-move.t
f3606b4e8106b1c32d34a463cca45bb2d29d5d24
[i3/i3] / testcases / t / 276-ipc-window-move.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 # Tests that the ipc window::move event works properly
18 #
19 # Bug still in: 4.8-7-gf4a8253
20 use i3test;
21
22 my $dummy_window = open_window;
23 my $window = open_window;
24
25 sub move_subtest {
26     my ($cmd) = @_;
27     my $cv = AnyEvent->condvar;
28     my @events = events_for(
29         sub { cmd $cmd },
30         'window');
31
32     my @move = grep { $_->{change} eq 'move' } @events;
33     is(scalar @move, 1, 'Received 1 window::move event');
34     is($move[0]->{container}->{window}, $window->{id}, 'window id matches');
35 }
36
37 subtest 'move right', \&move_subtest, 'move right';
38 subtest 'move to workspace', \&move_subtest, 'move to workspace ws_new';
39
40 done_testing;