]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/210-mark-unmark.t
Introduce "--add" for marking windows.
[i3/i3] / testcases / t / 210-mark-unmark.t
index 99fc92c81a475543b362e7e891413cbb628509ab..446d54653f4f9e0cd57327630160fa43c5b27ae7 100644 (file)
@@ -18,6 +18,8 @@
 use i3test;
 use List::Util qw(first);
 
+my ($con, $first, $second);
+
 sub get_marks {
     return i3(get_socket_path())->get_marks->recv;
 }
@@ -26,7 +28,7 @@ sub get_mark_for_window_on_workspace {
     my ($ws, $con) = @_;
 
     my $current = first { $_->{window} == $con->{id} } @{get_ws_content($ws)};
-    return $current->{mark};
+    return $current->{marks};
 }
 
 ##############################################################
@@ -39,7 +41,6 @@ cmd 'split h';
 
 is_deeply(get_marks(), [], 'no marks set yet');
 
-
 ##############################################################
 # 2: mark a con, check that it's marked, unmark it, check that
 ##############################################################
@@ -89,21 +90,21 @@ is_deeply(get_marks(), [], 'all marks removed');
 #    check that only the latter is marked
 ##############################################################
 
-my $first = open_window;
-my $second = open_window;
+$first = open_window;
+$second = open_window;
 
 cmd 'mark important';
 cmd 'focus left';
 cmd 'mark important';
 
-is(get_mark_for_window_on_workspace($tmp, $first), 'important', 'first container now has the mark');
+is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'first container now has the mark');
 ok(!get_mark_for_window_on_workspace($tmp, $second), 'second container lost the mark');
 
 ##############################################################
 # 5: mark a con, toggle the mark, check that the mark is gone
 ##############################################################
 
-my $con = open_window;
+$con = open_window;
 cmd 'mark important';
 cmd 'mark --toggle important';
 ok(!get_mark_for_window_on_workspace($tmp, $con), 'container no longer has the mark');
@@ -112,33 +113,33 @@ ok(!get_mark_for_window_on_workspace($tmp, $con), 'container no longer has the m
 # 6: toggle a mark on an unmarked con, check it is marked
 ##############################################################
 
-my $con = open_window;
+$con = open_window;
 cmd 'mark --toggle important';
-is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container now has the mark');
+is_deeply(get_mark_for_window_on_workspace($tmp, $con), [ 'important' ], 'container now has the mark');
 
 ##############################################################
 # 7: mark a con, toggle a different mark, check it is marked
 #    with the new mark
 ##############################################################
 
-my $con = open_window;
+$con = open_window;
 cmd 'mark boring';
-cmd 'mark --toggle important';
-is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container has the most recent mark');
+cmd 'mark --replace --toggle important';
+is_deeply(get_mark_for_window_on_workspace($tmp, $con), [ 'important' ], 'container has the most recent mark');
 
 ##############################################################
 # 8: mark a con, toggle the mark on another con,
 #    check only the latter has the mark
 ##############################################################
 
-my $first = open_window;
-my $second = open_window;
+$first = open_window;
+$second = open_window;
 
 cmd 'mark important';
 cmd 'focus left';
 cmd 'mark --toggle important';
 
-is(get_mark_for_window_on_workspace($tmp, $first), 'important', 'left container has the mark now');
+is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'left container has the mark now');
 ok(!get_mark_for_window_on_workspace($tmp, $second), 'second containr no longer has the mark');
 
 ##############################################################
@@ -146,8 +147,8 @@ ok(!get_mark_for_window_on_workspace($tmp, $second), 'second containr no longer
 #    it fails
 ##############################################################
 
-my $first = open_window(wm_class => 'iamnotunique');
-my $second = open_window(wm_class => 'iamnotunique');
+$first = open_window(wm_class => 'iamnotunique');
+$second = open_window(wm_class => 'iamnotunique');
 
 my $result = cmd "[instance=iamnotunique] mark important";