]> git.sur5r.net Git - i3/i3/blob - testcases/t/46-floating-reinsert.t
Merge branch 'next'
[i3/i3] / testcases / t / 46-floating-reinsert.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 use X11::XCB qw(:all);
5 use Time::HiRes qw(sleep);
6 use i3test;
7
8 BEGIN {
9     use_ok('X11::XCB::Window');
10 }
11
12 my $x = X11::XCB::Connection->new;
13
14 my $tmp = fresh_workspace;
15
16 my $left = open_standard_window($x);
17 sleep 0.25;
18 my $mid = open_standard_window($x);
19 sleep 0.25;
20
21 cmd 'split v';
22 my $bottom = open_standard_window($x);
23 sleep 0.25;
24
25 my ($nodes, $focus) = get_ws_content($tmp);
26
27 #############################################################################
28 # 1: open a floating window, get it mapped
29 #############################################################################
30
31 my $x = X11::XCB::Connection->new;
32
33 # Create a floating window
34 my $window = $x->root->create_child(
35     class => WINDOW_CLASS_INPUT_OUTPUT,
36     rect => [ 0, 0, 30, 30],
37     background_color => '#C0C0C0',
38     # replace the type with 'utility' as soon as the coercion works again in X11::XCB
39     window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
40 );
41
42 isa_ok($window, 'X11::XCB::Window');
43
44 $window->map;
45
46 sleep 0.25;
47
48 ok($window->mapped, 'Window is mapped');
49
50 ($nodes, $focus) = get_ws_content($tmp);
51 is(@{$nodes->[1]->{nodes}}, 2, 'two windows in split con');
52
53 #############################################################################
54 # 2: make it tiling, see where it ends up
55 #############################################################################
56
57 cmd 'floating toggle';
58
59 my ($nodes, $focus) = get_ws_content($tmp);
60
61 is(@{$nodes->[1]->{nodes}}, 3, 'three windows in split con after floating toggle');
62
63 done_testing;