]> git.sur5r.net Git - i3/i3/blob - testcases/t/27-regress-floating-parent.t
0074af6fac9d95f43e8befe16661f7e49024a3c3
[i3/i3] / testcases / t / 27-regress-floating-parent.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Regression: make a container floating, kill its parent, make it tiling again
5 #
6 use i3test tests => 4;
7 use X11::XCB qw(:all);
8
9 my $i3 = i3("/tmp/nestedcons");
10
11 my $tmp = get_unused_workspace();
12 $i3->command("workspace $tmp")->recv;
13
14 $i3->command('open')->recv;
15 my $left = get_focused($tmp);
16 $i3->command('open')->recv;
17 my $old = get_focused($tmp);
18 $i3->command('split v')->recv;
19 $i3->command('open')->recv;
20 my $floating = get_focused($tmp);
21 diag("focused floating: " . get_focused($tmp));
22 $i3->command('mode toggle')->recv;
23 # TODO: eliminate this race conditition
24 sleep 1;
25
26 # kill old container
27 $i3->command(qq|[con_id="$old"] focus|)->recv;
28 is(get_focused($tmp), $old, 'old container focused');
29 $i3->command('kill')->recv;
30
31 # kill left container
32 $i3->command(qq|[con_id="$left"] focus|)->recv;
33 is(get_focused($tmp), $left, 'old container focused');
34 $i3->command('kill')->recv;
35
36 # focus floating window, make it tiling again
37 $i3->command(qq|[con_id="$floating"] focus|)->recv;
38 is(get_focused($tmp), $floating, 'floating window focused');
39
40 sleep 1;
41 $i3->command('mode toggle')->recv;
42
43 my $tree = $i3->get_tree->recv;
44 my @nodes = @{$tree->{nodes}};
45 ok(@nodes > 0, 'i3 still lives');
46
47 diag( "Testing i3, Perl $], $^X" );