1 42 43 package org.jfree.chart.title.junit; 44 45 import junit.framework.Test; 46 import junit.framework.TestCase; 47 import junit.framework.TestSuite; 48 49 import org.jfree.chart.title.TextTitle; 50 import org.jfree.chart.title.Title; 51 import org.jfree.ui.HorizontalAlignment; 52 import org.jfree.ui.RectangleEdge; 53 import org.jfree.ui.VerticalAlignment; 54 55 58 public class TitleTests extends TestCase { 59 60 65 public static Test suite() { 66 return new TestSuite(TitleTests.class); 67 } 68 69 74 public TitleTests(String name) { 75 super(name); 76 } 77 78 81 public void testEquals() { 82 83 Title t1 = new TextTitle(); 85 Title t2 = new TextTitle(); 86 assertEquals(t1, t2); 87 88 t1.setPosition(RectangleEdge.LEFT); 89 assertFalse(t1.equals(t2)); 90 t2.setPosition(RectangleEdge.LEFT); 91 assertTrue(t1.equals(t2)); 92 93 t1.setHorizontalAlignment(HorizontalAlignment.RIGHT); 94 assertFalse(t1.equals(t2)); 95 t2.setHorizontalAlignment(HorizontalAlignment.RIGHT); 96 assertTrue(t1.equals(t2)); 97 98 t1.setVerticalAlignment(VerticalAlignment.BOTTOM); 99 assertFalse(t1.equals(t2)); 100 t2.setVerticalAlignment(VerticalAlignment.BOTTOM); 101 assertTrue(t1.equals(t2)); 102 103 } 104 105 108 public void testHashcode() { 109 TextTitle t1 = new TextTitle(); 110 TextTitle t2 = new TextTitle(); 111 assertTrue(t1.equals(t2)); 112 int h1 = t1.hashCode(); 113 int h2 = t2.hashCode(); 114 assertEquals(h1, h2); 115 } 116 117 } 118 | Popular Tags |