Пример #1
0
 /** Two objects that are equal are required to return the same hashCode. */
 public void testHashcode() {
   ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo());
   ImageTitle t2 = new ImageTitle(JFreeChart.INFO.getLogo());
   assertTrue(t1.equals(t2));
   int h1 = t1.hashCode();
   int h2 = t2.hashCode();
   assertEquals(h1, h2);
 }
Пример #2
0
 /** Confirm that cloning works. */
 public void testCloning() {
   ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo());
   ImageTitle t2 = null;
   try {
     t2 = (ImageTitle) t1.clone();
   } catch (CloneNotSupportedException e) {
     System.err.println("ImageTitleTests.testCloning: failed to clone.");
   }
   assertTrue(t1 != t2);
   assertTrue(t1.getClass() == t2.getClass());
   assertTrue(t1.equals(t2));
 }
Пример #3
0
 /** Check the width and height. */
 public void testWidthAndHeight() {
   ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo());
   assertEquals(100, t1.getWidth(), EPSILON);
   assertEquals(100, t1.getHeight(), EPSILON);
 }