Package org.fest.swing.timing

Examples of org.fest.swing.timing.Condition


        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);
      }
View Full Code Here


  }

  @Test
  public void should_always_process_event_in_EDT() {
    listener.eventDispatched(event);
    pause(new Condition("event to be processed in EDT") {
      @Override
      public boolean test() {
        return listener.event == event && listener.wasProcessedInEventDispatchThread;
      }
    });
View Full Code Here

  }

  @Test
  public void should_close_window() {
    robot.close(w);
    pause(new Condition("Window closed") {
      @Override
      public boolean test() {
        return !isVisible(w);
      }
    });
View Full Code Here

      assertThat(e.getMessage()).contains("Expecting no JOptionPane to be showing");
    }
  }

  private void pauseTillJOptionPaneIsShowing() {
    pause(new Condition("JOptionPane is showing") {
      @Override
      public boolean test() {
        Collection<Component> found = robot().finder().findAll(new TypeMatcher(JOptionPane.class));
        return !found.isEmpty();
      }
View Full Code Here

  @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

  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

* @author Alex Ruiz
*/
final class JProgressBarWaitUntilIsDeterminate {
  @RunsInEDT
  static void waitUntilValueIsDeterminate(final @Nonnull JProgressBar progressBar, final @Nonnull Timeout timeout) {
    pause(new Condition(untilIsDeterminate(progressBar)) {
      @Override public boolean test() {
        return !isIndeterminate(progressBar);
      }
    }, timeout);
  }
View Full Code Here

public class ComponentDriver_focus_Test extends ComponentDriver_TestCase {
  @Test
  public void should_give_focus_to_Component() {
    showWindow();
    driver.focus(window.button);
    pause(new Condition("Component has focus") {
      @Override
      public boolean test() {
        return hasFocus(window.button);
      }
    });
View Full Code Here

  static void iconify(final @Nonnull JInternalFrame internalFrame) {
    execute(new GuiTask() {
      @Override
      protected void executeInEDT() throws PropertyVetoException {
        internalFrame.setIcon(true);
        pause(new Condition("JInternalFrame is iconified") {
          @Override
          public boolean test() {
            return internalFrame.isIcon();
          }
        });
View Full Code Here

public class GuiTask_executeInEDT_Test {
  @Test
  public void should_execute_in_EDT_when_called_in_EDT() {
    final GuiTaskInEDT task = new GuiTaskInEDT();
    execute(task);
    pause(new Condition("Task is executed") {
      @Override
      public boolean test() {
        return task.wasExecutedInEDT();
      }
    });
View Full Code Here

TOP

Related Classes of org.fest.swing.timing.Condition

Copyright © 2018 www.massapicom. 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.