Ejemplo n.º 1
0
  private void testShapesTool() {
    window.toggleButton("Shapes Tool Button").click();
    randomAltClick();

    setupEffectsDialog();
    boolean stokeSettingsSetup = false;

    for (ShapeType shapeType : ShapeType.values()) {
      window.comboBox("shapeTypeCB").selectItem(shapeType.toString());
      for (ShapesAction shapesAction : ShapesAction.values()) {
        window.comboBox("actionCB").selectItem(shapesAction.toString());
        window.pressAndReleaseKeys(KeyEvent.VK_R);

        if (shapesAction == ShapesAction.STROKE) { // stroke settings will be enabled here
          if (!stokeSettingsSetup) {
            setupStrokeSettingsDialog();
            stokeSettingsSetup = true;
          }
        }

        moveRandom();
        dragRandom();

        if (shapesAction == ShapesAction.SELECTION
            || shapesAction == ShapesAction.SELECTION_FROM_STROKE) {
          keyboardDeselect();
        }
      }
    }

    keyboardUndoRedo();
    keyboardUndo();
  }
Ejemplo n.º 2
0
 private void testMouseWheelZooming() {
   window.pressKey(VK_CONTROL);
   ImageComponent c = ImageComponents.getActiveIC();
   robot.rotateMouseWheel(c, 2);
   robot.rotateMouseWheel(c, -2);
   window.releaseKey(VK_CONTROL);
 }
Ejemplo n.º 3
0
  private void testClone(boolean aligned, boolean sampleAllLayers, int startX) {
    if (aligned) {
      window.checkBox("alignedCB").check();
    } else {
      window.checkBox("alignedCB").uncheck();
    }

    if (sampleAllLayers) {
      window.checkBox("sampleAllLayersCB").check();
    } else {
      window.checkBox("sampleAllLayersCB").uncheck();
    }

    move(300, 300);

    altClick();

    move(startX, 300);
    for (int i = 1; i <= 5; i++) {
      int x = startX + i * 10;
      drag(x, 300);
      drag(x, 400);
    }
    keyboardUndoRedo();
  }
 @Test
 public void should_Find_Frame_Before_Given_Timeout_Expires() {
   clickLaunchFrameButton();
   FrameFixture found =
       WindowFinder.findFrame(matcher).withTimeout(500, MILLISECONDS).using(robot);
   assertThat(found.target()).isInstanceOf(WindowToLaunch.class);
 }
Ejemplo n.º 5
0
  private void testColorPickerTool() {
    window.toggleButton("Color Picker Tool Button").click();
    randomAltClick();

    move(300, 300);
    window.click();
    drag(400, 400);
  }
Ejemplo n.º 6
0
 private void shiftMoveClickRandom() {
   window.pressKey(VK_SHIFT);
   int x = 200 + random.nextInt(400);
   int y = 200 + random.nextInt(400);
   move(x, y);
   click();
   window.releaseKey(VK_SHIFT);
 }
Ejemplo n.º 7
0
  private void testPaintBucketTool() {
    window.toggleButton("Paint Bucket Tool Button").click();
    randomAltClick();

    move(300, 300);
    window.click();

    keyboardUndoRedo();
    keyboardUndo();
  }
Ejemplo n.º 8
0
  private void testBrushStrokes() {
    randomAltClick();

    for (BrushType brushType : BrushType.values()) {
      window.comboBox("brushTypeSelector").selectItem(brushType.toString());
      for (Symmetry symmetry : Symmetry.values()) {
        window.comboBox("symmetrySelector").selectItem(symmetry.toString());
        window.pressAndReleaseKeys(KeyEvent.VK_R);
        moveRandom();
        dragRandom();
      }
    }
    keyboardUndoRedo();
  }
Ejemplo n.º 9
0
  private void testHandTool() {
    window.toggleButton("Hand Tool Button").click();
    randomAltClick();

    moveRandom();
    dragRandom();
  }
