//expected
}
}
public void testRendererLevel() throws Exception {
FopFactory fopFactory = FopFactory.newInstance();
RendererFactory factory = fopFactory.getRendererFactory();
FOUserAgent ua;
Renderer renderer;
Renderer overrideRenderer;
ua = fopFactory.newFOUserAgent();
renderer = factory.createRenderer(ua, MimeConstants.MIME_PDF);
assertTrue(renderer instanceof IFRenderer);
factory.setRendererPreferred(true); //Test legacy setting
ua = fopFactory.newFOUserAgent();
renderer = factory.createRenderer(ua, MimeConstants.MIME_PDF);
assertTrue(renderer instanceof PDFRenderer);
ua = fopFactory.newFOUserAgent();
renderer = factory.createRenderer(ua, MimeConstants.MIME_FOP_IF);
assertTrue(renderer instanceof IFRenderer);
factory.setRendererPreferred(false);
ua = fopFactory.newFOUserAgent();
overrideRenderer = new PDFRenderer();
overrideRenderer.setUserAgent(ua);
ua.setRendererOverride(overrideRenderer);
renderer = factory.createRenderer(ua, null);
assertTrue(renderer == overrideRenderer);
ua = fopFactory.newFOUserAgent();
IFDocumentHandler overrideHandler;
overrideHandler = new PDFDocumentHandler();
overrideHandler.setContext(new IFContext(ua));
ua.setDocumentHandlerOverride(overrideHandler);
renderer = factory.createRenderer(ua, null);
assertTrue(renderer instanceof IFRenderer);
ua = fopFactory.newFOUserAgent();
try {
renderer = factory.createRenderer(ua, "invalid/format");
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException uoe) {
//expected