Beispiel #1
0
  private void testClose() {
    assertEquals(2, ImageComponents.getNrOfOpenImages());

    runMenuCommand("Close");

    assertEquals(1, ImageComponents.getNrOfOpenImages());
  }
Beispiel #2
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 #3
0
 private void testScreenCapture() {
   ImageComponent activeIC = ImageComponents.getActiveIC();
   testScreenCapture(true);
   testScreenCapture(false);
   try {
     SwingUtilities.invokeAndWait(
         () -> {
           ImageComponents.setActiveImageComponent(activeIC, true);
         });
   } catch (InterruptedException | InvocationTargetException e) {
     e.printStackTrace();
   }
 }
Beispiel #4
0
 private void testMouseWheelZooming() {
   window.pressKey(VK_CONTROL);
   ImageComponent c = ImageComponents.getActiveIC();
   robot.rotateMouseWheel(c, 2);
   robot.rotateMouseWheel(c, -2);
   window.releaseKey(VK_CONTROL);
 }
Beispiel #5
0
  private void testBatchFilter() {
    FileChoosers.setLastOpenDir(INPUT_DIR);
    FileChoosers.setLastSaveDir(BATCH_FILTER_OUTPUT_DIR);

    assertTrue(ImageComponents.getActiveComp().isPresent());
    runMenuCommand("Batch Filter...");
    DialogFixture dialog = findDialogByTitle("Batch Filter");
    dialog.comboBox("filtersCB").selectItem("Angular Waves");
    dialog.button("ok").click(); // next
    sleep(3, SECONDS);
    findButtonByText(dialog, "Randomize Settings").click();
    dialog.button("ok").click(); // start processing

    waitForProgressMonitorEnd();
  }
Beispiel #6
0
  private void testExportTweeningAnimation() {
    assertTrue(ImageComponents.getActiveComp().isPresent());
    runMenuCommand("Export Tweening Animation...");
    DialogFixture dialog = findDialogByTitle("Export Tweening Animation");
    dialog.comboBox().selectItem("Angular Waves");
    dialog.button("ok").click(); // next
    findButtonByText(dialog, "Randomize Settings").click();
    dialog.button("ok").click(); // next
    findButtonByText(dialog, "Randomize Settings").click();
    dialog.button("ok").click(); // next
    dialog.button("ok").click(); // render

    // say OK to the folder not empty question
    JOptionPaneFixture optionPane = findJOptionPane();
    optionPane.yesButton().click();

    waitForProgressMonitorEnd();
  }
Beispiel #7
0
  private void testMoveToolImpl(boolean altDrag) {
    move(400, 400);
    click();
    if (altDrag) {
      altDrag(300, 300);
    } else {
      ImageLayer layer = ImageComponents.getActiveIC().getComp().getActiveImageLayerOrMask();
      int txx = layer.getTranslationX();
      int txy = layer.getTranslationY();
      assert txx == 0;
      assert txy == 0;

      drag(200, 300);

      txx = layer.getTranslationX();
      txy = layer.getTranslationY();

      // This will be true only if we are at 100% zoom!
      assert txx == -200 : "txx = " + txx;
      assert txy == -100 : "txy = " + txx;
    }
    keyboardUndoRedo();
    keyboardUndo();
  }
 @Override
 public void internalFrameClosed(InternalFrameEvent e) {
   ImageComponents.imageClosed(ic);
 }
 @Override
 public void internalFrameActivated(InternalFrameEvent e) {
   ImageComponents.activeImageHasChanged(ic);
   ic.onActivation();
 }
Beispiel #10
0
 private void addNewLayer() {
   int nrLayers = ImageComponents.getActiveComp().get().getNrLayers();
   runMenuCommand("Duplicate Layer");
   checkNumLayers(nrLayers + 1);
   keyboardInvert();
 }
Beispiel #11
0
 private static void checkNumLayers(int num) {
   int nrLayers = ImageComponents.getActiveComp().get().getNrLayers();
   assertEquals(nrLayers, num);
 }