]> git.sur5r.net Git - i3/i3/blob - testcases/t/14-client-leader.t
Fix unaligned memory access on sparc (Thanks David Coppa)
[i3/i3] / testcases / t / 14-client-leader.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # Beware that this test uses workspace 9 and 10 to perform some tests (it expects
4 # the workspace to be empty).
5 # TODO: skip it by default?
6
7 use Test::More tests => 3;
8 use Test::Deep;
9 use X11::XCB qw(:all);
10 use Data::Dumper;
11 use Time::HiRes qw(sleep);
12 use FindBin;
13 use Digest::SHA1 qw(sha1_base64);
14 use lib "$FindBin::Bin/lib";
15 use i3test;
16 use AnyEvent::I3;
17
18 BEGIN {
19     use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
20 }
21
22 my $x = X11::XCB::Connection->new;
23 my $i3 = i3;
24
25 # Switch to the nineth workspace
26 $i3->command('9')->recv;
27
28 #####################################################################
29 # Create a parent window
30 #####################################################################
31
32 my $window = $x->root->create_child(
33 class => WINDOW_CLASS_INPUT_OUTPUT,
34 rect => [ 0, 0, 30, 30 ],
35 background_color => '#C0C0C0',
36 );
37
38 $window->name('Parent window');
39 $window->map;
40
41 sleep 0.25;
42
43 #########################################################################
44 # Switch workspace to 10 and open a child window. It should be positioned
45 # on workspace 9.
46 #########################################################################
47 $i3->command('10')->recv;
48
49 my $child = $x->root->create_child(
50 class => WINDOW_CLASS_INPUT_OUTPUT,
51 rect => [ 0, 0, 30, 30 ],
52 background_color => '#C0C0C0',
53 );
54
55 $child->name('Child window');
56 $child->client_leader($window);
57 $child->map;
58
59 sleep 0.25;
60
61 isnt($x->input_focus, $child->id, "Child window focused");
62
63 # Switch back
64 $i3->command('9')->recv;
65
66 is($x->input_focus, $child->id, "Child window focused");