/** * Some checks for the arrange method. */ public void testArrangeNN() { BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); ImageTitle t = new ImageTitle(JFreeChart.INFO.getLogo()); Size2D s = t.arrange(g2); assertEquals(102.0, s.getWidth(), EPSILON); assertEquals(102.0, s.getHeight(), EPSILON); t.setPadding(1.0, 2.0, 3.0, 4.0); s = t.arrange(g2); assertEquals(106.0, s.getWidth(), EPSILON); assertEquals(104.0, s.getHeight(), EPSILON); t.setMargin(5.0, 6.0, 7.0, 8.0); s = t.arrange(g2); assertEquals(120.0, s.getWidth(), EPSILON); assertEquals(116.0, s.getHeight(), EPSILON); }
/** * 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); }
/** * Problem that the equals(...) method distinguishes all fields. */ public void testEquals() { ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo()); ImageTitle t2 = new ImageTitle(JFreeChart.INFO.getLogo()); assertEquals(t1, t2); }
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo()); ImageTitle t2 = new ImageTitle(JFreeChart.INFO.getLogo()); assertEquals(t1, t2); }
/** * 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); }