]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/202-scratchpad-criteria.t
Merge pull request #3435 from vivien/i3-msg/subscribe
[i3/i3] / testcases / t / 202-scratchpad-criteria.t
index 5ba8bfdddcdbd5d74067df85ab87a16fa4e9518d..9d86be9443c54590a0d6463d744b9dff63d926d2 100644 (file)
@@ -2,13 +2,13 @@
 # vim:ts=4:sw=4:expandtab
 #
 # Please read the following documents before working on tests:
-# • http://build.i3wm.org/docs/testsuite.html
+# • https://build.i3wm.org/docs/testsuite.html
 #   (or docs/testsuite)
 #
-# • http://build.i3wm.org/docs/lib-i3test.html
+# • https://build.i3wm.org/docs/lib-i3test.html
 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
 #
-# • http://build.i3wm.org/docs/ipc.html
+# • https://build.i3wm.org/docs/ipc.html
 #   (or docs/ipc)
 #
 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
@@ -17,6 +17,8 @@
 # Verifies that using criteria to address scratchpad windows works.
 use i3test;
 
+my $i3 = i3(get_socket_path());
+
 #####################################################################
 # Verify that using scratchpad show with criteria works as expected:
 # - When matching a scratchpad window which is visible,
@@ -51,6 +53,22 @@ cmd '[title="scratch-match"] scratchpad show';
 my $scratch_focus = get_focused($tmp);
 isnt($scratch_focus, $old_focus, 'matching criteria works');
 
+# Check that the window was centered and resized too.
+my $tree = $i3->get_tree->recv;
+my $ws = get_ws($tmp);
+my $scratchrect = $ws->{floating_nodes}->[0]->{rect};
+my $output = $tree->{nodes}->[1];
+my $outputrect = $output->{rect};
+
+is($scratchrect->{width}, $outputrect->{width} * 0.5, 'scratch width is 50%');
+is($scratchrect->{height}, $outputrect->{height} * 0.75, 'scratch height is 75%');
+is($scratchrect->{x},
+   ($outputrect->{width} / 2) - ($scratchrect->{width} / 2),
+   'scratch window centered horizontally');
+is($scratchrect->{y},
+   ($outputrect->{height} / 2 ) - ($scratchrect->{height} / 2),
+   'scratch window centered vertically');
+
 cmd '[title="scratch-match"] scratchpad show';
 
 isnt(get_focused($tmp), $scratch_focus, 'matching criteria works');