Examples of KeyRecorder


Examples of org.fest.swing.test.recorder.KeyRecorder

    return true;
  }

  private void pressKeyStrokeAndVerify(final int expectedKey) {
    assertThat(keyStroke.getModifiers()).as("no modifiers should be specified").isEqualTo(0);
    final KeyRecorder recorder = KeyRecorder.attachTo(textArea);
    pressInTextArea();
    pause(new Condition(concat("key with code ", expectedKey, " is pressed")) {
      @Override
      public boolean test() {
        return recorder.keysWerePressed(expectedKey);
      }
    }, 2000);
  }
View Full Code Here

Examples of org.fest.swing.test.recorder.KeyRecorder

public class BasicRobot_pressAndReleaseKeys_Test extends BasicRobot_TestCase {
  @Test
  public void should_press_and_release_given_keys() {
    giveFocusToTextField();
    final JTextField textField = window().textField();
    final KeyRecorder recorder = KeyRecorder.attachTo(textField);
    execute(new GuiTask() {
      @Override
      protected void executeInEDT() {
        textField.setText("");
      }
    });
    robot().waitForIdle();
    robot().pressAndReleaseKeys(new int[] { VK_A, VK_B, VK_Z });
    pause(new Condition("until keys VK_A, VK_B and VK_Z are pressed and released") {
      @Override
      public boolean test() {
        Integer[] expectedKeys = array(VK_A, VK_B, VK_Z);
        return recorder.keysWerePressed(expectedKeys) && recorder.keysWereReleased(expectedKeys);
      }
    }, timeout(500));
  }
View Full Code Here

Examples of org.fest.swing.test.recorder.KeyRecorder

*/
public class BasicRobot_pressKeyAndReleaseKey_Test extends BasicRobot_TestCase {
  @Test
  public void should_press_given_key() {
    giveFocusToTextField();
    final KeyRecorder recorder = KeyRecorder.attachTo(window().textField());
    robot().pressKey(VK_A);
    pause(new Condition("until key VK_A is pressed") {
      @Override
      public boolean test() {
        return recorder.keysWerePressed(VK_A) && recorder.noKeysReleased();
      }
    }, timeout(500));
  }
View Full Code Here

Examples of org.fest.swing.test.recorder.KeyRecorder

  }

  @Test
  public void should_release_given_key() {
    giveFocusToTextField();
    final KeyRecorder recorder = KeyRecorder.attachTo(window().textField());
    robot().pressKey(VK_A);
    robot().releaseKey(VK_A);
    pause(new Condition("until key is released") {
      @Override
      public boolean test() {
        return recorder.keysWereReleased(VK_A);
      }
    }, timeout(500));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.