Migrate "xdotool click" in tests to XTEST.

This commit is contained in:
Ingo Bürk 2016-01-03 21:48:39 -05:00
parent c099381632
commit 6130e8aed9
1 changed files with 44 additions and 44 deletions

View File

@ -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,10 +42,6 @@ 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;
@ -67,31 +64,36 @@ SKIP: {
is($con->{window}, $right->{id}, 'focus is initially on the right container');
reset_test;
qx(xdotool mousemove 3 3 click 1);
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;
qx(xdotool mousemove 3 3 click 2);
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;
qx(xdotool mousemove 3 3 click 3);
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;
qx(xdotool mousemove 3 3 click 4);
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;
qx(xdotool mousemove 3 3 click 5);
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');
@ -99,6 +101,4 @@ SKIP: {
exit_gracefully($pid);
}
done_testing;