Ejemplo n.º 10
0
  private void testMoveTool() {
    window.toggleButton("Move Tool Button").click();
    testMoveToolImpl(false);
    testMoveToolImpl(true);

    keyboardNudge();
    keyboardUndo();
  }
Ejemplo n.º 11
0
  private void testCloneTool() {
    window.toggleButton("Clone Stamp Tool Button").click();

    testClone(false, false, 100);
    testClone(false, true, 200);
    testClone(true, false, 300);
    testClone(true, true, 400);
  }
Ejemplo n.º 12
0
 private void keyboardRedo() {
   // press Ctrl-Shift-Z
   window
       .pressKey(VK_CONTROL)
       .pressKey(VK_SHIFT)
       .pressKey(VK_Z)
       .releaseKey(VK_Z)
       .releaseKey(VK_SHIFT)
       .releaseKey(VK_CONTROL);
 }
Ejemplo n.º 13
0
  private void testSmudgeTool() {
    window.toggleButton("Smudge Tool Button").click();
    randomAltClick();

    for (int i = 0; i < 3; i++) {
      randomClick();
      shiftMoveClickRandom();
      moveRandom();
      dragRandom();
    }
  }
 @Test
 public void shoulFindOkButton() {
   GenericTypeMatcher<JButton> textMatcher =
       new GenericTypeMatcher<JButton>(JButton.class) {
         @Override
         protected boolean isMatching(JButton button) {
           return "OK".equals(button.getText());
         }
       };
   window.button(textMatcher).requireVisible();
 }
Ejemplo n.º 15
0
  private void testZoomTool() {
    window.toggleButton("Zoom Tool Button").click();
    move(300, 300);

    click();
    click();
    altClick();
    altClick();

    testMouseWheelZooming();
    testControlPlusMinusZooming();
  }
Ejemplo n.º 16
0
  private void testSelectionToolAndMenus() {
    window.toggleButton("Selection Tool Button").click();
    randomAltClick();

    move(200, 200);
    drag(400, 400);
    keyboardNudge();
    keyboardUndo();

    // window.button("brushTraceButton").click();
    findButtonByText(window, "Stroke with Current Brush").click();

    keyboardDeselect();
    keyboardUndo(); // keyboardUndo deselection
    keyboardUndo(); // keyboardUndo tracing
    window.comboBox("selectionTypeCombo").selectItem("Ellipse");
    move(200, 200);
    drag(400, 400);
    window.comboBox("selectionInteractionCombo").selectItem("Add");
    move(400, 200);
    drag(500, 300);

    // window.button("eraserTraceButton").click();
    findButtonByText(window, "Stroke with Current Eraser").click();

    // crop from this selection tool
    findButtonByText(window, "Crop").click();
    keyboardUndo();

    // crop from the menu
    runMenuCommand("Crop");
    keyboardUndo();

    testSelectionModifyMenu();

    runMenuCommand("Invert Selection");
    runMenuCommand("Stroke with Current Brush");
    runMenuCommand("Stroke with Current Eraser");
    runMenuCommand("Deselect");
  }
 @Override
 protected void onSetUp() {
   JFrame frame =
       GuiActionRunner.execute(
           new GuiQuery<JFrame>() {
             @Override
             protected JFrame executeInEDT() {
               return new TableFrame();
             }
           });
   window = new FrameFixture(robot(), frame);
   window.show();
 }
Ejemplo n.º 18
0
  private void testSelectionModifyMenu() {
    window.toggleButton("Selection Tool Button").click();
    randomAltClick();

    move(200, 200);
    drag(400, 400);

    runMenuCommand("Modify...");
    DialogFixture dialog = findDialogByTitle("Modify Selection");

    findButtonByText(dialog, "Change!").click();
    findButtonByText(dialog, "Change!").click();
    findButtonByText(dialog, "Close").click();

    keyboardUndoRedo();
    keyboardUndo();
  }
