2 # vim:ts=4:sw=4:expandtab
3 # Tests resizing tiling containers
6 my $tmp = fresh_workspace;
10 my $top = open_window($x);
11 my $bottom = open_window($x);
15 diag("top = " . $top->id . ", bottom = " . $bottom->id);
17 is($x->input_focus, $bottom->id, 'Bottom window focused');
19 ############################################################
21 ############################################################
23 cmd 'resize grow up 10 px or 25 ppt';
25 my ($nodes, $focus) = get_ws_content($tmp);
27 is($nodes->[0]->{percent}, 0.25, 'top window got only 25%');
28 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
31 ############################################################
32 # split and check if the 'percent' factor is still correct
33 ############################################################
37 ($nodes, $focus) = get_ws_content($tmp);
39 is($nodes->[0]->{percent}, 0.25, 'top window got only 25%');
40 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
42 ############################################################
43 # checks that resizing within stacked/tabbed cons works
44 ############################################################
46 $tmp = fresh_workspace;
50 $top = open_window($x);
51 $bottom = open_window($x);
56 ($nodes, $focus) = get_ws_content($tmp);
57 is($nodes->[0]->{percent}, 0.5, 'top window got 50%');
58 is($nodes->[1]->{percent}, 0.5, 'bottom window got 50%');
60 cmd 'resize grow up 10 px or 25 ppt';
62 ($nodes, $focus) = get_ws_content($tmp);
63 is($nodes->[0]->{percent}, 0.25, 'top window got 25%');
64 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
66 ############################################################
67 # checks that resizing floating windows works
68 ############################################################
70 $tmp = fresh_workspace;
72 $top = open_window($x);
74 cmd 'floating enable';
76 my @content = @{get_ws($tmp)->{floating_nodes}};
77 cmp_ok(@content, '==', 1, 'one floating node on this ws');
80 my $oldrect = $content[0]->{rect};
82 cmd 'resize grow up 10 px or 25 ppt';
84 @content = @{get_ws($tmp)->{floating_nodes}};
85 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
86 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 10, 'y exactly 10 px smaller');
87 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
88 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
89 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 10, 'height exactly 10 px higher');
90 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
92 # up, but with a different amount of px
93 $oldrect = $content[0]->{rect};
95 cmd 'resize grow up 12 px or 25 ppt';
97 @content = @{get_ws($tmp)->{floating_nodes}};
98 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
99 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 12, 'y exactly 10 px smaller');
100 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
101 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
102 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 12, 'height exactly 10 px higher');
103 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
106 $oldrect = $content[0]->{rect};
108 cmd 'resize grow left 10 px or 25 ppt';
110 @content = @{get_ws($tmp)->{floating_nodes}};
111 cmp_ok($content[0]->{rect}->{x}, '<', $oldrect->{x}, 'x smaller than before');
112 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
115 $oldrect = $content[0]->{rect};
117 cmd 'resize grow right 10 px or 25 ppt';
119 @content = @{get_ws($tmp)->{floating_nodes}};
120 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
121 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
122 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
123 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height}, 'height the same as before');
126 $oldrect = $content[0]->{rect};
128 cmd 'resize grow down 10 px or 25 ppt';
130 @content = @{get_ws($tmp)->{floating_nodes}};
131 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
132 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
133 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
134 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'width the same as before');