3 # Author:: Francis Cianfrocca (gmail: blackhedd)
\r
4 # Homepage:: http://rubyeventmachine.com
\r
5 # Date:: 8 April 2006
\r
7 # See EventMachine and EventMachine::Connection for documentation and
\r
10 #----------------------------------------------------------------------------
\r
12 # Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
\r
15 # This program is free software; you can redistribute it and/or modify
\r
16 # it under the terms of either: 1) the GNU General Public License
\r
17 # as published by the Free Software Foundation; either version 2 of the
\r
18 # License, or (at your option) any later version; or 2) Ruby's License.
\r
20 # See the file COPYING for complete licensing information.
\r
22 #---------------------------------------------------------------------------
\r
28 require 'eventmachine'
\r
31 class TestKeyboardEvents < Test::Unit::TestCase
\r
40 include EM::Protocols::LineText2
\r
42 EM::stop if d == "STOP"
\r
46 # This test doesn't actually do anything useful but is here to
\r
47 # illustrate the usage. If you removed the timer and ran this test
\r
48 # by itself on a console, and then typed into the console, it would
\r
50 # I don't know how to get the test harness to simulate actual keystrokes.
\r
51 # When someone figures that out, then we can make this a real test.
\r
55 EM.open_keyboard KbHandler
\r
56 EM::Timer.new(1) { EM.stop }
\r
57 } if $stdout.tty? # don't run the test unless it stands a chance of validity.
\r