/**
* Confirm that cloning works. This test customises the font and paint
* per category label.
*/
public void testCloning2() {
ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test");
a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));
a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.white));
ExtendedCategoryAxis a2 = null;
try {
a2 = (ExtendedCategoryAxis) a1.clone();
}
catch (CloneNotSupportedException e) {
e.printStackTrace();
}
assertTrue(a1 != a2);
assertTrue(a1.getClass() == a2.getClass());
assertTrue(a1.equals(a2));
// check that changing a tick label font in a1 doesn't change a2
a1.setTickLabelFont("C1", null);
assertFalse(a1.equals(a2));
a2.setTickLabelFont("C1", null);
assertTrue(a1.equals(a2));
// check that changing a tick label paint in a1 doesn't change a2
a1.setTickLabelPaint("C1", Color.yellow);
assertFalse(a1.equals(a2));
a2.setTickLabelPaint("C1", Color.yellow);
assertTrue(a1.equals(a2));
// check that changing a category label tooltip in a1 doesn't change a2
a1.addCategoryLabelToolTip("C1", "XYZ");
assertFalse(a1.equals(a2));
a2.addCategoryLabelToolTip("C1", "XYZ");
assertTrue(a1.equals(a2));
}