Package org.fest.swing.test.swing

Examples of org.fest.swing.test.swing.TestWindow


* @author Alex Ruiz
*/
public class Bug228_ModalWindowBlocks_Test extends RobotBasedTestCase {
  @Test
  public void should_not_block() {
    TestWindow window = TestWindow.createNewWindow(getClass());
    robot.showWindow(window);
    MyDialog.createAndShowNew(window);
    DialogFixture found = findDialog(JDialog.class).using(robot);
    assertThat(found.target()).isInstanceOf(MyDialog.class);
  }
View Full Code Here


* @author Alex Ruiz
*/
public class WindowEventQueueMapping_windows_Test extends WindowEventQueueMapping_withWindow_TestCase {
  @Test
  public void should_return_windows() {
    TestWindow anotherWindow = MyWindow.createNew(toolkit, getClass());
    mapping.addQueueFor(window);
    mapping.addQueueFor(anotherWindow);
    Collection<Window> windows = mapping.windows();
    assertThat(windows).containsOnly(window, anotherWindow);
  }
View Full Code Here

public class WindowDriver_moveToBack_Test extends WindowDriver_TestCase {
  @Test
  public void should_move_Window_to_back() {
    // TODO(alruiz): Test on Windows
    showWindow();
    TestWindow window2 = TestWindow.createAndShowNewWindow(getClass());
    assertThat(isActive(window2)).isTrue();
    driver.moveToBack(window2);
    assertThat(isActive(window2)).isFalse();
  }
View Full Code Here

public class FrameMatcher_matches_byTitleAndShowing_Test extends EDTSafeTestCase {
  @Test
  public void should_return_true_if_Frame_is_showing_and_title_is_equal_to_expected() {
    ScreenLock.instance().acquire(this);
    Class<FrameMatcher> testType = FrameMatcher.class;
    TestWindow frame = TestWindow.createAndShowNewWindow(testType);
    try {
      FrameMatcher matcher = FrameMatcher.withTitle(testType.getSimpleName()).andShowing();
      assertThat(matcher.matches(frame)).isTrue();
    } finally {
      try {
        frame.destroy();
      } catch (RuntimeException e) {
      }
      ScreenLock.instance().release(this);
    }
  }
View Full Code Here

  }

  @Test
  public void should_return_false_if_Frame_is_showing_and_title_is_not_equal_to_expected() {
    ScreenLock.instance().acquire(this);
    TestWindow frame = TestWindow.createAndShowNewWindow(FrameMatcher.class);
    try {
      FrameMatcher matcher = FrameMatcher.withTitle("Hello").andShowing();
      assertThat(matcher.matches(frame)).isFalse();
    } finally {
      try {
        frame.destroy();
      } catch (RuntimeException e) {
      }
      ScreenLock.instance().release(this);
    }
  }
View Full Code Here

    assertThat(matcher.matches(dialog)).isFalse();
  }

  @Test
  public void should_return_false_if_Dialog_is_showing_and_title_is_not_equal_to_expected() {
    TestWindow window = TestWindow.createAndShowNewWindow(DialogMatcher.class);
    TestDialog dialog = TestDialog.createAndShowNewDialog(window);
    DialogMatcher matcher = DialogMatcher.withTitle("Hello").andShowing();
    assertThat(matcher.matches(dialog)).isFalse();
  }
View Full Code Here

  private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0);

  @Test
  public void should_return_insets_from_container() {
    Robot robot = robotWithNewAwtHierarchy();
    TestWindow window = TestWindow.createNewWindow(getClass());
    try {
      robot.showWindow(window, new Dimension(500, 300));
      Insets insets = insetsFrom(window);
      assertThat(insets).isEqualTo(insetsOf(window));
    } finally {
View Full Code Here

    assertThat(insets).isEqualTo(EMPTY_INSETS);
  }

  @Test
  public void should_return_empty_insets_if_container_insets_is_null() {
    TestWindow window = WindowWithNullInsets.createNew();
    Insets insets = insetsFrom(window);
    assertThat(insets).isEqualTo(EMPTY_INSETS);
  }
View Full Code Here

* @author Alex Ruiz
*/
public class Context_rootWindows_Test extends Context_TestCase {
  @Test
  public void should_return_root_windows() {
    TestWindow anotherFrame = TestWindow.createNewWindow(getClass());
    when(windowEventQueueMapping.windows()).thenReturn(newArrayList((Window) window));
    Collection<Window> rootWindows = context.rootWindows();
    assertThat(rootWindows).contains(window);
    assertThat(rootWindows).contains(anotherFrame);
  }
View Full Code Here

  }

  @Test
  public void should_return_owned_Windows() {
    ScreenLock.instance().acquire(this);
    TestWindow window = TestWindow.createNewWindow(getClass());
    TestDialog dialog = TestDialog.createNewDialog(window);
    try {
      Collection<Component> children = findChildren(finder, window);
      assertThat(children).containsOnly(dialog);
    } finally {
      try {
        dialog.destroy();
        window.destroy();
      } finally {
        ScreenLock.instance().release(this);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.fest.swing.test.swing.TestWindow

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.