/** Check that the equals() method distinguishes all fields. */
  @Test
  public void testEquals() {
    XYAreaRenderer r1 = new XYAreaRenderer();
    XYAreaRenderer r2 = new XYAreaRenderer();
    assertEquals(r1, r2);

    r1 = new XYAreaRenderer(XYAreaRenderer.AREA_AND_SHAPES);
    assertFalse(r1.equals(r2));
    r2 = new XYAreaRenderer(XYAreaRenderer.AREA_AND_SHAPES);
    assertTrue(r1.equals(r2));

    r1 = new XYAreaRenderer(XYAreaRenderer.AREA);
    assertFalse(r1.equals(r2));
    r2 = new XYAreaRenderer(XYAreaRenderer.AREA);
    assertTrue(r1.equals(r2));

    r1 = new XYAreaRenderer(XYAreaRenderer.LINES);
    assertFalse(r1.equals(r2));
    r2 = new XYAreaRenderer(XYAreaRenderer.LINES);
    assertTrue(r1.equals(r2));

    r1 = new XYAreaRenderer(XYAreaRenderer.SHAPES);
    assertFalse(r1.equals(r2));
    r2 = new XYAreaRenderer(XYAreaRenderer.SHAPES);
    assertTrue(r1.equals(r2));

    r1 = new XYAreaRenderer(XYAreaRenderer.SHAPES_AND_LINES);
    assertFalse(r1.equals(r2));
    r2 = new XYAreaRenderer(XYAreaRenderer.SHAPES_AND_LINES);
    assertTrue(r1.equals(r2));

    r1.setOutline(true);
    assertFalse(r1.equals(r2));
    r2.setOutline(true);
    assertTrue(r1.equals(r2));

    r1.setLegendArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
    assertFalse(r1.equals(r2));
    r2.setLegendArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setGradientTransformer(
        new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertFalse(r1.equals(r2));
    r2.setGradientTransformer(
        new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertTrue(r1.equals(r2));
  }
  /** Confirm that cloning works. */
  @Test
  public void testCloning() throws CloneNotSupportedException {
    XYAreaRenderer r1 = new XYAreaRenderer();
    Rectangle2D rect1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0);
    r1.setLegendArea(rect1);
    XYAreaRenderer r2 = (XYAreaRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    rect1.setRect(4.0, 3.0, 2.0, 1.0);
    assertFalse(r1.equals(r2));
    r2.setLegendArea(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0));
    assertTrue(r1.equals(r2));
  }