Package java.awt.font

Examples of java.awt.font.ShapeGraphicAttribute


    /*
     * Test method for 'java.awt.font.ShapeGraphicAttribute.getAdvance()'
     */
    public final void testGetAdvance() {

        sga = new ShapeGraphicAttribute(shape, alignment, stroke);
        assertEquals((float)shape.getBounds2D().getWidth() + xOrigin, sga.getAdvance(), 0F);
       
        Shape trShape = AffineTransform.getTranslateInstance(-20, 0).createTransformedShape(shape);
        sga = new ShapeGraphicAttribute(trShape, alignment, stroke);
        assertEquals(0, sga.getAdvance(), 0F);
    }
View Full Code Here


    /*
     * Test method for 'java.awt.font.ShapeGraphicAttribute.getAscent()'
     */
    public final void testGetAscent() {
        sga = new ShapeGraphicAttribute(shape, alignment, stroke);
        assertEquals(0, sga.getAscent(), 0F);

        Shape trShape = AffineTransform.getTranslateInstance(0, -30).createTransformedShape(shape);
        sga = new ShapeGraphicAttribute(trShape, alignment, stroke);
        assertEquals(-(float)trShape.getBounds2D().getMinY(), sga.getAscent(), 0F);

    }
View Full Code Here

    /*
     * Test method for 'java.awt.font.ShapeGraphicAttribute.getBounds()'
     */
    public final void testGetBounds() {
        sga = new ShapeGraphicAttribute(shape, alignment, ShapeGraphicAttribute.FILL);
        Rectangle2D.Float bounds = (Rectangle2D.Float)shape.getBounds2D();
        assertEquals(bounds, sga.getBounds());

    }
View Full Code Here

    /*
     * Test method for 'java.awt.font.ShapeGraphicAttribute.getDescent()'
     */
    public final void testGetDescent() {
        sga = new ShapeGraphicAttribute(shape, alignment, stroke);
        assertEquals((float)shape.getBounds2D().getMinY() + height, sga.getDescent(), 0F);

        Shape trShape = AffineTransform.getTranslateInstance(0, -30).createTransformedShape(shape);
        sga = new ShapeGraphicAttribute(trShape, alignment, stroke);
        assertEquals(0, sga.getDescent(), 0F);
    }
View Full Code Here

    /*
     * 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
        }
    }
View Full Code Here

    /*
     * Test method for 'java.awt.font.ShapeGraphicAttribute.equals(ShapeGraphicAttribute)'
     */
    public final void testEqualsShapeGraphicAttribute() {
        sga = new ShapeGraphicAttribute(shape, alignment, stroke);
        ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
        assertTrue(sga.equals(sga1));
    }
View Full Code Here

    /*
     * Test method for 'java.awt.font.ShapeGraphicAttribute.equals(Object)'
     */
    public final void testEqualsObject() {
        sga = new ShapeGraphicAttribute(shape, alignment, stroke);
        ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
        assertTrue(sga.equals((Object)sga1));
    }
View Full Code Here

    /*
     * Test method for 'java.awt.font.GraphicAttribute.getAlignment()'
     */
    public final void testGetAlignment() {
        sga = new ShapeGraphicAttribute(shape, alignment, stroke);
        assertEquals(alignment, sga.getAlignment());
    }
View Full Code Here

    /*
     * Test method for 'java.awt.font.GraphicAttribute.getJustificationInfo()'
     */
    public final void testGetJustificationInfo() {
        sga = new ShapeGraphicAttribute(shape, alignment, stroke);
        float advance = sga.getAdvance();
        GlyphJustificationInfo gji = new GlyphJustificationInfo(
                advance,
                false,
                GlyphJustificationInfo.PRIORITY_INTERCHAR,
View Full Code Here

TOP

Related Classes of java.awt.font.ShapeGraphicAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.