X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=testcases%2Ft%2F173-regress-focus-assign.t;h=b010963b1231cc391535e561d2df37d421235669;hb=5d1bb0b0ce0dcce063c5e63e0533e7805ec856df;hp=65fcd82982c3fddb5034189faec604b8b3650257;hpb=9cec9e09ed0d74c037018c30e8b25a27559baba7;p=i3%2Fi3 diff --git a/testcases/t/173-regress-focus-assign.t b/testcases/t/173-regress-focus-assign.t index 65fcd829..b010963b 100644 --- a/testcases/t/173-regress-focus-assign.t +++ b/testcases/t/173-regress-focus-assign.t @@ -1,40 +1,37 @@ #!perl # vim:ts=4:sw=4:expandtab # +# Please read the following documents before working on tests: +# • http://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • http://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • http://build.i3wm.org/docs/ipc.html +# (or docs/ipc) +# +# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf +# (unless you are already familiar with Perl) +# # Regression: Checks if focus is stolen when a window is managed which is # assigned to an invisible workspace # use i3test i3_autostart => 0; -use X11::XCB qw(PROP_MODE_REPLACE); - -# TODO: move to X11::XCB -sub set_wm_class { - my ($id, $class, $instance) = @_; - - # Add a _NET_WM_STRUT_PARTIAL hint - my $atomname = $x->atom(name => 'WM_CLASS'); - my $atomtype = $x->atom(name => 'STRING'); - - $x->change_property( - PROP_MODE_REPLACE, - $id, - $atomname->id, - $atomtype->id, - 8, - length($class) + length($instance) + 2, - "$instance\x00$class\x00" - ); -} sub open_special { my %args = @_; - my $wm_class = delete($args{wm_class}) || 'special'; $args{name} //= 'special window'; - return open_window( + # We use dont_map because i3 will not map the window on the current + # workspace. Thus, open_window would time out in wait_for_map (2 seconds). + my $window = open_window( %args, - before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) }, + wm_class => 'special', + dont_map => 1, ); + $window->map; + return $window; } ##################################################################### @@ -44,7 +41,7 @@ sub open_special { my $config = <{focused}, 'current workspace focused'); my $window = open_special; +sync_with_i3; ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace'); ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');