]> git.sur5r.net Git - i3/i3/blob - testcases/t/276-ipc-window-move.t
Merge pull request #2953 from CyberShadow/focus_wrapping
[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 $i3 = i3(get_socket_path());
23 $i3->connect()->recv;
24
25 my $cv;
26 my $t;
27
28 sub reset_test {
29     $cv = AE::cv;
30     $t = AE::timer(0.5, 0, sub { $cv->send(0); });
31 }
32
33 reset_test;
34
35 $i3->subscribe({
36         window => sub {
37             my ($e) = @_;
38             if ($e->{change} eq 'move') {
39                 $cv->send($e->{container});
40             }
41         },
42     })->recv;
43
44 my $dummy_window = open_window;
45 my $window = open_window;
46
47 cmd 'move right';
48 my $con = $cv->recv;
49
50 ok($con, 'moving a window should emit the window::move event');
51 is($con->{window}, $window->{id}, 'the event should contain info about the window');
52
53 reset_test;
54
55 cmd 'move to workspace ws_new';
56 $con = $cv->recv;
57
58 ok($con, 'moving a window to a different workspace should emit the window::move event');
59 is($con->{window}, $window->{id}, 'the event should contain info about the window');
60
61 done_testing;