Package org.apache.xmlgraphics.image.loader

Examples of org.apache.xmlgraphics.image.loader.MockImageSessionContext


    }

    @Test
    public void testLoadImageImageInfoMapImageSessionContext() throws ImageException, IOException {
        ImageContext context = MockImageContext.newSafeInstance();
        ImageSessionContext session = new MockImageSessionContext(context);
        ImageInfo info = new ImageInfo("basn2c08.png", MimeConstants.MIME_PNG);
        Image im = ilpng.loadImage(info, null, session);
        assertTrue(im instanceof ImageRendered);
    }
View Full Code Here


public class ImageLoaderRawCCITTFaxTestCase extends TestCase {
    private ImageLoaderRawCCITTFax sut;

    public void testLoadImage() throws Exception {
        ImageContext context = MockImageContext.newSafeInstance();
        ImageSessionContext session = new MockImageSessionContext(context);
        // This image file is NOT a valid tif! It is the directory table ONLY.
        ImageInfo info = new ImageInfo("dirOnly.tif", MimeConstants.MIME_TIFF);
        ImageSize size = new ImageSize();
        // Size data can be retrieve by parsing the directory table in the TIFF
        size.setSizeInPixels(1728, 2266);
View Full Code Here

        Assert.assertNotNull(imageURL);
        String uri = imageURL.toURI().toASCIIString();

        ImageLoaderImageIO loader = new ImageLoaderImageIO(ImageFlavor.RENDERED_IMAGE);
        ImageContext context = MockImageContext.newSafeInstance();
        ImageSessionContext session = new MockImageSessionContext(context);
        ImageInfo info = new ImageInfo(uri, MimeConstants.MIME_PNG);
        Image im = loader.loadImage(info, null, session);
        assertTrue(im instanceof ImageRendered);
    }
View Full Code Here

    }

    @Test
    public void testCorruptPNG() {
        ImageContext context = MockImageContext.newSafeInstance();
        ImageSessionContext session = new MockImageSessionContext(context);
        ImageInfo info = new ImageInfo("corrupt-image.png", MimeConstants.MIME_PNG);
        ImageLoaderRawPNG ilrpng = new ImageLoaderRawPNG();
        try {
            ImageRawPNG irpng = (ImageRawPNG) ilrpng.loadImage(info, null, session);
            fail("An exception should have been thrown above");
View Full Code Here

    }

    private void testColorTypePNG(String imageName, int colorType, boolean isTransparent)
            throws ImageException, IOException {
        ImageContext context = MockImageContext.newSafeInstance();
        ImageSessionContext session = new MockImageSessionContext(context);
        ImageInfo info = new ImageInfo(imageName, MimeConstants.MIME_PNG);
        ImageLoaderRawPNG ilrpng = new ImageLoaderRawPNG();
        ImageRawPNG irpng = (ImageRawPNG) ilrpng.loadImage(info, null, session);
        ColorModel cm = irpng.getColorModel();
        if (colorType == PNG_COLOR_PALETTE) {
View Full Code Here

    }

    @Test
    public void testLoadImageBadMime() throws ImageException, IOException {
        ImageContext context = MockImageContext.newSafeInstance();
        ImageSessionContext session = new MockImageSessionContext(context);
        ImageInfo info = new ImageInfo("basn2c08.png", MimeConstants.MIME_JPEG);
        try {
            ImageRawPNG irpng = (ImageRawPNG) ilrpng.loadImage(info, null, session);
            fail("An exception should have been thrown above");
        } catch (IllegalArgumentException e) {
View Full Code Here

    }

    @Test
    public void testLoadImageGoodMime() throws ImageException, IOException {
        ImageContext context = MockImageContext.newSafeInstance();
        ImageSessionContext session = new MockImageSessionContext(context);
        ImageInfo info = new ImageInfo("basn2c08.png", MimeConstants.MIME_PNG);
        Image im = ilrpng.loadImage(info, null, session);
        assertTrue(im instanceof ImageRawPNG);
    }
View Full Code Here

TOP

Related Classes of org.apache.xmlgraphics.image.loader.MockImageSessionContext

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.