]> git.sur5r.net Git - i3/i3/blob - testcases/t/225-ipc-window-fullscreen.t
Fix 'rename workspace to tosomething'
[i3/i3] / testcases / t / 225-ipc-window-fullscreen.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://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::fullscreen_mode event works properly
18 #
19 # Bug still in: 4.7.2-135-g7deb23c
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 'fullscreen_mode') {
39                 $cv->send($e->{container});
40             }
41         },
42     })->recv;
43
44 my $window = open_window;
45
46 cmd 'fullscreen';
47 my $con = $cv->recv;
48
49 ok($con, 'got fullscreen window event (on)');
50 is($con->{fullscreen_mode}, 1, 'window is fullscreen');
51
52 reset_test;
53 cmd 'fullscreen';
54 $con = $cv->recv;
55
56 ok($con, 'got fullscreen window event (off)');
57 is($con->{fullscreen_mode}, 0, 'window is not fullscreen');
58
59 done_testing;