@@ -0,0 +1,2194 @@
+/*%0A * Copyright 2010-2011, Sikuli.org%0A * Released under the MIT License.%0A *%0A */%0Apackage org.sikuli.script;%0A%0Aimport org.junit.* ;%0Aimport static org.junit.Assert.* ;%0A%0Aimport java.awt.event.InputEvent;%0Aimport java.awt.event.KeyEvent;%0A%0Aimport javax.swing.JFrame;%0A%0Aimport org.sikuli.script.internal.hotkey.HotkeyManager;%0Aimport org.sikuli.script.HotkeyListener;%0Aimport org.sikuli.script.HotkeyEvent;%0Aimport org.sikuli.script.Debug;%0A%0Apublic class HotkeyTest %0A%7B%0A   public boolean pressed = false;%0A%0A%0A   private void sleep(double secs)%7B%0A       int count = 0;%0A       while(count %3C secs*10)%7B%0A          try%7B%0A             Thread.sleep(100);%0A             count++;%0A          %7D%0A          catch(InterruptedException e)%7B%7D%0A       %7D%0A   %7D%0A%0A    @Ignore(%22ignore this in automated test%22)%0A    @Test%0A    public void test_hotkey_install()%0A    %7B%0A       JFrame f = new JFrame(%22hello%22); // need this to hook in the event loop%0A       boolean ret = Env.addHotkey(KeyEvent.VK_F6, 0,%0A         new HotkeyListener()%7B%0A            public void hotkeyPressed(HotkeyEvent e)%7B%0A               HotkeyTest.this.pressed = true;%0A               Debug.log(%22hotkey pressed!%22 + e.keyCode + %22, %22 + e.modifiers);%0A            %7D%0A       %7D);%0A       Debug.log(%22install hotkey F6: %22 + ret);%0A       ret = Env.addHotkey(KeyEvent.VK_2, InputEvent.ALT_MASK,%0A         new HotkeyListener()%7B%0A            public void hotkeyPressed(HotkeyEvent e)%7B%0A               HotkeyTest.this.pressed = true;%0A               Debug.log(%22hotkey 2 pressed!%22);%0A            %7D%0A       %7D);%0A       Debug.log(%22install hotkey ALT-2: %22 + ret);%0A       Debug.log(%22press the hot key now.%22);%0A       sleep(5);%0A       ret = Env.removeHotkey(KeyEvent.VK_F6, 0);%0A       Debug.log(%22remove hotkey F6: %22 + ret);%0A       Debug.log(%22press the hot key again.%22);%0A       sleep(2);%0A       ret = Env.addHotkey(KeyEvent.VK_F7, 0,%0A         new HotkeyListener()%7B%0A            public void hotkeyPressed(HotkeyEvent e)%7B%0A               HotkeyTest.this.pressed = true;%0A               Debug.log(%22hotkey 3 pressed!%22 + e.keyCode + %22, %22 + e.modifiers);%0A            %7D%0A       %7D);%0A       Debug.log(%22install hotkey F7: %22 + ret);%0A       Debug.log(%22press the hot key now.%22);%0A       sleep(3);%0A       //hkm.cleanUp();%0A    %7D%0A%0A%7D%0A%0A

add HotkeyTest