1 42 43 package org.jfree.chart.needle.junit; 44 45 import java.awt.BasicStroke ; 46 import java.awt.Color ; 47 import java.awt.GradientPaint ; 48 import java.awt.Stroke ; 49 50 import junit.framework.Test; 51 import junit.framework.TestCase; 52 import junit.framework.TestSuite; 53 54 import org.jfree.chart.needle.LineNeedle; 55 import org.jfree.chart.needle.MeterNeedle; 56 57 60 public class MeterNeedleTests extends TestCase { 61 66 public static Test suite() { 67 return new TestSuite(MeterNeedleTests.class); 68 } 69 70 75 public MeterNeedleTests(String name) { 76 super(name); 77 } 78 79 82 public void testEquals() { 83 MeterNeedle n1 = new LineNeedle(); 84 MeterNeedle n2 = new LineNeedle(); 85 assertTrue(n1.equals(n2)); 86 87 n1.setFillPaint(new GradientPaint (1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); 88 assertFalse(n1.equals(n2)); 89 n2.setFillPaint(new GradientPaint (1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); 90 assertTrue(n1.equals(n2)); 91 92 n1.setOutlinePaint(new GradientPaint (5.0f, 6.0f, Color.red, 7.0f, 8.0f, Color.blue)); 93 assertFalse(n1.equals(n2)); 94 n2.setOutlinePaint(new GradientPaint (5.0f, 6.0f, Color.red, 7.0f, 8.0f, Color.blue)); 95 assertTrue(n1.equals(n2)); 96 97 n1.setHighlightPaint(new GradientPaint (9.0f, 0.0f, Color.red, 1.0f, 2.0f, Color.blue)); 98 assertFalse(n1.equals(n2)); 99 n2.setHighlightPaint(new GradientPaint (9.0f, 0.0f, Color.red, 1.0f, 2.0f, Color.blue)); 100 assertTrue(n1.equals(n2)); 101 102 Stroke s = new BasicStroke (1.23f); 103 n1.setOutlineStroke(s); 104 assertFalse(n1.equals(n2)); 105 n2.setOutlineStroke(s); 106 assertTrue(n1.equals(n2)); 107 108 n1.setRotateX(1.23); 109 assertFalse(n1.equals(n2)); 110 n2.setRotateX(1.23); 111 assertTrue(n1.equals(n2)); 112 113 n1.setRotateY(4.56); 114 assertFalse(n1.equals(n2)); 115 n2.setRotateY(4.56); 116 assertTrue(n1.equals(n2)); 117 118 n1.setSize(11); 119 assertFalse(n1.equals(n2)); 120 n2.setSize(11); 121 assertTrue(n1.equals(n2)); 122 } 123 124 } 125 | Popular Tags |