]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/100-fullscreen.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 100-fullscreen.t
index dc7eec188a01a0f619906e3e6bc6c7fc97bddd54..f8fc92a24aee749c58bbd58d31c3383e6a3d8e86 100644 (file)
@@ -2,7 +2,6 @@
 # vim:ts=4:sw=4:expandtab
 
 use i3test;
-use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT';
 use List::Util qw(first);
 
 my $i3 = i3(get_socket_path());
@@ -32,11 +31,9 @@ for my $o (@outputs) {
 
 my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
 
-my $window = $x->root->create_child(
-    class => WINDOW_CLASS_INPUT_OUTPUT,
+my $window = open_window(
     rect => $original_rect,
-    background_color => '#C0C0C0',
-    event_mask => [ 'structure_notify' ],
+    dont_map => 1,
 );
 
 isa_ok($window, 'X11::XCB::Window');
@@ -51,7 +48,7 @@ wait_for_map $window;
 cmd 'open';
 
 my $new_rect = $window->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
 $original_rect = $new_rect;
 
 $window->fullscreen(1);
@@ -59,7 +56,7 @@ $window->fullscreen(1);
 sync_with_i3;
 
 $new_rect = $window->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
 
 my $orect = $output->{rect};
 my $wrect = $new_rect;
@@ -83,11 +80,9 @@ $window->unmap;
 cmd 'open';
 
 $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
-$window = $x->root->create_child(
-    class => WINDOW_CLASS_INPUT_OUTPUT,
+$window = open_window(
     rect => $original_rect,
-    background_color => 61440,
-    event_mask => [ 'structure_notify' ],
+    dont_map => 1,
 );
 
 is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
@@ -98,7 +93,7 @@ $window->map;
 wait_for_map $window;
 
 $new_rect = $window->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
 ok($window->mapped, "Window is mapped after opening it in fullscreen mode");
 
 $wrect = $new_rect;
@@ -114,11 +109,9 @@ ok(abs($wrect->{height} - $orect->{height}) < $threshold, 'height coordinate ful
 ###############################################################################
 
 $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
-my $swindow = $x->root->create_child(
-    class => WINDOW_CLASS_INPUT_OUTPUT,
+my $swindow = open_window(
     rect => $original_rect,
-    background_color => '#C0C0C0',
-    event_mask => [ 'structure_notify' ],
+    dont_map => 1,
 );
 
 $swindow->map;
@@ -128,7 +121,7 @@ sync_with_i3;
 ok(!$swindow->mapped, 'window not mapped while fullscreen window active');
 
 $new_rect = $swindow->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
 
 $swindow->fullscreen(1);
 sync_with_i3;
@@ -163,4 +156,22 @@ is(fullscreen_windows(), 0, 'amount of fullscreen windows after fullscreen comma
 # clean up the workspace so that it will be cleaned when switching away
 cmd 'kill' for (@{get_ws_content($tmp)});
 
+################################################################################
+# Verify that changing focus while in fullscreen does not work.
+################################################################################
+
+$tmp = fresh_workspace;
+
+my $other = open_window;
+is($x->input_focus, $other->id, 'other window focused');
+
+$window = open_window;
+is($x->input_focus, $window->id, 'window focused');
+
+cmd 'fullscreen';
+is($x->input_focus, $window->id, 'fullscreen window focused');
+
+cmd 'focus left';
+is($x->input_focus, $window->id, 'fullscreen window still focused');
+
 done_testing;