2 # vim:ts=4:sw=4:expandtab
3 # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
5 # Tests the workspace_layout config option.
10 use X11::XCB::Connection;
12 my $x = X11::XCB::Connection->new;
14 #####################################################################
15 # 1: check that with an empty config, cons are place next to each
16 # other and no split containers are created
17 #####################################################################
21 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
24 my $pid = launch_with_config($config);
26 my $tmp = fresh_workspace;
28 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
30 my $first = open_window($x);
31 my $second = open_window($x);
35 is($x->input_focus, $second->id, 'second window focused');
36 ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
37 isnt($content[0]->{layout}, 'stacked', 'layout not stacked');
38 isnt($content[1]->{layout}, 'stacked', 'layout not stacked');
40 exit_gracefully($pid);
42 #####################################################################
43 # 2: set workspace_layout stacked, check that when opening two cons,
44 # they end up in a stacked con
45 #####################################################################
49 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
50 workspace_layout stacked
53 $pid = launch_with_config($config);
55 $tmp = fresh_workspace;
57 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
59 $first = open_window($x);
60 $second = open_window($x);
64 is($x->input_focus, $second->id, 'second window focused');
65 my @content = @{get_ws_content($tmp)};
66 ok(@content == 1, 'one con at workspace level');
67 is($content[0]->{layout}, 'stacked', 'layout stacked');
69 #####################################################################
70 # 3: focus parent, open two new cons, check that they end up in a stacked
72 #####################################################################
75 my $right_top = open_window($x);
76 my $right_bot = open_window($x);
78 @content = @{get_ws_content($tmp)};
79 is(@content, 2, 'two cons at workspace level after focus parent');
80 is($content[0]->{layout}, 'stacked', 'layout stacked');
81 is($content[1]->{layout}, 'stacked', 'layout stacked');
83 #####################################################################
84 # 4: move one of the cons to the right, check that it will end up in
86 #####################################################################
90 @content = @{get_ws_content($tmp)};
91 is(@content, 3, 'three cons at workspace level after move');
92 is($content[0]->{layout}, 'stacked', 'layout stacked');
93 is($content[1]->{layout}, 'stacked', 'layout stacked');
94 is($content[2]->{layout}, 'stacked', 'layout stacked');
96 #####################################################################
97 # 5: move it to the left again, check that the stacked con is deleted
98 #####################################################################
102 @content = @{get_ws_content($tmp)};
103 is(@content, 2, 'two cons at workspace level after moving back');
104 is($content[0]->{layout}, 'stacked', 'layout stacked');
105 is($content[1]->{layout}, 'stacked', 'layout stacked');
107 #####################################################################
108 # 6: move it to a different workspace, check that it ends up in a
110 #####################################################################
112 my $otmp = get_unused_workspace;
114 cmd "move workspace $otmp";
116 @content = @{get_ws_content($tmp)};
117 is(@content, 2, 'still two cons on this workspace');
118 is($content[0]->{layout}, 'stacked', 'layout stacked');
119 is($content[1]->{layout}, 'stacked', 'layout stacked');
121 @content = @{get_ws_content($otmp)};
122 is(@content, 1, 'one con on target workspace');
123 is($content[0]->{layout}, 'stacked', 'layout stacked');
125 exit_gracefully($pid);