From: Michael Stapelberg Date: Sat, 17 Sep 2011 18:29:23 +0000 (+0100) Subject: tests: extend t/35-floating-focus to use focus left/right on floating windows X-Git-Tag: 4.1~155^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c8c95030ad13900900a18c2326908132d134b055;p=i3%2Fi3 tests: extend t/35-floating-focus to use focus left/right on floating windows --- diff --git a/testcases/t/35-floating-focus.t b/testcases/t/35-floating-focus.t index 3f820ea5..6adad246 100644 --- a/testcases/t/35-floating-focus.t +++ b/testcases/t/35-floating-focus.t @@ -170,5 +170,46 @@ sleep 0.25; is($x->input_focus, $second->id, 'second (floating) container focused'); +############################################################################# +# 6: see if switching floating focus using the focus left/right command works +############################################################################# + +$tmp = fresh_workspace; + +$first = open_standard_window($x, '#ff0000', 1); # window 10 +$second = open_standard_window($x, '#00ff00', 1); # window 11 +$third = open_standard_window($x, '#0000ff', 1); # window 12 + +is($x->input_focus, $third->id, 'third container focused'); + +cmd 'focus left'; + +sleep 0.25; + +is($x->input_focus, $second->id, 'second container focused'); + +cmd 'focus left'; + +sleep 0.25; + +is($x->input_focus, $first->id, 'first container focused'); + +cmd 'focus left'; + +sleep 0.25; + +is($x->input_focus, $third->id, 'focus wrapped to third container'); + +cmd 'focus right'; + +sleep 0.25; + +is($x->input_focus, $first->id, 'focus wrapped to first container'); + +cmd 'focus right'; + +sleep 0.25; + +is($x->input_focus, $second->id, 'focus on second container'); done_testing; diff --git a/testcases/t/lib/i3test.pm b/testcases/t/lib/i3test.pm index 054bb2ae..749b89b7 100644 --- a/testcases/t/lib/i3test.pm +++ b/testcases/t/lib/i3test.pm @@ -48,16 +48,23 @@ use warnings; } sub open_standard_window { - my ($x, $color) = @_; + my ($x, $color, $floating) = @_; $color ||= '#c0c0c0'; - my $window = $x->root->create_child( + # We cannot use a hashref here because create_child expands the arguments into an array + my @args = ( class => WINDOW_CLASS_INPUT_OUTPUT, - rect => [ 0, 0, 30, 30 ], + rect => X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30 ), background_color => $color, ); + if (defined($floating) && $floating) { + @args = (@args, window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY')); + } + + my $window = $x->root->create_child(@args); + $window->name('Window ' . counter_window()); $window->map;