X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=blobdiff_plain;f=testcases%2Ft%2F141-resize.t;fp=testcases%2Ft%2F141-resize.t;h=5a264169c4367b9471cc34082592a62473a42465;hp=0e7fd526b75e9d450a532c92cfad26268d621d3d;hb=1847938d4eeba98260cc79ca45a11a134274c2ea;hpb=c54f5008395b10c046f380cc3069ff779e5d2877 diff --git a/testcases/t/141-resize.t b/testcases/t/141-resize.t index 0e7fd526..5a264169 100644 --- a/testcases/t/141-resize.t +++ b/testcases/t/141-resize.t @@ -141,6 +141,147 @@ cmp_float($nodes->[1]->{percent}, 0.166666666666667, 'second window got 16%'); cmp_float($nodes->[2]->{percent}, 0.166666666666667, 'third window got 16%'); cmp_float($nodes->[3]->{percent}, 0.50, 'fourth window got 50%'); +################################################################################ +# Same but using pixels instead of ppt. +################################################################################ + +# Use two windows +$tmp = fresh_workspace; + +$left = open_window; +$right = open_window; + +($nodes, $focus) = get_ws_content($tmp); +my @widths = ($nodes->[0]->{rect}->{width}, $nodes->[1]->{rect}->{width}); + +cmd 'resize grow width 10 px'; + +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{width}, $widths[0] - 10, 'left window is 10px smaller'); +cmp_float($nodes->[1]->{rect}->{width}, $widths[1] + 10, 'right window is 10px larger'); + +# Now test it with four windows +$tmp = fresh_workspace; + +open_window for (1..4); + +($nodes, $focus) = get_ws_content($tmp); +my $width = $nodes->[0]->{rect}->{width}; + +cmd 'resize grow width 10 px'; + +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[3]->{rect}->{width}, $width + 10, 'last window is 10px larger'); + +################################################################################ +# Same but for height +################################################################################ + +# Use two windows +$tmp = fresh_workspace; +cmd 'split v'; + +$left = open_window; +$right = open_window; + +($nodes, $focus) = get_ws_content($tmp); +my @heights = ($nodes->[0]->{rect}->{height}, $nodes->[1]->{rect}->{height}); + +cmd 'resize grow height 10 px'; + +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{height}, $heights[0] - 10, 'left window is 10px smaller'); +cmp_float($nodes->[1]->{rect}->{height}, $heights[1] + 10, 'right window is 10px larger'); + +# Now test it with four windows +$tmp = fresh_workspace; +cmd 'split v'; + +open_window for (1..4); + +($nodes, $focus) = get_ws_content($tmp); +my $height = $nodes->[0]->{rect}->{height}; + +cmd 'resize grow height 10 px'; + +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[3]->{rect}->{height}, $height + 10, 'last window is 10px larger'); + +################################################################################ +# Check that we can grow tiled windows by pixels +################################################################################ + +$tmp = fresh_workspace; + +$left = open_window; +$right = open_window; + +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{width}, 640, 'left window is 640px'); +cmp_float($nodes->[1]->{rect}->{width}, 640, 'right window is 640px'); + +cmd 'resize grow left 10px'; +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{width}, 630, 'left window is 630px'); +cmp_float($nodes->[1]->{rect}->{width}, 650, 'right window is 650px'); + +################################################################################ +# Check that we can shrink tiled windows by pixels +################################################################################ + +$tmp = fresh_workspace; + +$left = open_window; +$right = open_window; + +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{width}, 640, 'left window is 640px'); +cmp_float($nodes->[1]->{rect}->{width}, 640, 'right window is 640px'); + +cmd 'resize shrink left 10px'; +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{width}, 650, 'left window is 650px'); +cmp_float($nodes->[1]->{rect}->{width}, 630, 'right window is 630px'); + + +################################################################################ +# Check that we can shrink vertical tiled windows by pixels +################################################################################ + +$tmp = fresh_workspace; + +cmd 'split v'; + +$top = open_window; +$bottom = open_window; + +($nodes, $focus) = get_ws_content($tmp); +my @heights = ($nodes->[0]->{rect}->{height}, $nodes->[1]->{rect}->{height}); + +cmd 'resize grow up 10px'; +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{height}, $heights[0] - 10, 'top window is 10px larger'); +cmp_float($nodes->[1]->{rect}->{height}, $heights[1] + 10, 'bottom window is 10px smaller'); + +################################################################################ +# Check that we can shrink vertical tiled windows by pixels +################################################################################ + +$tmp = fresh_workspace; + +cmd 'split v'; + +$top = open_window; +$bottom = open_window; + +($nodes, $focus) = get_ws_content($tmp); +my @heights = ($nodes->[0]->{rect}->{height}, $nodes->[1]->{rect}->{height}); + +cmd 'resize shrink up 10px'; +($nodes, $focus) = get_ws_content($tmp); +cmp_float($nodes->[0]->{rect}->{height}, $heights[0] + 10, 'top window is 10px smaller'); +cmp_float($nodes->[1]->{rect}->{height}, $heights[1] - 10, 'bottom window is 10px larger'); + ################################################################################ # Check that the resize grow/shrink width/height syntax works if a nested split # was set on the container, but no sibling has been opened yet. See #2015.