2 # vim:ts=4:sw=4:expandtab
3 # Tests resizing tiling containers
8 use_ok('X11::XCB::Window');
11 my $x = X11::XCB::Connection->new;
13 my $tmp = fresh_workspace;
17 my $top = open_standard_window($x);
18 my $bottom = open_standard_window($x);
22 diag("top = " . $top->id . ", bottom = " . $bottom->id);
24 is($x->input_focus, $bottom->id, 'Bottom window focused');
26 ############################################################
28 ############################################################
30 cmd 'resize grow up 10 px or 25 ppt';
32 my ($nodes, $focus) = get_ws_content($tmp);
34 is($nodes->[0]->{percent}, 0.25, 'top window got only 25%');
35 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
38 ############################################################
39 # split and check if the 'percent' factor is still correct
40 ############################################################
44 ($nodes, $focus) = get_ws_content($tmp);
46 is($nodes->[0]->{percent}, 0.25, 'top window got only 25%');
47 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
49 ############################################################
50 # checks that resizing within stacked/tabbed cons works
51 ############################################################
53 $tmp = fresh_workspace;
57 $top = open_standard_window($x);
58 $bottom = open_standard_window($x);
63 ($nodes, $focus) = get_ws_content($tmp);
64 is($nodes->[0]->{percent}, 0.5, 'top window got 50%');
65 is($nodes->[1]->{percent}, 0.5, 'bottom window got 50%');
67 cmd 'resize grow up 10 px or 25 ppt';
69 ($nodes, $focus) = get_ws_content($tmp);
70 is($nodes->[0]->{percent}, 0.25, 'top window got 25%');
71 is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
73 ############################################################
74 # checks that resizing floating windows works
75 ############################################################
77 $tmp = fresh_workspace;
79 $top = open_standard_window($x);
81 cmd 'floating enable';
83 my @content = @{get_ws($tmp)->{floating_nodes}};
84 cmp_ok(@content, '==', 1, 'one floating node on this ws');
87 my $oldrect = $content[0]->{rect};
89 cmd 'resize grow up 10 px or 25 ppt';
91 @content = @{get_ws($tmp)->{floating_nodes}};
92 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
93 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 10, 'y exactly 10 px smaller');
94 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
95 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
96 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 10, 'height exactly 10 px higher');
97 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
99 # up, but with a different amount of px
100 $oldrect = $content[0]->{rect};
102 cmd 'resize grow up 12 px or 25 ppt';
104 @content = @{get_ws($tmp)->{floating_nodes}};
105 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
106 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 12, 'y exactly 10 px smaller');
107 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
108 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
109 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 12, 'height exactly 10 px higher');
110 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
113 $oldrect = $content[0]->{rect};
115 cmd 'resize grow left 10 px or 25 ppt';
117 @content = @{get_ws($tmp)->{floating_nodes}};
118 cmp_ok($content[0]->{rect}->{x}, '<', $oldrect->{x}, 'x smaller than before');
119 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
122 $oldrect = $content[0]->{rect};
124 cmd 'resize grow right 10 px or 25 ppt';
126 @content = @{get_ws($tmp)->{floating_nodes}};
127 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
128 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
129 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
130 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height}, 'height the same as before');
133 $oldrect = $content[0]->{rect};
135 cmd 'resize grow down 10 px or 25 ppt';
137 @content = @{get_ws($tmp)->{floating_nodes}};
138 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
139 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
140 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
141 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'width the same as before');