2 # vim:ts=4:sw=4:expandtab
6 my $tmp = fresh_workspace;
8 #############################################################################
9 # 1: see if focus stays the same when toggling tiling/floating mode
10 #############################################################################
15 my @content = @{get_ws_content($tmp)};
16 cmp_ok(@content, '==', 2, 'two containers opened');
17 cmp_ok($content[1]->{focused}, '==', 1, 'Second container focused');
22 @content = @{get_ws_content($tmp)};
23 cmp_ok($content[1]->{focused}, '==', 1, 'Second container still focused after mode toggle');
25 #############################################################################
26 # 2: see if the focus gets reverted correctly when closing floating clients
27 # (first to the next floating client, then to the last focused tiling client)
28 #############################################################################
30 $tmp = fresh_workspace;
36 @content = @{get_ws_content($tmp)};
37 cmp_ok(@content, '==', 3, 'two containers opened');
38 cmp_ok($content[2]->{focused}, '==', 1, 'Last container focused');
40 my $last_id = $content[2]->{id};
41 my $second_id = $content[1]->{id};
42 my $first_id = $content[0]->{id};
43 diag("last_id = $last_id, second_id = $second_id, first_id = $first_id");
45 cmd qq|[con_id="$second_id"] focus|;
46 @content = @{get_ws_content($tmp)};
47 cmp_ok($content[1]->{focused}, '==', 1, 'Second container focused');
51 cmd qq|[con_id="$last_id"] focus|;
52 @content = @{get_ws_content($tmp)};
53 cmp_ok($content[1]->{focused}, '==', 1, 'Last container focused');
57 diag("focused = " . get_focused($tmp));
61 diag("focused = " . get_focused($tmp));
62 # TODO: this test result is actually not right. the focus reverts to where the mouse pointer is.
63 cmp_ok(get_focused($tmp), '==', $second_id, 'Focus reverted to second floating container');
66 @content = @{get_ws_content($tmp)};
67 cmp_ok($content[0]->{focused}, '==', 1, 'Focus reverted to tiling container');