From: Michael Stapelberg Date: Thu, 27 Oct 2011 20:46:01 +0000 (+0100) Subject: extend t/124-move.t to test move for floating containers X-Git-Tag: 4.1~40^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=edfa9febae7cecd7743cecfaf27f6cb4f71d9d50;p=i3%2Fi3 extend t/124-move.t to test move for floating containers --- diff --git a/testcases/t/124-move.t b/testcases/t/124-move.t index 936693fe..a6eb6164 100644 --- a/testcases/t/124-move.t +++ b/testcases/t/124-move.t @@ -8,7 +8,9 @@ # 4) move a container in a different direction so that we need to go up in tree # use i3test; +use X11::XCB::Connection; +my $x = X11::XCB::Connection->new; my $i3 = i3(get_socket_path()); my $tmp = fresh_workspace; @@ -131,4 +133,75 @@ cmd "move right"; $content = get_ws_content($otmp); is(@{$content}, 1, 'only one nodes on this workspace'); +###################################################################### +# 5) test moving floating containers. +###################################################################### + +$tmp = fresh_workspace; +my $floatwin = open_floating_window($x); +my ($absolute_before, $top_before) = $floatwin->rect; + +cmd 'move left'; + +my ($absolute, $top) = $floatwin->rect; + +is($absolute->x, ($absolute_before->x - 10), 'moved 10 px to the left'); +is($absolute->y, $absolute_before->y, 'y not changed'); +is($absolute->width, $absolute_before->width, 'width not changed'); +is($absolute->height, $absolute_before->height, 'height not changed'); + +$absolute_before = $absolute; +$top_before = $top; + +cmd 'move right'; + +($absolute, $top) = $floatwin->rect; + +is($absolute->x, ($absolute_before->x + 10), 'moved 10 px to the right'); +is($absolute->y, $absolute_before->y, 'y not changed'); +is($absolute->width, $absolute_before->width, 'width not changed'); +is($absolute->height, $absolute_before->height, 'height not changed'); + +$absolute_before = $absolute; +$top_before = $top; + +cmd 'move up'; + +($absolute, $top) = $floatwin->rect; + +is($absolute->x, $absolute_before->x, 'x not changed'); +is($absolute->y, ($absolute_before->y - 10), 'moved 10 px up'); +is($absolute->width, $absolute_before->width, 'width not changed'); +is($absolute->height, $absolute_before->height, 'height not changed'); + +$absolute_before = $absolute; +$top_before = $top; + +cmd 'move down'; + +($absolute, $top) = $floatwin->rect; + +is($absolute->x, $absolute_before->x, 'x not changed'); +is($absolute->y, ($absolute_before->y + 10), 'moved 10 px up'); +is($absolute->width, $absolute_before->width, 'width not changed'); +is($absolute->height, $absolute_before->height, 'height not changed'); + +$absolute_before = $absolute; +$top_before = $top; + +###################################################################### +# 6) test moving floating containers with a specific amount of px +###################################################################### + +cmd 'move left 20 px'; + +($absolute, $top) = $floatwin->rect; + +is($absolute->x, ($absolute_before->x - 20), 'moved 10 px to the left'); +is($absolute->y, $absolute_before->y, 'y not changed'); +is($absolute->width, $absolute_before->width, 'width not changed'); +is($absolute->height, $absolute_before->height, 'height not changed'); + + + done_testing;