]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/124-move.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 124-move.t
index 4df3a2a1fe951ee840ef38ff672bdcbf7ea32a4c..a078a9e842f5f4454dc71ecd7ac8864c611e515c 100644 (file)
@@ -24,13 +24,13 @@ is(@{$old_content}, 1, 'one container on this workspace');
 
 my $first = $old_content->[0]->{id};
 
-#cmd 'move before h';
-#cmd 'move before v';
-#cmd 'move after v';
-#cmd 'move after h';
+cmd 'move left';
+cmd 'move right';
+cmd 'move up';
+cmd 'move down';
 
 my $content = get_ws_content($tmp);
-#is_deeply($old_content, $content, 'workspace unmodified after useless moves');
+is_deeply($old_content, $content, 'workspace unmodified after useless moves');
 
 ######################################################################
 # 2) move a container before another single container
@@ -131,4 +131,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;
+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;