Search in sources :

Example 1 with StandardGradientPaintTransformer

use of org.jfree.chart.util.StandardGradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class XYAreaRendererTest method testEquals.

/**
 * 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);
    assertNotEquals(r1, r2);
    r2 = new XYAreaRenderer(XYAreaRenderer.AREA_AND_SHAPES);
    assertEquals(r1, r2);
    r1 = new XYAreaRenderer(XYAreaRenderer.AREA);
    assertNotEquals(r1, r2);
    r2 = new XYAreaRenderer(XYAreaRenderer.AREA);
    assertEquals(r1, r2);
    r1 = new XYAreaRenderer(XYAreaRenderer.LINES);
    assertNotEquals(r1, r2);
    r2 = new XYAreaRenderer(XYAreaRenderer.LINES);
    assertEquals(r1, r2);
    r1 = new XYAreaRenderer(XYAreaRenderer.SHAPES);
    assertNotEquals(r1, r2);
    r2 = new XYAreaRenderer(XYAreaRenderer.SHAPES);
    assertEquals(r1, r2);
    r1 = new XYAreaRenderer(XYAreaRenderer.SHAPES_AND_LINES);
    assertNotEquals(r1, r2);
    r2 = new XYAreaRenderer(XYAreaRenderer.SHAPES_AND_LINES);
    assertEquals(r1, r2);
    r1.setOutline(true);
    assertNotEquals(r1, r2);
    r2.setOutline(true);
    assertEquals(r1, r2);
    r1.setLegendArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
    assertNotEquals(r1, r2);
    r2.setLegendArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
    assertEquals(r1, r2);
    r1.setUseFillPaint(true);
    assertNotEquals(r1, r2);
    r2.setUseFillPaint(true);
    assertEquals(r1, r2);
    r1.setGradientTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertNotEquals(r1, r2);
    r2.setGradientTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertEquals(r1, r2);
}
Also used : StandardGradientPaintTransformer(org.jfree.chart.util.StandardGradientPaintTransformer) Rectangle2D(java.awt.geom.Rectangle2D) Test(org.junit.jupiter.api.Test)

Example 2 with StandardGradientPaintTransformer

use of org.jfree.chart.util.StandardGradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class DialBackgroundTest method testSerialization.

/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    // test a default instance
    DialBackground b1 = new DialBackground();
    DialBackground b2 = TestUtils.serialised(b1);
    assertEquals(b1, b2);
    // test a customised instance
    b1 = new DialBackground();
    b1.setPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.GREEN));
    b1.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    b2 = TestUtils.serialised(b1);
    assertEquals(b1, b2);
}
Also used : StandardGradientPaintTransformer(org.jfree.chart.util.StandardGradientPaintTransformer) GradientPaint(java.awt.GradientPaint) Test(org.junit.jupiter.api.Test)

Example 3 with StandardGradientPaintTransformer

use of org.jfree.chart.util.StandardGradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class DialBackgroundTest method testCloning.

/**
 * Confirm that cloning works.
 * @throws java.lang.CloneNotSupportedException
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    // test default instance
    DialBackground b1 = new DialBackground();
    DialBackground b2 = CloneUtils.clone(b1);
    assertNotSame(b1, b2);
    assertSame(b1.getClass(), b2.getClass());
    assertEquals(b1, b2);
    // test a customised instance
    b1 = new DialBackground();
    b1.setPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.GREEN));
    b1.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    b2 = (DialBackground) b1.clone();
    assertNotSame(b1, b2);
    assertSame(b1.getClass(), b2.getClass());
    assertEquals(b1, b2);
    // check that the listener lists are independent
    MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
    b1.addChangeListener(l1);
    assertTrue(b1.hasListener(l1));
    assertFalse(b2.hasListener(l1));
}
Also used : StandardGradientPaintTransformer(org.jfree.chart.util.StandardGradientPaintTransformer) GradientPaint(java.awt.GradientPaint) Test(org.junit.jupiter.api.Test)

Example 4 with StandardGradientPaintTransformer

use of org.jfree.chart.util.StandardGradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class IntervalMarkerTest method testEquals.

/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    IntervalMarker m1 = new IntervalMarker(45.0, 50.0);
    IntervalMarker m2 = new IntervalMarker(45.0, 50.0);
    assertEquals(m1, m2);
    assertEquals(m2, m1);
    m1 = new IntervalMarker(44.0, 50.0);
    assertNotEquals(m1, m2);
    m2 = new IntervalMarker(44.0, 50.0);
    assertEquals(m1, m2);
    m1 = new IntervalMarker(44.0, 55.0);
    assertNotEquals(m1, m2);
    m2 = new IntervalMarker(44.0, 55.0);
    assertEquals(m1, m2);
    GradientPaintTransformer t = new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL);
    m1.setGradientPaintTransformer(t);
    assertNotEquals(m1, m2);
    m2.setGradientPaintTransformer(t);
    assertEquals(m1, m2);
}
Also used : StandardGradientPaintTransformer(org.jfree.chart.util.StandardGradientPaintTransformer) GradientPaintTransformer(org.jfree.chart.util.GradientPaintTransformer) StandardGradientPaintTransformer(org.jfree.chart.util.StandardGradientPaintTransformer) Test(org.junit.jupiter.api.Test)

Example 5 with StandardGradientPaintTransformer

use of org.jfree.chart.util.StandardGradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class LegendGraphicTest method testEquals.

/**
 * Check that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    LegendGraphic g1 = new LegendGraphic(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), Color.BLACK);
    LegendGraphic g2 = new LegendGraphic(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), Color.BLACK);
    assertEquals(g1, g2);
    assertEquals(g2, g1);
    // shapeVisible
    g1.setShapeVisible(!g1.isShapeVisible());
    assertNotEquals(g1, g2);
    g2.setShapeVisible(!g2.isShapeVisible());
    assertEquals(g1, g2);
    // shape
    g1.setShape(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0));
    assertNotEquals(g1, g2);
    g2.setShape(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0));
    assertEquals(g1, g2);
    // shapeFilled
    g1.setShapeFilled(!g1.isShapeFilled());
    assertNotEquals(g1, g2);
    g2.setShapeFilled(!g2.isShapeFilled());
    assertEquals(g1, g2);
    // fillPaint
    g1.setFillPaint(Color.GREEN);
    assertNotEquals(g1, g2);
    g2.setFillPaint(Color.GREEN);
    assertEquals(g1, g2);
    // shapeOutlineVisible
    g1.setShapeOutlineVisible(!g1.isShapeOutlineVisible());
    assertNotEquals(g1, g2);
    g2.setShapeOutlineVisible(!g2.isShapeOutlineVisible());
    assertEquals(g1, g2);
    // outlinePaint
    g1.setOutlinePaint(Color.GREEN);
    assertNotEquals(g1, g2);
    g2.setOutlinePaint(Color.GREEN);
    assertEquals(g1, g2);
    // outlineStroke
    g1.setOutlineStroke(new BasicStroke(1.23f));
    assertNotEquals(g1, g2);
    g2.setOutlineStroke(new BasicStroke(1.23f));
    assertEquals(g1, g2);
    // shapeAnchor
    g1.setShapeAnchor(RectangleAnchor.BOTTOM_RIGHT);
    assertNotEquals(g1, g2);
    g2.setShapeAnchor(RectangleAnchor.BOTTOM_RIGHT);
    assertEquals(g1, g2);
    // shapeLocation
    g1.setShapeLocation(RectangleAnchor.BOTTOM_RIGHT);
    assertNotEquals(g1, g2);
    g2.setShapeLocation(RectangleAnchor.BOTTOM_RIGHT);
    assertEquals(g1, g2);
    // lineVisible
    g1.setLineVisible(!g1.isLineVisible());
    assertNotEquals(g1, g2);
    g2.setLineVisible(!g2.isLineVisible());
    assertEquals(g1, g2);
    // line
    g1.setLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0));
    assertNotEquals(g1, g2);
    g2.setLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0));
    assertEquals(g1, g2);
    // linePaint
    g1.setLinePaint(Color.GREEN);
    assertNotEquals(g1, g2);
    g2.setLinePaint(Color.GREEN);
    assertEquals(g1, g2);
    // lineStroke
    g1.setLineStroke(new BasicStroke(1.23f));
    assertNotEquals(g1, g2);
    g2.setLineStroke(new BasicStroke(1.23f));
    assertEquals(g1, g2);
    // fillPaintTransformer
    g1.setFillPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    assertNotEquals(g1, g2);
    g2.setFillPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    assertEquals(g1, g2);
}
Also used : BasicStroke(java.awt.BasicStroke) StandardGradientPaintTransformer(org.jfree.chart.util.StandardGradientPaintTransformer) Rectangle2D(java.awt.geom.Rectangle2D) Line2D(java.awt.geom.Line2D) Test(org.junit.jupiter.api.Test)

Aggregations

StandardGradientPaintTransformer (org.jfree.chart.util.StandardGradientPaintTransformer)10 Test (org.junit.jupiter.api.Test)10 GradientPaint (java.awt.GradientPaint)4 Rectangle2D (java.awt.geom.Rectangle2D)4 BasicStroke (java.awt.BasicStroke)2 Line2D (java.awt.geom.Line2D)2 ItemLabelPosition (org.jfree.chart.labels.ItemLabelPosition)2 Font (java.awt.Font)1 LegendItem (org.jfree.chart.legend.LegendItem)1 GradientPaintTransformer (org.jfree.chart.util.GradientPaintTransformer)1