]> git.sur5r.net Git - i3/i3/blob - testcases/t/50-regress-dock-restart.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 50-regress-dock-restart.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Regression test for inplace restarting with dock clients
5 #
6 use X11::XCB qw(:all);
7 use i3test;
8
9 BEGIN {
10     use_ok('X11::XCB::Window');
11 }
12
13 my $x = X11::XCB::Connection->new;
14
15 my $tmp = fresh_workspace;
16
17 #####################################################################
18 # verify that there is no dock window yet
19 #####################################################################
20
21 # Children of all dockareas
22 my @docked = get_dock_clients;
23
24 is(@docked, 0, 'no dock clients yet');
25
26 # open a dock client
27
28 my $window = open_window($x, {
29         background_color => '#FF0000',
30         window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
31     });
32
33 #####################################################################
34 # check that we can find it in the layout tree at the expected position
35 #####################################################################
36
37 @docked = get_dock_clients;
38 is(@docked, 1, 'one dock client found');
39
40 # verify the height
41 my $docknode = $docked[0];
42
43 is($docknode->{rect}->{height}, 30, 'dock node has unchanged height');
44
45 # perform an inplace-restart
46 cmd 'restart';
47
48 sleep 0.25;
49
50 does_i3_live;
51
52
53 #####################################################################
54 # check that we can still find the dock client
55 #####################################################################
56
57 @docked = get_dock_clients;
58 is(@docked, 1, 'one dock client found');
59 $docknode = $docked[0];
60
61 is($docknode->{rect}->{height}, 30, 'dock node has unchanged height after restart');
62
63 $window->destroy;
64
65 wait_for_unmap $x;
66
67 @docked = get_dock_clients;
68 is(@docked, 0, 'no dock clients found');
69
70 #####################################################################
71 # create a dock client with a 1px border
72 #####################################################################
73
74 $window = open_window($x, {
75         border => 1,
76         rect => [ 0, 0, 30, 20 ],
77         background_color => '#00FF00',
78         window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
79     });
80
81 @docked = get_dock_clients;
82 is(@docked, 1, 'one dock client found');
83 $docknode = $docked[0];
84
85 is($docknode->{rect}->{height}, 20, 'dock node has unchanged height');
86
87 cmd 'restart';
88 sleep 0.25;
89
90 @docked = get_dock_clients;
91 is(@docked, 1, 'one dock client found');
92 $docknode = $docked[0];
93
94 is($docknode->{rect}->{height}, 20, 'dock node has unchanged height');
95
96
97 done_testing;