]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/185-scratchpad.t
Merge pull request #1805 from lasers/next
[i3/i3] / testcases / t / 185-scratchpad.t
index 6ee877bd288dd22625888fec93b861903a0995b8..eeaee449f96108420082087243d16d8a1a4b2fe2 100644 (file)
@@ -35,7 +35,7 @@ is($tree->{name}, 'root', 'root node is the first thing we get');
 my @__i3 = grep { $_->{name} eq '__i3' } @{$tree->{nodes}};
 is(scalar @__i3, 1, 'output __i3 found');
 
-my $content = first { $_->{type} == 2 } @{$__i3[0]->{nodes}};
+my $content = first { $_->{type} eq 'con' } @{$__i3[0]->{nodes}};
 my @workspaces = @{$content->{nodes}};
 my @workspace_names = map { $_->{name} } @workspaces;
 ok('__i3_scratch' ~~ @workspace_names, '__i3_scratch workspace found');
@@ -377,7 +377,7 @@ sub verify_scratchpad_move_with_visible_scratch_con {
     # this should bring up window 1
     cmd 'scratchpad show';
 
-    my $ws = get_ws($first);
+    $ws = get_ws($first);
     is(scalar @{$ws->{floating_nodes}}, 1, 'one floating node on ws1');
     is($x->input_focus, $window1->id, "showed the correct scratchpad window1");
 
@@ -446,4 +446,29 @@ is(get_focused($ws), $scratch, 'scratchpad is focused');
 
 # TODO: make i3bar display *something* when a window on the scratchpad has the urgency hint
 
+################################################################################
+# 14: Verify that 'move scratchpad' sends floating containers to scratchpad but
+# does not resize/resposition the container on the next 'scratchpad show', i.e.,
+# i3 sets the scratchpad flag to SCRATCHPAD_CHANGED
+################################################################################
+
+clear_scratchpad;
+$tmp = fresh_workspace;
+open_window;
+
+($nodes, $focus) = get_ws_content($tmp);
+is(scalar @$nodes, 1, 'precisely one window on current ws');
+is($nodes->[0]->{scratchpad_state}, 'none', 'scratchpad_state none');
+
+cmd 'floating toggle';
+cmd 'move scratchpad';
+
+$__i3_scratch = get_ws('__i3_scratch');
+@scratch_nodes = @{$__i3_scratch->{floating_nodes}};
+is(scalar @scratch_nodes, 1, '__i3_scratch contains our window');
+($nodes, $focus) = get_ws_content($tmp);
+is(scalar @$nodes, 0, 'no window on current ws anymore');
+
+is($scratch_nodes[0]->{scratchpad_state}, 'changed', 'scratchpad_state changed');
+
 done_testing;