You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PCLRendererConfigParserTestCase.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.render.pcl;
  19. import org.junit.Test;
  20. import static org.junit.Assert.assertEquals;
  21. import org.apache.fop.apps.AbstractRendererConfigParserTester;
  22. import org.apache.fop.apps.FOPException;
  23. import org.apache.fop.apps.MimeConstants;
  24. import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser;
  25. public class PCLRendererConfigParserTestCase
  26. extends AbstractRendererConfigParserTester<PCLRendererConfBuilder, PCLRendererConfig> {
  27. public PCLRendererConfigParserTestCase() {
  28. super(new PCLRendererConfigParser(), PCLRendererConfBuilder.class);
  29. }
  30. @Test
  31. public void testGetMimeType() throws Exception {
  32. assertEquals(MimeConstants.MIME_PCL, new PCLRendererConfigParser().getMimeType());
  33. }
  34. @Test
  35. public void testRenderingMode() throws Exception {
  36. parseConfig();
  37. assertEquals(null, conf.getRenderingMode());
  38. parseConfig(createRenderer().setRenderingMode(PCLRenderingMode.QUALITY));
  39. assertEquals(PCLRenderingMode.QUALITY, conf.getRenderingMode());
  40. }
  41. @Test(expected = FOPException.class)
  42. public void testRenderingModeException() throws Exception {
  43. parseConfig(createRenderer().setRenderingMode("whatever"));
  44. }
  45. @Test
  46. public void testTextRendering() throws Exception {
  47. parseConfig();
  48. assertEquals(false, conf.isTextRendering());
  49. parseConfig(createRenderer().setTextRendering("auto"));
  50. assertEquals(false, conf.isTextRendering());
  51. parseConfig(createRenderer().setTextRendering("bitmap"));
  52. assertEquals(true, conf.isTextRendering());
  53. }
  54. @Test(expected = FOPException.class)
  55. public void testTextRenderingException() throws Exception {
  56. parseConfig(createRenderer().setTextRendering("whatever"));
  57. }
  58. @Test
  59. public void testDisablePJL() throws Exception {
  60. parseConfig();
  61. assertEquals(false, conf.isDisablePjl());
  62. parseConfig(createRenderer().setDisablePjl(true));
  63. assertEquals(true, conf.isDisablePjl());
  64. }
  65. }