Search in sources :

Example 6 with StandardGradientPaintTransformer

use of org.jfree.ui.StandardGradientPaintTransformer in project SIMVA-SoS by SESoS.

the class BarRendererTest method testEquals.

/**
 * Test that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    BarRenderer r1 = new BarRenderer();
    BarRenderer r2 = new BarRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));
    // base value
    r1.setBase(0.123);
    assertFalse(r1.equals(r2));
    r2.setBase(0.123);
    assertTrue(r1.equals(r2));
    // itemMargin
    r1.setItemMargin(0.22);
    assertFalse(r1.equals(r2));
    r2.setItemMargin(0.22);
    assertTrue(r1.equals(r2));
    // drawBarOutline
    r1.setDrawBarOutline(!r1.isDrawBarOutline());
    assertFalse(r1.equals(r2));
    r2.setDrawBarOutline(!r2.isDrawBarOutline());
    assertTrue(r1.equals(r2));
    // maximumBarWidth
    r1.setMaximumBarWidth(0.11);
    assertFalse(r1.equals(r2));
    r2.setMaximumBarWidth(0.11);
    assertTrue(r1.equals(r2));
    // minimumBarLength
    r1.setMinimumBarLength(0.04);
    assertFalse(r1.equals(r2));
    r2.setMinimumBarLength(0.04);
    assertTrue(r1.equals(r2));
    // gradientPaintTransformer
    r1.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertFalse(r1.equals(r2));
    r2.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertTrue(r1.equals(r2));
    // positiveItemLabelPositionFallback
    r1.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertFalse(r1.equals(r2));
    r2.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertTrue(r1.equals(r2));
    // negativeItemLabelPositionFallback
    r1.setNegativeItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertFalse(r1.equals(r2));
    r2.setNegativeItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertTrue(r1.equals(r2));
    // barPainter
    r1.setBarPainter(new GradientBarPainter(0.1, 0.2, 0.3));
    assertFalse(r1.equals(r2));
    r2.setBarPainter(new GradientBarPainter(0.1, 0.2, 0.3));
    assertTrue(r1.equals(r2));
    // shadowsVisible
    r1.setShadowVisible(false);
    assertFalse(r1.equals(r2));
    r2.setShadowVisible(false);
    assertTrue(r1.equals(r2));
    r1.setShadowPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setShadowPaint(Color.red);
    assertTrue(r1.equals(r2));
    // shadowXOffset
    r1.setShadowXOffset(3.3);
    assertFalse(r1.equals(r2));
    r2.setShadowXOffset(3.3);
    assertTrue(r1.equals(r2));
    // shadowYOffset
    r1.setShadowYOffset(3.3);
    assertFalse(r1.equals(r2));
    r2.setShadowYOffset(3.3);
    assertTrue(r1.equals(r2));
}
Also used : StandardGradientPaintTransformer(org.jfree.ui.StandardGradientPaintTransformer) ItemLabelPosition(org.jfree.chart.labels.ItemLabelPosition) Test(org.junit.Test)

Example 7 with StandardGradientPaintTransformer

use of org.jfree.ui.StandardGradientPaintTransformer in project SIMVA-SoS by SESoS.

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);
    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));
}
Also used : StandardGradientPaintTransformer(org.jfree.ui.StandardGradientPaintTransformer) Rectangle2D(java.awt.geom.Rectangle2D) Test(org.junit.Test)

Example 8 with StandardGradientPaintTransformer

use of org.jfree.ui.StandardGradientPaintTransformer in project SIMVA-SoS by SESoS.

the class DialBackgroundTest method testEquals.

/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    DialBackground b1 = new DialBackground();
    DialBackground b2 = new DialBackground();
    assertTrue(b1.equals(b2));
    // paint
    b1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow));
    assertFalse(b1.equals(b2));
    b2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow));
    assertTrue(b1.equals(b2));
    // gradient paint transformer
    b1.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertFalse(b1.equals(b2));
    b2.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    assertTrue(b1.equals(b2));
    // check an inherited attribute
    b1.setVisible(false);
    assertFalse(b1.equals(b2));
    b2.setVisible(false);
    assertTrue(b1.equals(b2));
}
Also used : StandardGradientPaintTransformer(org.jfree.ui.StandardGradientPaintTransformer) GradientPaint(java.awt.GradientPaint) Test(org.junit.Test)

Example 9 with StandardGradientPaintTransformer

use of org.jfree.ui.StandardGradientPaintTransformer in project SIMVA-SoS by SESoS.

the class DialBackgroundTest method testCloning.

/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    // test default instance
    DialBackground b1 = new DialBackground();
    DialBackground b2 = (DialBackground) b1.clone();
    assertTrue(b1 != b2);
    assertTrue(b1.getClass() == b2.getClass());
    assertTrue(b1.equals(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();
    assertTrue(b1 != b2);
    assertTrue(b1.getClass() == b2.getClass());
    assertTrue(b1.equals(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.ui.StandardGradientPaintTransformer) GradientPaint(java.awt.GradientPaint) Test(org.junit.Test)

Example 10 with StandardGradientPaintTransformer

use of org.jfree.ui.StandardGradientPaintTransformer in project SIMVA-SoS by SESoS.

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 = (DialBackground) TestUtilities.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 = (DialBackground) TestUtilities.serialised(b1);
    assertEquals(b1, b2);
}
Also used : StandardGradientPaintTransformer(org.jfree.ui.StandardGradientPaintTransformer) GradientPaint(java.awt.GradientPaint) Test(org.junit.Test)

Aggregations

StandardGradientPaintTransformer (org.jfree.ui.StandardGradientPaintTransformer)12 Test (org.junit.Test)10 GradientPaint (java.awt.GradientPaint)4 Rectangle2D (java.awt.geom.Rectangle2D)4 BasicStroke (java.awt.BasicStroke)2 Font (java.awt.Font)2 Line2D (java.awt.geom.Line2D)2 ItemLabelPosition (org.jfree.chart.labels.ItemLabelPosition)2 Color (java.awt.Color)1 JFreeChart (org.jfree.chart.JFreeChart)1 DialBackground (org.jfree.chart.plot.dial.DialBackground)1 DialCap (org.jfree.chart.plot.dial.DialCap)1 DialPlot (org.jfree.chart.plot.dial.DialPlot)1 Pointer (org.jfree.chart.plot.dial.DialPointer.Pointer)1 DialTextAnnotation (org.jfree.chart.plot.dial.DialTextAnnotation)1 DialValueIndicator (org.jfree.chart.plot.dial.DialValueIndicator)1 StandardDialFrame (org.jfree.chart.plot.dial.StandardDialFrame)1 StandardDialRange (org.jfree.chart.plot.dial.StandardDialRange)1 StandardDialScale (org.jfree.chart.plot.dial.StandardDialScale)1 DefaultValueDataset (org.jfree.data.general.DefaultValueDataset)1