org.jfree.chart.renderer.GrayPaintScale Java Examples

The following examples show how to use org.jfree.chart.renderer.GrayPaintScale. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaintScaleLegendTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: XYBlockRendererTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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));

}
 
Example #3
Source File: PaintScaleLegendTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: PaintScaleLegendTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #5
Source File: PaintScaleLegendTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #6
Source File: XYBlockRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
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));
    
}
 
Example #7
Source File: PaintScaleLegendTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
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);
}
 
Example #8
Source File: XYBlockRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
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));

}
 
Example #9
Source File: GrayPaintScaleTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Simple check for the default constructor.
 */
public void testConstructor() {
    GrayPaintScale gps = new GrayPaintScale();
    assertEquals(0.0, gps.getLowerBound(), EPSILON);
    assertEquals(1.0, gps.getUpperBound(), EPSILON);
    assertEquals(255, gps.getAlpha());
}
 
Example #10
Source File: PaintScaleLegendTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Two objects that are equal are required to return the same hashCode.
 */
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);
}
 
Example #11
Source File: XYBlockRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));

}
 
Example #12
Source File: PaintScaleLegendTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #13
Source File: PaintScaleLegendTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #14
Source File: XYBlockRendererTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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));

}
 
Example #15
Source File: PaintScaleLegendTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #16
Source File: PaintScaleLegendTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #17
Source File: PaintScaleLegendTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #18
Source File: PaintScaleLegendTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: XYBlockRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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));

}
 
Example #20
Source File: PaintScaleLegendTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #21
Source File: PaintScaleLegendTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #22
Source File: PaintScaleLegendTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #23
Source File: XYBlockRendererTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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));

}
 
Example #24
Source File: PaintScaleLegendTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #25
Source File: PaintScaleLegendTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #26
Source File: PaintScaleLegendTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
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));

}
 
Example #27
Source File: PaintScaleLegendTest.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * 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));

}
 
Example #28
Source File: PaintScaleLegendTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
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));
        
}
 
Example #29
Source File: PaintScaleLegendTest.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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));

}
 
Example #30
Source File: GrayPaintScaleTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** 
 * Simple check for the default constructor.
 */
public void testConstructor() {
    GrayPaintScale gps = new GrayPaintScale();
    assertEquals(0.0, gps.getLowerBound(), EPSILON);
    assertEquals(1.0, gps.getUpperBound(), EPSILON);
}