Beispiel #1
0
  private void testCloseAll() {
    assertThat(ImageComponents.getNrOfOpenImages() > 1);

    // save for the next test
    runMenuCommand("Copy Composite");

    runMenuCommand("Close All");

    // close all warnings
    boolean warnings = true;
    while (warnings) {
      try {
        JOptionPaneFixture pane = findJOptionPane();
        // click "Don't Save"
        pane.button(
                new GenericTypeMatcher<JButton>(JButton.class) {
                  @Override
                  protected boolean isMatching(JButton button) {
                    return button.getText().equals("Don't Save");
                  }
                })
            .click();
      } catch (Exception e) { // no more JOptionPane found
        warnings = false;
      }
    }

    assertEquals(0, ImageComponents.getNrOfOpenImages());

    // restore for the next test
    runMenuCommand("Paste as New Image");
  }
Beispiel #2
0
  private void testClose() {
    assertEquals(2, ImageComponents.getNrOfOpenImages());

    runMenuCommand("Close");

    assertEquals(1, ImageComponents.getNrOfOpenImages());
  }