From 6130e8aed916a8f1b071f6b1926630647e2a32e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ingo=20B=C3=BCrk?= Date: Sun, 3 Jan 2016 21:48:39 -0500 Subject: [PATCH] Migrate "xdotool click" in tests to XTEST. --- testcases/t/525-i3bar-mouse-bindings.t | 100 ++++++++++++------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/testcases/t/525-i3bar-mouse-bindings.t b/testcases/t/525-i3bar-mouse-bindings.t index eabcad7a..b76ccaf2 100644 --- a/testcases/t/525-i3bar-mouse-bindings.t +++ b/testcases/t/525-i3bar-mouse-bindings.t @@ -17,6 +17,7 @@ # Ensures that mouse bindings on the i3bar work correctly. # Ticket: #1695 use i3test i3_autostart => 0; +use i3test::XTEST; my ($cv, $timer); sub reset_test { @@ -41,17 +42,13 @@ bar { } EOT -SKIP: { - qx(command -v xdotool 2> /dev/null); - skip 'xdotool is required for this test', 1 if $?; +my $pid = launch_with_config($config); +my $i3 = i3(get_socket_path()); +$i3->connect()->recv; +my $ws = fresh_workspace; - my $pid = launch_with_config($config); - my $i3 = i3(get_socket_path()); - $i3->connect()->recv; - my $ws = fresh_workspace; - - reset_test; - $i3->subscribe({ +reset_test; +$i3->subscribe({ window => sub { my ($event) = @_; if ($event->{change} eq 'focus') { @@ -60,45 +57,48 @@ SKIP: { }, })->recv; - my $left = open_window; - my $right = open_window; - sync_with_i3; - my $con = $cv->recv; - is($con->{window}, $right->{id}, 'focus is initially on the right container'); - reset_test; - - qx(xdotool mousemove 3 3 click 1); - sync_with_i3; - $con = $cv->recv; - is($con->{window}, $left->{id}, 'button 1 moves focus left'); - reset_test; - - qx(xdotool mousemove 3 3 click 2); - sync_with_i3; - $con = $cv->recv; - is($con->{window}, $right->{id}, 'button 2 moves focus right'); - reset_test; - - qx(xdotool mousemove 3 3 click 3); - sync_with_i3; - $con = $cv->recv; - is($con->{window}, $left->{id}, 'button 3 moves focus left'); - reset_test; - - qx(xdotool mousemove 3 3 click 4); - sync_with_i3; - $con = $cv->recv; - is($con->{window}, $right->{id}, 'button 4 moves focus right'); - reset_test; - - qx(xdotool mousemove 3 3 click 5); - sync_with_i3; - $con = $cv->recv; - is($con->{window}, $left->{id}, 'button 5 moves focus left'); - reset_test; - - exit_gracefully($pid); - -} +my $left = open_window; +my $right = open_window; +sync_with_i3; +my $con = $cv->recv; +is($con->{window}, $right->{id}, 'focus is initially on the right container'); +reset_test; + +xtest_button_press(1, 3, 3); +xtest_button_release(1, 3, 3); +sync_with_i3; +$con = $cv->recv; +is($con->{window}, $left->{id}, 'button 1 moves focus left'); +reset_test; + +xtest_button_press(2, 3, 3); +xtest_button_release(2, 3, 3); +sync_with_i3; +$con = $cv->recv; +is($con->{window}, $right->{id}, 'button 2 moves focus right'); +reset_test; + +xtest_button_press(3, 3, 3); +xtest_button_release(3, 3, 3); +sync_with_i3; +$con = $cv->recv; +is($con->{window}, $left->{id}, 'button 3 moves focus left'); +reset_test; + +xtest_button_press(4, 3, 3); +xtest_button_release(4, 3, 3); +sync_with_i3; +$con = $cv->recv; +is($con->{window}, $right->{id}, 'button 4 moves focus right'); +reset_test; + +xtest_button_press(5, 3, 3); +xtest_button_release(5, 3, 3); +sync_with_i3; +$con = $cv->recv; +is($con->{window}, $left->{id}, 'button 5 moves focus left'); +reset_test; + +exit_gracefully($pid); done_testing; -- 2.39.5