2 # vim:ts=4:sw=4:expandtab
3 # Tests resizing tiling containers
6 my $tmp = fresh_workspace;
10 my $top = open_window;
11 my $bottom = open_window;
13 diag("top = " . $top->id . ", bottom = " . $bottom->id);
15 is($x->input_focus, $bottom->id, 'Bottom window focused');
17 ############################################################
19 ############################################################
21 cmd 'resize grow up 10 px or 25 ppt';
23 my ($nodes, $focus) = get_ws_content($tmp);
25 is($nodes->[0]->{percent}, 0.25, 'top window got only 25%');
26 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
29 ############################################################
30 # split and check if the 'percent' factor is still correct
31 ############################################################
35 ($nodes, $focus) = get_ws_content($tmp);
37 is($nodes->[0]->{percent}, 0.25, 'top window got only 25%');
38 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
40 ############################################################
41 # checks that resizing within stacked/tabbed cons works
42 ############################################################
44 $tmp = fresh_workspace;
49 $bottom = open_window;
54 ($nodes, $focus) = get_ws_content($tmp);
55 is($nodes->[0]->{percent}, 0.5, 'top window got 50%');
56 is($nodes->[1]->{percent}, 0.5, 'bottom window got 50%');
58 cmd 'resize grow up 10 px or 25 ppt';
60 ($nodes, $focus) = get_ws_content($tmp);
61 is($nodes->[0]->{percent}, 0.25, 'top window got 25%');
62 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
64 ############################################################
65 # checks that resizing floating windows works
66 ############################################################
68 $tmp = fresh_workspace;
72 cmd 'floating enable';
74 my @content = @{get_ws($tmp)->{floating_nodes}};
75 cmp_ok(@content, '==', 1, 'one floating node on this ws');
78 my $oldrect = $content[0]->{rect};
80 cmd 'resize grow up 10 px or 25 ppt';
82 @content = @{get_ws($tmp)->{floating_nodes}};
83 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
84 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 10, 'y exactly 10 px smaller');
85 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
86 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
87 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 10, 'height exactly 10 px higher');
88 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
90 # up, but with a different amount of px
91 $oldrect = $content[0]->{rect};
93 cmd 'resize grow up 12 px or 25 ppt';
95 @content = @{get_ws($tmp)->{floating_nodes}};
96 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
97 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 12, 'y exactly 10 px smaller');
98 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
99 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
100 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 12, 'height exactly 10 px higher');
101 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
104 $oldrect = $content[0]->{rect};
106 cmd 'resize grow left 10 px or 25 ppt';
108 @content = @{get_ws($tmp)->{floating_nodes}};
109 cmp_ok($content[0]->{rect}->{x}, '<', $oldrect->{x}, 'x smaller than before');
110 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
113 $oldrect = $content[0]->{rect};
115 cmd 'resize grow right 10 px or 25 ppt';
117 @content = @{get_ws($tmp)->{floating_nodes}};
118 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
119 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
120 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
121 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height}, 'height the same as before');
124 $oldrect = $content[0]->{rect};
126 cmd 'resize grow down 10 px or 25 ppt';
128 @content = @{get_ws($tmp)->{floating_nodes}};
129 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
130 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
131 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
132 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'width the same as before');