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);
19 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 floating windows works
51 ############################################################
53 $tmp = fresh_workspace;
55 $top = open_standard_window($x);
58 cmd 'floating enable';
60 my @content = @{get_ws($tmp)->{floating_nodes}};
61 cmp_ok(@content, '==', 1, 'one floating node on this ws');
64 my $oldrect = $content[0]->{rect};
66 cmd 'resize grow up 10 px or 25 ppt';
68 @content = @{get_ws($tmp)->{floating_nodes}};
69 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
70 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 10, 'y exactly 10 px smaller');
71 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
72 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
73 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 10, 'height exactly 10 px higher');
74 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
76 # up, but with a different amount of px
77 $oldrect = $content[0]->{rect};
79 cmd 'resize grow up 12 px or 25 ppt';
81 @content = @{get_ws($tmp)->{floating_nodes}};
82 cmp_ok($content[0]->{rect}->{y}, '<', $oldrect->{y}, 'y smaller than before');
83 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y} - 12, 'y exactly 10 px smaller');
84 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x untouched');
85 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
86 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height} + 12, 'height exactly 10 px higher');
87 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'x untouched');
90 $oldrect = $content[0]->{rect};
92 cmd 'resize grow left 10 px or 25 ppt';
94 @content = @{get_ws($tmp)->{floating_nodes}};
95 cmp_ok($content[0]->{rect}->{x}, '<', $oldrect->{x}, 'x smaller than before');
96 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
99 $oldrect = $content[0]->{rect};
101 cmd 'resize grow right 10 px or 25 ppt';
103 @content = @{get_ws($tmp)->{floating_nodes}};
104 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
105 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
106 cmp_ok($content[0]->{rect}->{width}, '>', $oldrect->{width}, 'width bigger than before');
107 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height}, 'height the same as before');
110 $oldrect = $content[0]->{rect};
112 cmd 'resize grow down 10 px or 25 ppt';
114 @content = @{get_ws($tmp)->{floating_nodes}};
115 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x the same as before');
116 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y the same as before');
117 cmp_ok($content[0]->{rect}->{height}, '>', $oldrect->{height}, 'height bigger than before');
118 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'width the same as before');