/*
* Test method for 'java.awt.font.ShapeGraphicAttribute.ShapeGraphicAttribute(Shape, int, boolean)'
*/
public final void testShapeGraphicAttribute() {
ShapeGraphicAttribute shAttribute = new ShapeGraphicAttribute(shape, alignment, stroke);
assertNotNull(shAttribute);
assertEquals(alignment, shAttribute.getAlignment());
assertEquals((float)shape.getBounds2D().getMaxX(), shAttribute.getAdvance(), 0F);
assertEquals(0, shAttribute.getAscent(), 0F);
assertEquals((float)shape.getBounds2D().getMinY() + height, shAttribute.getDescent(), 0F);
Rectangle2D.Float bounds = (Rectangle2D.Float)shape.getBounds2D();
if (stroke == ShapeGraphicAttribute.STROKE){
bounds.width++;
bounds.height++;
}
assertEquals(bounds, shAttribute.getBounds());
// illegal alignment value
try {
sga = new ShapeGraphicAttribute(shape, -3, stroke);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
// expected
}
try {
sga = new ShapeGraphicAttribute(shape, 3, stroke);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
// expected
}
}