Permalink
Browse files

Fixed the uinput tests for cases where there are lots of event devices.

  • Loading branch information...
Spakman committed Nov 20, 2009
1 parent b03647e commit c4640ac1f78e9d5ece36ecb00a27b90bd130827a
Showing with 7 additions and 6 deletions.
  1. +7 −6 test/evdev_listener_test.rb
@@ -148,6 +148,7 @@ class EvdevListenerTest < Test::Unit::TestCase
def setup
@listener = Honcho::EvdevListener.new
@keyboard_fd = add_keyboard
+ @uinput_keyboard = @listener.keyboards.sort_by { |x| x[/\d+/].to_i }.last
end
def teardown
@@ -162,32 +163,32 @@ def test_find_keyboards
end
def test_read_event
- @listener.listen_and_process_events [ @listener.keyboards.last ]
+ @listener.listen_and_process_events [ @uinput_keyboard ]
sleep 0.2
send_key_event(@keyboard_fd, KEY_KP5)
- sleep 0.2
+ sleep 2
assert_equal 1, @listener.queue.size
event = @listener.queue.pop
assert_equal Honcho::InputEvent, event.class
assert_equal :jog_wheel_button, event.button
end
def test_read_multiple_events_when_the_jog_wheel_is_turned
- @listener.listen_and_process_events [ @listener.keyboards.last ]
+ @listener.listen_and_process_events [ @uinput_keyboard ]
sleep 0.2
send_held_down_key_events(@keyboard_fd, KEY_KP4)
- sleep 02
+ sleep 0.2
assert_equal 3, @listener.queue.size
event = @listener.queue.pop
assert_equal Honcho::InputEvent, event.class
assert_equal :jog_wheel_left, event.button
end
def test_read_multiple_events_when_the_jog_wheel_button_is_help
- @listener.listen_and_process_events [ @listener.keyboards.last ]
+ @listener.listen_and_process_events [ @uinput_keyboard ]
sleep 0.2
send_held_down_key_events(@keyboard_fd, KEY_KP5)
- sleep 02
+ sleep 0.2
assert_equal 1, @listener.queue.size
event = @listener.queue.pop
assert_equal Honcho::InputEvent, event.class

0 comments on commit c4640ac

Please sign in to comment.