]> git.sur5r.net Git - i3/i3/blob - testcases/t/186-regress-assign-focus-parent.t
Merge branch 'fix-assignment-open'
[i3/i3] / testcases / t / 186-regress-assign-focus-parent.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Regression test: New windows were not opened in the correct place if they
5 # matched an assignment.
6 # Wrong behaviour manifested itself up to (including) commit
7 # f78caf8c5815ae7a66de9e4b734546fd740cc19d
8 #
9 use i3test i3_autostart => 0;
10
11 my $config = <<EOT;
12 # i3 config file (v4)
13 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
14
15 assign [title="testcase"] targetws
16 EOT
17
18 my $pid = launch_with_config($config);
19
20 my $i3 = i3(get_socket_path(0));
21
22 cmd 'workspace targetws';
23
24 open_window(name => "testcase");
25
26 my $nodes = get_ws_content('targetws');
27 is(scalar @$nodes, 1, 'precisely one window');
28
29 open_window(name => "testcase");
30
31 $nodes = get_ws_content('targetws');
32 is(scalar @$nodes, 2, 'precisely two windows');
33
34 cmd 'split v';
35
36 open_window(name => "testcase");
37
38 $nodes = get_ws_content('targetws');
39 is(scalar @$nodes, 2, 'still two windows');
40
41 # focus parent. the new window should now be opened right next to the last one.
42 cmd 'focus parent';
43
44 open_window(name => "testcase");
45
46 $nodes = get_ws_content('targetws');
47 is(scalar @$nodes, 3, 'new window opened next to last one');
48
49 exit_gracefully($pid);
50
51 done_testing;