]> git.sur5r.net Git - i3/i3/blob - testcases/t/05-ipc.t
make testcases use AnyEvent::I3
[i3/i3] / testcases / t / 05-ipc.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3
4 use Test::More tests => 3;
5 use Test::Deep;
6 use X11::XCB qw(:all);
7 use Data::Dumper;
8 use Time::HiRes qw(sleep);
9 use FindBin;
10 use lib "$FindBin::Bin/lib";
11 use i3test;
12 use AnyEvent::I3;
13
14 BEGIN {
15     use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
16     use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
17 }
18
19 my $x = X11::XCB::Connection->new;
20
21 my $i3 = i3;
22
23 #####################################################################
24 # Ensure IPC works by switching workspaces
25 #####################################################################
26
27 # Switch to the first workspace to get a clean testing environment
28 $i3->command('1')->recv;
29
30 # Create a window so we can get a focus different from NULL
31 my $window = i3test::open_standard_window($x);
32 diag("window->id = " . $window->id);
33
34 sleep(0.25);
35
36 my $focus = $x->input_focus;
37 diag("old focus = $focus");
38
39 # Switch to the nineth workspace
40 $i3->command('9')->recv;
41
42 my $new_focus = $x->input_focus;
43 isnt($focus, $new_focus, "Focus changed");
44
45 diag( "Testing i3, Perl $], $^X" );