Search in sources :

Example 1 with GrayPaintScale

use of org.jfree.chart.renderer.GrayPaintScale in project SIMVA-SoS by SESoS.

the class XYBlockRendererTest method testEquals.

/**
 * Test that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    // default instances
    XYBlockRenderer r1 = new XYBlockRenderer();
    XYBlockRenderer r2 = new XYBlockRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));
    // blockHeight
    r1.setBlockHeight(2.0);
    assertFalse(r1.equals(r2));
    r2.setBlockHeight(2.0);
    assertTrue(r1.equals(r2));
    // blockWidth
    r1.setBlockWidth(2.0);
    assertFalse(r1.equals(r2));
    r2.setBlockWidth(2.0);
    assertTrue(r1.equals(r2));
    // paintScale
    r1.setPaintScale(new GrayPaintScale(0.0, 1.0));
    assertFalse(r1.equals(r2));
    r2.setPaintScale(new GrayPaintScale(0.0, 1.0));
    assertTrue(r1.equals(r2));
}
Also used : GrayPaintScale(org.jfree.chart.renderer.GrayPaintScale) Test(org.junit.Test)

Example 2 with GrayPaintScale

use of org.jfree.chart.renderer.GrayPaintScale in project SIMVA-SoS by SESoS.

the class PaintScaleLegendTest method testHashcode.

/**
 * Two objects that are equal are required to return the same hashCode.
 */
@Test
public void testHashcode() {
    PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(), new NumberAxis("X"));
    PaintScaleLegend l2 = new PaintScaleLegend(new GrayPaintScale(), new NumberAxis("X"));
    assertTrue(l1.equals(l2));
    int h1 = l1.hashCode();
    int h2 = l2.hashCode();
    assertEquals(h1, h2);
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) GradientPaint(java.awt.GradientPaint) GrayPaintScale(org.jfree.chart.renderer.GrayPaintScale) Test(org.junit.Test)

Example 3 with GrayPaintScale

use of org.jfree.chart.renderer.GrayPaintScale in project SIMVA-SoS by SESoS.

the class PaintScaleLegendTest method testCloning.

/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(), new NumberAxis("X"));
    PaintScaleLegend l2 = (PaintScaleLegend) l1.clone();
    assertTrue(l1 != l2);
    assertTrue(l1.getClass() == l2.getClass());
    assertTrue(l1.equals(l2));
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) GrayPaintScale(org.jfree.chart.renderer.GrayPaintScale) Test(org.junit.Test)

Example 4 with GrayPaintScale

use of org.jfree.chart.renderer.GrayPaintScale in project SIMVA-SoS by SESoS.

the class PaintScaleLegendTest method testEquals.

/**
 * Test that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    // default instances
    PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(), new NumberAxis("X"));
    PaintScaleLegend l2 = new PaintScaleLegend(new GrayPaintScale(), new NumberAxis("X"));
    assertTrue(l1.equals(l2));
    assertTrue(l2.equals(l1));
    // paintScale
    l1.setScale(new LookupPaintScale());
    assertFalse(l1.equals(l2));
    l2.setScale(new LookupPaintScale());
    assertTrue(l1.equals(l2));
    // axis
    l1.setAxis(new NumberAxis("Axis 2"));
    assertFalse(l1.equals(l2));
    l2.setAxis(new NumberAxis("Axis 2"));
    assertTrue(l1.equals(l2));
    // axisLocation
    l1.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    assertFalse(l1.equals(l2));
    l2.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    assertTrue(l1.equals(l2));
    // axisOffset
    l1.setAxisOffset(99.0);
    assertFalse(l1.equals(l2));
    l2.setAxisOffset(99.0);
    assertTrue(l1.equals(l2));
    // stripWidth
    l1.setStripWidth(99.0);
    assertFalse(l1.equals(l2));
    l2.setStripWidth(99.0);
    assertTrue(l1.equals(l2));
    // stripOutlineVisible
    l1.setStripOutlineVisible(!l1.isStripOutlineVisible());
    assertFalse(l1.equals(l2));
    l2.setStripOutlineVisible(l1.isStripOutlineVisible());
    assertTrue(l1.equals(l2));
    // stripOutlinePaint
    l1.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertFalse(l1.equals(l2));
    l2.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertTrue(l1.equals(l2));
    // stripOutlineStroke
    l1.setStripOutlineStroke(new BasicStroke(1.1f));
    assertFalse(l1.equals(l2));
    l2.setStripOutlineStroke(new BasicStroke(1.1f));
    assertTrue(l1.equals(l2));
    // backgroundPaint
    l1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertFalse(l1.equals(l2));
    l2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertTrue(l1.equals(l2));
    l1.setSubdivisionCount(99);
    assertFalse(l1.equals(l2));
    l2.setSubdivisionCount(99);
    assertTrue(l1.equals(l2));
}
Also used : BasicStroke(java.awt.BasicStroke) NumberAxis(org.jfree.chart.axis.NumberAxis) GradientPaint(java.awt.GradientPaint) LookupPaintScale(org.jfree.chart.renderer.LookupPaintScale) GrayPaintScale(org.jfree.chart.renderer.GrayPaintScale) Test(org.junit.Test)

Example 5 with GrayPaintScale

use of org.jfree.chart.renderer.GrayPaintScale in project SIMVA-SoS by SESoS.

the class PaintScaleLegendTest method testSerialization.

/**
 * Serialize an instance, restore it, and check for equality.
 */
@Test
public void testSerialization() {
    PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(), new NumberAxis("X"));
    PaintScaleLegend l2 = (PaintScaleLegend) TestUtilities.serialised(l1);
    assertEquals(l1, l2);
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) GrayPaintScale(org.jfree.chart.renderer.GrayPaintScale) Test(org.junit.Test)

Aggregations

GrayPaintScale (org.jfree.chart.renderer.GrayPaintScale)5 Test (org.junit.Test)5 NumberAxis (org.jfree.chart.axis.NumberAxis)4 GradientPaint (java.awt.GradientPaint)2 BasicStroke (java.awt.BasicStroke)1 LookupPaintScale (org.jfree.chart.renderer.LookupPaintScale)1