X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=testcases%2Ft%2F124-move.t;h=88a36a5b333fc67d38da8019247a4fa5662b3b4a;hb=5d1bb0b0ce0dcce063c5e63e0533e7805ec856df;hp=c093e47b92ed877cef17d06c5cc1bfb368e9705d;hpb=8d2799c251cc1c44f1429c36817c346fa56b9701;p=i3%2Fi3 diff --git a/testcases/t/124-move.t b/testcases/t/124-move.t index c093e47b..88a36a5b 100644 --- a/testcases/t/124-move.t +++ b/testcases/t/124-move.t @@ -1,6 +1,19 @@ #!perl # vim:ts=4:sw=4:expandtab # +# Please read the following documents before working on tests: +# • http://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • http://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • http://build.i3wm.org/docs/ipc.html +# (or docs/ipc) +# +# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf +# (unless you are already familiar with Perl) +# # Tests moving. Basically, there are four different code-paths: # 1) move a container which cannot be moved (single container on a workspace) # 2) move a container before another single container @@ -138,6 +151,8 @@ my ($absolute_before, $top_before) = $floatwin->rect; cmd 'move left'; +sync_with_i3; + my ($absolute, $top) = $floatwin->rect; is($absolute->x, ($absolute_before->x - 10), 'moved 10 px to the left'); @@ -150,6 +165,8 @@ $top_before = $top; cmd 'move right'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, ($absolute_before->x + 10), 'moved 10 px to the right'); @@ -162,6 +179,8 @@ $top_before = $top; cmd 'move up'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, $absolute_before->x, 'x not changed'); @@ -174,6 +193,8 @@ $top_before = $top; cmd 'move down'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, $absolute_before->x, 'x not changed'); @@ -190,6 +211,8 @@ $top_before = $top; cmd 'move left 20 px'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, ($absolute_before->x - 20), 'moved 20 px to the left'); @@ -222,4 +245,20 @@ my $center_y = int($x->root->rect->height/2) - int($floatcon[0]->{rect}->{height is($floatcon[0]->{rect}->{x}, $center_x, "moved to center at position $center_x x"); is($floatcon[0]->{rect}->{y}, $center_y, "moved to center at position $center_y y"); +# Make sure the command works with criteria +open_floating_window; + +@floatcon = @{get_ws($tmp)->{floating_nodes}}; + +cmd '[con_id="' . $floatcon[0]->{nodes}[0]->{id} . '"] move position 25 px 30 px'; +cmd '[con_id="' . $floatcon[1]->{nodes}[0]->{id} . '"] move position 35 px 40 px'; + +@floatcon = @{get_ws($tmp)->{floating_nodes}}; + +is($floatcon[0]->{rect}->{x}, 25, 'moved to position 25 x with criteria'); +is($floatcon[0]->{rect}->{y}, 30, 'moved to position 30 y with criteria'); + +is($floatcon[1]->{rect}->{x}, 35, 'moved to position 35 x with criteria'); +is($floatcon[1]->{rect}->{y}, 40, 'moved to position 40 y with criteria'); + done_testing;