Ejemplo n.º 19
0
  private void testCropTool() {
    window.toggleButton("Crop Tool Button").click();
    move(200, 200);
    drag(400, 400);
    drag(450, 450);
    move(200, 200);
    drag(150, 150);
    sleep(1, SECONDS);

    keyboardNudge();
    keyboardUndo();

    randomAltClick(); // must be at the end, otherwise it tries to start a rectangle

    findButtonByText(window, "Crop").click();

    keyboardUndoRedo();
    keyboardUndo();
  }
Ejemplo n.º 20
0
  private void testEditMenu() {
    keyboardInvert();
    runMenuCommand("Repeat Invert");
    runMenuCommand("Undo Invert");
    runMenuCommand("Redo Invert");
    testFilterWithDialog("Fade Invert", Randomize.NO, ShowOriginal.YES);

    // select for crop
    window.toggleButton("Selection Tool Button").click();
    move(200, 200);
    drag(400, 400);
    runMenuCommand("Crop");
    keyboardUndo();
    keyboardDeselect();

    testCopyPaste();

    testResize();
    testRotateFlip();

    testFilterWithDialog("Transform Layer...", Randomize.YES, ShowOriginal.YES);

    testPreferences();
  }
Ejemplo n.º 21
0
  private void testGradientTool() {
    window.toggleButton("Gradient Tool Button").click();
    randomAltClick();

    for (GradientType gradientType : GradientType.values()) {
      window.comboBox("gradientTypeSelector").selectItem(gradientType.toString());
      for (String cycleMethod : GradientTool.CYCLE_METHODS) {
        window.comboBox("gradientCycleMethodSelector").selectItem(cycleMethod);
        GradientColorType[] gradientColorTypes = GradientColorType.values();
        for (GradientColorType colorType : gradientColorTypes) {
          window.comboBox("gradientColorTypeSelector").selectItem(colorType.toString());
          window.checkBox("gradientInvert").uncheck();
          move(200, 200);
          drag(400, 400);
          window.checkBox("gradientInvert").check();
          move(200, 200);
          drag(400, 400);
        }
      }
    }
    keyboardUndoRedo();
  }
Ejemplo n.º 22
0
 private void keyboardNudge() {
   // TODO for some reason the shift is not detected
   window.pressKey(VK_SHIFT).pressKey(VK_RIGHT).releaseKey(VK_RIGHT).releaseKey(VK_SHIFT);
 }
Ejemplo n.º 23
0
 private void pressCtrlNumpadPlus() {
   window.pressKey(VK_CONTROL).pressKey(VK_ADD).releaseKey(VK_ADD).releaseKey(VK_CONTROL);
 }
Ejemplo n.º 24
0
 private void pressCtrlMinus() {
   window.pressKey(VK_CONTROL).pressKey(VK_MINUS).releaseKey(VK_MINUS).releaseKey(VK_CONTROL);
 }
Ejemplo n.º 25
0
 private void testBrushTool() {
   window.toggleButton("Brush Tool Button").click();
   testBrushStrokes();
 }
Ejemplo n.º 26
0
 private void keyboardUndo() {
   // press Ctrl-Z
   window.pressKey(VK_CONTROL).pressKey(VK_Z).releaseKey(VK_Z).releaseKey(VK_CONTROL);
 }
Ejemplo n.º 27
0
 private void keyboardInvert() {
   // press Ctrl-I
   window.pressKey(VK_CONTROL).pressKey(VK_I).releaseKey(VK_I).releaseKey(VK_CONTROL);
 }
Ejemplo n.º 28
0
 private void keyboardDeselect() {
   // press Ctrl-D
   window.pressKey(VK_CONTROL).pressKey(VK_D).releaseKey(VK_D).releaseKey(VK_CONTROL);
 }
Ejemplo n.º 29
0
 private void keyboardActualPixels() {
   // press Ctrl-0
   window.pressKey(VK_CONTROL).pressKey(VK_0).releaseKey(VK_0).releaseKey(VK_CONTROL);
 }
Ejemplo n.º 30
0
 private void altDrag(int x, int y) {
   window.pressKey(VK_ALT);
   drag(x, y);
   window.releaseKey(VK_ALT);
 }