// called on the EDT
  private static void testToolAction(
      Composition comp, Random rand, int canvasWidth, int canvasHeight, boolean brushOnly) {
    assert SwingUtilities.isEventDispatchThread();

    FgBgColors.setRandomColors();

    Point start = new Point(rand.nextInt(canvasWidth), rand.nextInt(canvasHeight));
    Point end = new Point(rand.nextInt(canvasWidth), rand.nextInt(canvasHeight));

    boolean doTheBrush;
    if (brushOnly) {
      doTheBrush = true;
    } else {
      doTheBrush = rand.nextBoolean();
    }

    try {
      if (doTheBrush) {
        Tools.BRUSH.randomize();
        Tools.BRUSH.drawBrushStrokeProgrammatically(comp, start, end);
      } else {
        Tools.SHAPES.randomize();
        Tools.SHAPES.paintShapeOnIC(comp, new UserDrag(start.x, start.y, end.x, end.y));
      }
    } catch (Exception e) {
      Messages.showException(e);
    }
  }