Package org.fest.swing.timing

Examples of org.fest.swing.timing.Condition


      @Override
      public void run() {
        viewer.unloadApplet();
      }
    });
    pause(new Condition("applet is unloaded") {
      @Override
      public boolean test() {
        return !viewer.appletLoaded();
      }
    });
View Full Code Here


  }

  private void pressKeyStrokeAndVerify(char expectedChar) {
    pressInTextArea();
    final String expectedText = valueOf(expectedChar);
    pause(new Condition(concat("text in JTextArea to be ", quote(expectedText))) {
      @Override
      public boolean test() {
        return expectedText.equals(textArea.getText());
      }
    }, 500);
View Full Code Here

  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

    frame.setVisible(true);
  }

  @RunsInCurrentThread
  public static void waitForShowing(final @Nonnull Frame frame) {
    pause(new Condition("Frame is showing") {
      @Override
      public boolean test() {
        return isShowing(frame);
      }
    }, 20000);
View Full Code Here

  @RunsInCurrentThread
  public static void packAndShow(final @Nonnull Dialog dialog) {
    dialog.pack();
    dialog.setVisible(true);
    pause(new Condition("Dialog is showing") {
      @Override
      public boolean test() {
        return dialog.isShowing();
      }
    });
View Full Code Here

        dialog.pack();
        dialog.setVisible(true);
        dialog.dispose();
      }
    });
    pause(new Condition("JOptionPane is showing") {
      @Override
      public boolean test() {
        return dialog.isShowing();
      }
    });
View Full Code Here

    // TODO: test in Windows
    window.display(new Dimension(2, 2));
    final Dimension original = sizeOf(window);
    when(windows.isShowingButNotReady(window)).thenReturn(true);
    status.checkIfReady(window);
    pause(new Condition("Frame to be resized") {
      @Override
      public boolean test() {
        return sizeOf(window).height > original.height;
      }
    }, timeout(5000));
View Full Code Here

      protected void executeInEDT() {
        viewer.pack();
        viewer.setVisible(true);
      }
    });
    pause(new Condition("new AppletViewer to be showing") {
      @Override
      public boolean test() {
        return viewer.isShowing();
      }
    });
View Full Code Here

*/
final class JProgressBarWaitUntilValueIsEqualToExpectedTask {
  @RunsInEDT
  static void waitUntilValueIsEqualToExpected(final @Nonnull JProgressBar progressBar, final int expected,
      final @Nonnull Timeout timeout) {
    pause(new Condition(untilValueIsEqualTo(progressBar, expected)) {
      @Override
      public boolean test() {
        return valueOf(progressBar) == expected;
      }
    }, timeout);
View Full Code Here

    window = MyWindow.createNew();
  }

  @Test
  public void should_append_component_hierarchy_to_exception_message_if_component_was_not_found() {
    Condition condition = new ComponentFoundCondition("JButton to be found", finder, byType(JButton.class));
    try {
      pause(condition, 10);
      failWhenExpectingException();
    } catch (WaitTimedOutError e) {
      assertThat(e.getMessage()).contains("Timed out waiting for JButton to be found")
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.