}
public void testSVG() throws Exception {
String uri = "test/resources/images/img-w-size.svg";
FOUserAgent userAgent = fopFactory.newFOUserAgent();
ImageManager manager = fopFactory.getImageManager();
ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext());
assertNotNull("ImageInfo must not be null", info);
Image img = manager.getImage(info, ImageFlavor.XML_DOM,
userAgent.getImageSessionContext());
assertNotNull("Image must not be null", img);
assertEquals(ImageFlavor.XML_DOM, img.getFlavor());
ImageXMLDOM imgDom = (ImageXMLDOM)img;
assertNotNull(imgDom.getDocument());
assertEquals("http://www.w3.org/2000/svg", imgDom.getRootNamespace());
info = imgDom.getInfo(); //Switch to the ImageInfo returned by the image
assertEquals(16000, info.getSize().getWidthMpt());
assertEquals(16000, info.getSize().getHeightMpt());
img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE,
userAgent.getImageSessionContext());
assertNotNull("Image must not be null", img);
assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor());
ImageRendered imgRed = (ImageRendered)img;
assertNotNull(imgRed.getRenderedImage());
if (DEBUG_TARGET_DIR != null) {
ImageWriterUtil.saveAsPNG(imgRed.getRenderedImage(),
(int)userAgent.getTargetResolution(),
new File(DEBUG_TARGET_DIR, "out.svg.png"));
}
assertEquals(67, imgRed.getRenderedImage().getWidth());
assertEquals(67, imgRed.getRenderedImage().getHeight());
info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image