aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMehdi Houshmand <mehdi@apache.org>2012-06-26 12:31:50 +0000
committerMehdi Houshmand <mehdi@apache.org>2012-06-26 12:31:50 +0000
commitc9f6e74ddf229f879ea7df1b389d6018286ca1aa (patch)
treead95d6d23e332d8320964a843c366b58c1b455bd /test
parent13a68b516babeccef8772be65b83b3de35e854e7 (diff)
downloadxmlgraphics-fop-c9f6e74ddf229f879ea7df1b389d6018286ca1aa.tar.gz
xmlgraphics-fop-c9f6e74ddf229f879ea7df1b389d6018286ca1aa.zip
Improved the handling of defaults for PDF config and general clean up
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_URI_Unification@1353992 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/java/org/apache/fop/afp/AFPTestSuite.java1
-rw-r--r--test/java/org/apache/fop/apps/AFPRendererConfBuilder.java40
-rw-r--r--test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java10
-rw-r--r--test/java/org/apache/fop/apps/PDFRendererConfBuilder.java30
-rw-r--r--test/java/org/apache/fop/apps/PSRendererConfBuilder.java10
-rw-r--r--test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java2
-rw-r--r--test/java/org/apache/fop/apps/TxtRendererConfBuilder.java2
-rw-r--r--test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java16
-rw-r--r--test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java14
-rw-r--r--test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java8
-rw-r--r--test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java13
-rw-r--r--test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java71
-rw-r--r--test/java/org/apache/fop/render/pdf/PDFRendererConfiguratorTestCase.java246
-rw-r--r--test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java123
-rw-r--r--test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java4
-rw-r--r--test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java4
-rw-r--r--test/java/org/apache/fop/svg/PDFGraphics2DTestCase.java48
17 files changed, 283 insertions, 359 deletions
diff --git a/test/java/org/apache/fop/afp/AFPTestSuite.java b/test/java/org/apache/fop/afp/AFPTestSuite.java
index 32d61cb35..ac983f2db 100644
--- a/test/java/org/apache/fop/afp/AFPTestSuite.java
+++ b/test/java/org/apache/fop/afp/AFPTestSuite.java
@@ -31,7 +31,6 @@ import org.apache.fop.afp.modca.IncludeObjectTestCase;
@RunWith(Suite.class)
@SuiteClasses({
IncludeObjectTestCase.class,
- AFPResourceUtilTestCase.class,
AFPObjectAreaInfoTestCase.class,
AFPPaintingStateTestCase.class
})
diff --git a/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java b/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java
index 5e7204f9e..4bb3b71dd 100644
--- a/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java
+++ b/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java
@@ -25,25 +25,25 @@ import org.w3c.dom.Element;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
import org.apache.fop.render.afp.AFPRendererConfig;
-import org.apache.fop.render.afp.AFPRendererConfigOption;
+import org.apache.fop.render.afp.AFPRendererOption;
import org.apache.fop.render.afp.AFPShadingMode;
import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.DEFAULT_RESOURCE_LEVELS;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_DITHERING_QUALITY;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_FS45;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_JPEG;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_MAPPING_OPTION;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_MODE;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_NATIVE;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_WRAP_PSEG;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.JPEG_ALLOW_JPEG_EMBEDDING;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.JPEG_BITMAP_ENCODING_QUALITY;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.LINE_WIDTH_CORRECTION;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.RENDERER_RESOLUTION;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.RESOURCE_GROUP_URI;
-import static org.apache.fop.render.afp.AFPRendererConfigOption.SHADING;
+import static org.apache.fop.render.afp.AFPRendererOption.DEFAULT_RESOURCE_LEVELS;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_DITHERING_QUALITY;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_FS45;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_JPEG;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_MAPPING_OPTION;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_MODE;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_NATIVE;
+import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_WRAP_PSEG;
+import static org.apache.fop.render.afp.AFPRendererOption.JPEG_ALLOW_JPEG_EMBEDDING;
+import static org.apache.fop.render.afp.AFPRendererOption.JPEG_BITMAP_ENCODING_QUALITY;
+import static org.apache.fop.render.afp.AFPRendererOption.LINE_WIDTH_CORRECTION;
+import static org.apache.fop.render.afp.AFPRendererOption.RENDERER_RESOLUTION;
+import static org.apache.fop.render.afp.AFPRendererOption.RESOURCE_GROUP_URI;
+import static org.apache.fop.render.afp.AFPRendererOption.SHADING;
/**
* A config builder specific to a particular renderer for specific MIME type.
@@ -56,7 +56,7 @@ public final class AFPRendererConfBuilder extends RendererConfBuilder {
super(MimeConstants.MIME_AFP);
}
- private AFPRendererConfBuilder createTextElement(AFPRendererConfigOption option, String value) {
+ private AFPRendererConfBuilder createTextElement(AFPRendererOption option, String value) {
createTextElement(option.getName(), value);
return this;
}
@@ -153,7 +153,11 @@ public final class AFPRendererConfBuilder extends RendererConfBuilder {
return AFPRendererConfBuilder.this.endImages();
}
- private ImagesBuilder setAttribute(AFPRendererConfigOption options, Object value) {
+ private ImagesBuilder setAttribute(AFPRendererOption options, String value) {
+ return setAttribute(options.getName(), value);
+ }
+
+ private ImagesBuilder setAttribute(AFPRendererOption options, Object value) {
return setAttribute(options.getName(), value);
}
diff --git a/test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java b/test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java
index b0e468be0..9ea2a4e9e 100644
--- a/test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java
+++ b/test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java
@@ -21,11 +21,11 @@ package org.apache.fop.apps;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.ANTI_ALIASING;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.BACKGROUND_COLOR;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY_ELEMENT;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.ANTI_ALIASING;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.BACKGROUND_COLOR;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY_ELEMENT;
public class BitmapRendererConfBuilder extends RendererConfBuilder {
diff --git a/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java b/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java
index bf16c59ca..13ca3df6b 100644
--- a/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java
+++ b/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java
@@ -22,19 +22,21 @@ package org.apache.fop.apps;
import org.w3c.dom.Element;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
+import org.apache.fop.pdf.PDFEncryptionParams;
import org.apache.fop.render.RendererConfigOption;
-import org.apache.fop.render.pdf.PDFRendererConfigOption;
-
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.DISABLE_SRGB_COLORSPACE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_LENGTH;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_PARAMS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.FILTER_LIST;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.OUTPUT_PROFILE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.OWNER_PASSWORD;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_A_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_X_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.USER_PASSWORD;
-import static org.apache.fop.render.pdf.PDFRendererConfigOption.VERSION;
+import org.apache.fop.render.pdf.PDFEncryptionOption;
+import org.apache.fop.render.pdf.PDFRendererOption;
+
+import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_LENGTH;
+import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_PARAMS;
+import static org.apache.fop.render.pdf.PDFEncryptionOption.OWNER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFEncryptionOption.USER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFRendererOption.DISABLE_SRGB_COLORSPACE;
+import static org.apache.fop.render.pdf.PDFRendererOption.FILTER_LIST;
+import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE;
+import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE;
+import static org.apache.fop.render.pdf.PDFRendererOption.PDF_X_MODE;
+import static org.apache.fop.render.pdf.PDFRendererOption.VERSION;
/**
* A config builder specific to a particular renderer for specific MIME type.
@@ -97,7 +99,7 @@ public final class PDFRendererConfBuilder extends RendererConfBuilder {
private final Element el;
private EncryptionParamsBuilder() {
- el = createElement(ENCRYPTION_PARAMS.getName());
+ el = createElement(ENCRYPTION_PARAMS);
}
public EncryptionParamsBuilder setEncryptionLength(int length) {
@@ -115,7 +117,7 @@ public final class PDFRendererConfBuilder extends RendererConfBuilder {
return this;
}
- public EncryptionParamsBuilder setAllowParam(PDFRendererConfigOption option) {
+ public EncryptionParamsBuilder setAllowParam(PDFEncryptionOption option) {
el.appendChild(createElement(option.getName()));
return this;
}
diff --git a/test/java/org/apache/fop/apps/PSRendererConfBuilder.java b/test/java/org/apache/fop/apps/PSRendererConfBuilder.java
index 2fec155ff..92d2ce45e 100644
--- a/test/java/org/apache/fop/apps/PSRendererConfBuilder.java
+++ b/test/java/org/apache/fop/apps/PSRendererConfBuilder.java
@@ -21,11 +21,11 @@ package org.apache.fop.apps;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import static org.apache.fop.render.ps.PSRendererConfigurationOption.AUTO_ROTATE_LANDSCAPE;
-import static org.apache.fop.render.ps.PSRendererConfigurationOption.DSC_COMPLIANT;
-import static org.apache.fop.render.ps.PSRendererConfigurationOption.LANGUAGE_LEVEL;
-import static org.apache.fop.render.ps.PSRendererConfigurationOption.OPTIMIZE_RESOURCES;
-import static org.apache.fop.render.ps.PSRendererConfigurationOption.SAFE_SET_PAGE_DEVICE;
+import static org.apache.fop.render.ps.PSRendererOption.AUTO_ROTATE_LANDSCAPE;
+import static org.apache.fop.render.ps.PSRendererOption.DSC_COMPLIANT;
+import static org.apache.fop.render.ps.PSRendererOption.LANGUAGE_LEVEL;
+import static org.apache.fop.render.ps.PSRendererOption.OPTIMIZE_RESOURCES;
+import static org.apache.fop.render.ps.PSRendererOption.SAFE_SET_PAGE_DEVICE;
/**
* A fop conf builder specific to a particular renderer for Postscript.
diff --git a/test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java b/test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java
index 0ae06e62f..8b72a558d 100644
--- a/test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java
+++ b/test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java
@@ -19,7 +19,7 @@
package org.apache.fop.apps;
-import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigOption.COMPRESSION;
+import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.COMPRESSION;
public class TIFFRendererConfBuilder extends BitmapRendererConfBuilder {
diff --git a/test/java/org/apache/fop/apps/TxtRendererConfBuilder.java b/test/java/org/apache/fop/apps/TxtRendererConfBuilder.java
index 3e022762a..816b59b11 100644
--- a/test/java/org/apache/fop/apps/TxtRendererConfBuilder.java
+++ b/test/java/org/apache/fop/apps/TxtRendererConfBuilder.java
@@ -21,7 +21,7 @@ package org.apache.fop.apps;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import static org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigOption.ENCODING;
+import static org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption.ENCODING;
public class TxtRendererConfBuilder extends RendererConfBuilder {
diff --git a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java
index 312ee43c5..04f872a84 100644
--- a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java
+++ b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java
@@ -28,14 +28,14 @@ import org.apache.fop.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.BitmapRendererConfBuilder;
import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BILEVEL;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BINARY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_GRAY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGB;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGBA;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_SPEED;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BILEVEL;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BINARY;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_GRAY;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGB;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGBA;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
diff --git a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java
index 2e2bccc36..3e0c8c203 100644
--- a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java
+++ b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java
@@ -28,13 +28,13 @@ import org.apache.fop.apps.BitmapRendererConfBuilder;
import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.util.ColorUtil;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BILEVEL;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BINARY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_GRAY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGB;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGBA;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_SPEED;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BILEVEL;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BINARY;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_GRAY;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGB;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGBA;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY;
+import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
diff --git a/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java b/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java
index b0f1f46b7..1265526a4 100644
--- a/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java
+++ b/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java
@@ -23,9 +23,9 @@ package org.apache.fop.render.pcl;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
import org.apache.fop.apps.MimeConstants;
-import static org.apache.fop.render.pcl.Java2DRendererConfigOption.DISABLE_PJL;
-import static org.apache.fop.render.pcl.Java2DRendererConfigOption.RENDERING_MODE;
-import static org.apache.fop.render.pcl.Java2DRendererConfigOption.TEXT_RENDERING;
+import static org.apache.fop.render.pcl.Java2DRendererOption.DISABLE_PJL;
+import static org.apache.fop.render.pcl.Java2DRendererOption.RENDERING_MODE;
+import static org.apache.fop.render.pcl.Java2DRendererOption.TEXT_RENDERING;
/**
* A config builder specific to a particular renderer for specific MIME type.
*/
@@ -51,7 +51,7 @@ public final class PCLRendererConfBuilder extends RendererConfBuilder {
return createTextElement(DISABLE_PJL, String.valueOf(value));
}
- private PCLRendererConfBuilder createTextElement(Java2DRendererConfigOption option, String value) {
+ private PCLRendererConfBuilder createTextElement(Java2DRendererOption option, String value) {
createTextElement(option.getName(), value);
return this;
}
diff --git a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java
index 330be148c..94c842e68 100644
--- a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java
+++ b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java
@@ -19,8 +19,6 @@
package org.apache.fop.render.pdf;
-import static org.junit.Assert.fail;
-
import java.io.File;
import java.io.IOException;
@@ -30,6 +28,8 @@ import org.xml.sax.SAXException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.pdf.PDFConformanceException;
+import static org.junit.Assert.fail;
+
/**
* Tests PDF/A-1 functionality.
*/
@@ -66,17 +66,12 @@ public class PDFAConformanceTestCase extends BasePDFTest {
* Test exception when PDF/A-1 is enabled together with encryption.
* @throws Exception if the test fails
*/
- @Test
+ @Test(expected = PDFConformanceException.class)
public void testNoEncryption() throws Exception {
final FOUserAgent ua = getUserAgent();
ua.getRendererOptions().put("owner-password", "mypassword"); //To enabled encryption
File foFile = new File(foBaseDir, "minimal-pdf-a.fo");
- try {
- convertFO(foFile, ua, dumpPDF);
- fail("Expected PDFConformanceException. PDF/A-1 and PDF encryption don't go together.");
- } catch (PDFConformanceException e) {
- //Good!
- }
+ convertFO(foFile, ua, dumpPDF);
}
/**
diff --git a/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java
index 366525ea9..2d21b399c 100644
--- a/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java
+++ b/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java
@@ -22,8 +22,6 @@ package org.apache.fop.render.pdf;
import org.junit.Test;
import org.apache.fop.apps.AbstractRendererConfigParserTester;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.apps.FopConfBuilder;
import org.apache.fop.apps.PDFRendererConfBuilder;
import org.apache.fop.pdf.PDFAMode;
import org.apache.fop.pdf.PDFXMode;
@@ -48,11 +46,10 @@ public class PDFRendererConfigParserTestCase
.startEncryptionParams()
.setUserPassword(testPassword)
.endEncryptionParams());
- assertEquals(testPassword, conf.getEncryptionParameters().getUserPassword());
+ assertEquals(testPassword, conf.getConfigOptions().getEncryptionParameters().getUserPassword());
}
- private void testRestrictEncryptionParameter(PDFRendererConfigOption option)
- throws Exception {
+ private void testRestrictEncryptionParameter(PDFEncryptionOption option) throws Exception {
parseConfig(createRenderer().startEncryptionParams()
.setAllowParam(option)
.endEncryptionParams());
@@ -62,24 +59,24 @@ public class PDFRendererConfigParserTestCase
assertTrue(testEncryptionParameter(option));
}
- public boolean testEncryptionParameter(PDFRendererConfigOption option) throws Exception {
+ public boolean testEncryptionParameter(PDFEncryptionOption option) throws Exception {
switch (option) {
case NO_PRINT:
- return conf.getEncryptionParameters().isAllowPrint();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowPrint();
case NO_ACCESSCONTENT:
- return conf.getEncryptionParameters().isAllowAccessContent();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowAccessContent();
case NO_ANNOTATIONS:
- return conf.getEncryptionParameters().isAllowEditAnnotations();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowEditAnnotations();
case NO_ASSEMBLEDOC:
- return conf.getEncryptionParameters().isAllowAssembleDocument();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowAssembleDocument();
case NO_COPY_CONTENT:
- return conf.getEncryptionParameters().isAllowCopyContent();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowCopyContent();
case NO_EDIT_CONTENT:
- return conf.getEncryptionParameters().isAllowEditContent();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowEditContent();
case NO_FILLINFORMS:
- return conf.getEncryptionParameters().isAllowFillInForms();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowFillInForms();
case NO_PRINTHQ:
- return conf.getEncryptionParameters().isAllowPrintHq();
+ return conf.getConfigOptions().getEncryptionParameters().isAllowPrintHq();
default:
throw new IllegalStateException("Wrong parameter given");
}
@@ -88,14 +85,14 @@ public class PDFRendererConfigParserTestCase
@Test
public void testAllEncryptionRestrictions() throws Exception {
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_PRINT);
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_ACCESSCONTENT);
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_ANNOTATIONS);
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_ASSEMBLEDOC);
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_COPY_CONTENT);
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_EDIT_CONTENT);
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_FILLINFORMS);
- testRestrictEncryptionParameter(PDFRendererConfigOption.NO_PRINTHQ);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_PRINT);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_ACCESSCONTENT);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_ANNOTATIONS);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_ASSEMBLEDOC);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_COPY_CONTENT);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_EDIT_CONTENT);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_FILLINFORMS);
+ testRestrictEncryptionParameter(PDFEncryptionOption.NO_PRINTHQ);
}
@Test
@@ -105,47 +102,47 @@ public class PDFRendererConfigParserTestCase
.startEncryptionParams()
.setOwnerPassword(testPassword)
.endEncryptionParams());
- assertEquals(testPassword, conf.getEncryptionParameters().getOwnerPassword());
+ assertEquals(testPassword, conf.getConfigOptions().getEncryptionParameters().getOwnerPassword());
}
@Test
public void testFilterListDefaultFlate() throws Exception {
parseConfig(createRenderer().createFilterList(null, "flate"));
- assertEquals("flate", conf.getFilterMap().get("default").get(0));
+ assertEquals("flate", conf.getConfigOptions().getFilterMap().get("default").get(0));
}
@Test
public void testFilterListDefaultNull() throws Exception {
parseConfig(createRenderer().createFilterList(null, "null"));
- assertEquals("null", conf.getFilterMap().get("default").get(0));
+ assertEquals("null", conf.getConfigOptions().getFilterMap().get("default").get(0));
}
@Test
public void testFilterListImage() throws Exception {
parseConfig(createRenderer().createFilterList("image", "flate", "ascii-85"));
- assertEquals("flate", conf.getFilterMap().get("image").get(0));
- assertEquals("ascii-85", conf.getFilterMap().get("image").get(1));
+ assertEquals("flate", conf.getConfigOptions().getFilterMap().get("image").get(0));
+ assertEquals("ascii-85", conf.getConfigOptions().getFilterMap().get("image").get(1));
}
@Test
public void testPDFAMode() throws Exception {
parseConfig(createRenderer().setPDFAMode(PDFAMode.PDFA_1A.getName()));
- assertEquals(PDFAMode.PDFA_1A, conf.getPDFAMode());
+ assertEquals(PDFAMode.PDFA_1A, conf.getConfigOptions().getPDFAMode());
parseConfig(createRenderer().setPDFAMode(PDFAMode.PDFA_1B.getName()));
- assertEquals(PDFAMode.PDFA_1B, conf.getPDFAMode());
+ assertEquals(PDFAMode.PDFA_1B, conf.getConfigOptions().getPDFAMode());
parseConfig(createRenderer().setPDFAMode(PDFAMode.DISABLED.getName()));
- assertEquals(null, conf.getPDFAMode());
+ assertEquals(null, conf.getConfigOptions().getPDFAMode());
}
@Test
public void testPDFXMode() throws Exception {
parseConfig(createRenderer().setPDFXMode(PDFXMode.PDFX_3_2003.getName()));
- assertEquals(PDFXMode.PDFX_3_2003, conf.getPDFXMode());
+ assertEquals(PDFXMode.PDFX_3_2003, conf.getConfigOptions().getPDFXMode());
parseConfig(createRenderer().setPDFXMode(PDFXMode.DISABLED.getName()));
- assertEquals(null, conf.getPDFXMode());
+ assertEquals(null, conf.getConfigOptions().getPDFXMode());
}
@Test
@@ -155,7 +152,7 @@ public class PDFRendererConfigParserTestCase
.startEncryptionParams()
.setEncryptionLength(i)
.endEncryptionParams());
- assertEquals(40, conf.getEncryptionParameters().getEncryptionLengthInBits());
+ assertEquals(40, conf.getConfigOptions().getEncryptionParameters().getEncryptionLengthInBits());
}
for (int i = 40; i <= 128; i++) {
@@ -164,7 +161,7 @@ public class PDFRendererConfigParserTestCase
.setEncryptionLength(i)
.endEncryptionParams());
int expectedLen = Math.round(i / 8.0f) * 8;
- assertEquals(expectedLen, conf.getEncryptionParameters()
+ assertEquals(expectedLen, conf.getConfigOptions().getEncryptionParameters()
.getEncryptionLengthInBits());
}
@@ -173,7 +170,7 @@ public class PDFRendererConfigParserTestCase
.startEncryptionParams()
.setEncryptionLength(i)
.endEncryptionParams());
- assertEquals(128, conf.getEncryptionParameters().getEncryptionLengthInBits());
+ assertEquals(128, conf.getConfigOptions().getEncryptionParameters().getEncryptionLengthInBits());
}
}
@@ -186,7 +183,7 @@ public class PDFRendererConfigParserTestCase
private void pdfVersionTester(String version) throws Exception {
parseConfig(createRenderer().setPDFVersion(version));
- assertEquals(Version.getValueOf(version), conf.getPDFVersion());
+ assertEquals(Version.getValueOf(version), conf.getConfigOptions().getPDFVersion());
}
@Test(expected = IllegalArgumentException.class)
@@ -199,7 +196,7 @@ public class PDFRendererConfigParserTestCase
pdfVersionTester("0.9");
}
- @Test(expected = FOPException.class)
+ @Test(expected = IllegalArgumentException.class)
public void testErroneousPDFVersionsNotSet() throws Exception {
pdfVersionTester("");
}
diff --git a/test/java/org/apache/fop/render/pdf/PDFRendererConfiguratorTestCase.java b/test/java/org/apache/fop/render/pdf/PDFRendererConfiguratorTestCase.java
deleted file mode 100644
index 93a48a62b..000000000
--- a/test/java/org/apache/fop/render/pdf/PDFRendererConfiguratorTestCase.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.pdf;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.Test;
-import org.xml.sax.SAXException;
-
-import org.apache.xmlgraphics.util.MimeConstants;
-
-import org.apache.fop.apps.AbstractRendererConfiguratorTest;
-import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import org.apache.fop.apps.FopFactory;
-import org.apache.fop.apps.PDFRendererConfBuilder;
-import org.apache.fop.events.Event;
-import org.apache.fop.events.EventListener;
-import org.apache.fop.pdf.PDFAMode;
-import org.apache.fop.pdf.PDFEncryptionParams;
-import org.apache.fop.pdf.PDFXMode;
-import org.apache.fop.pdf.Version;
-import org.apache.fop.render.pdf.PDFRendererConfig.PDFRendererConfigParser;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * Tests that encryption length is properly set up.
- */
-public class PDFRendererConfiguratorTestCase extends
- AbstractRendererConfiguratorTest<PDFRendererConfigurator, PDFRendererConfBuilder> {
- private boolean eventTriggered;
- private PDFRenderingUtil pdfUtil;
-
- public PDFRendererConfiguratorTestCase() {
- super(MimeConstants.MIME_PDF, PDFRendererConfBuilder.class, PDFDocumentHandler.class);
- }
-
- @Override
- protected PDFRendererConfigurator createConfigurator() {
- return new PDFRendererConfigurator(userAgent, new PDFRendererConfigParser());
- }
-
- @Override
- public void setUpDocumentHandler() {
- pdfUtil = new PDFRenderingUtil(userAgent);
- when(((PDFDocumentHandler) docHandler).getPDFUtil()).thenReturn(pdfUtil);
- }
-
- private void parseConfig(RendererConfBuilder builder, EventListener listener)
- throws SAXException, IOException {
- parseConfigWithUtil(builder, listener, false);
- }
-
- private void parseConfigWithUtil(RendererConfBuilder builder, EventListener listener,
- boolean mockUtil) throws SAXException, IOException {
- userAgent = FopFactory.newInstance(
- new File(".").toURI(), builder.endRendererConfig().build()).newFOUserAgent();
- userAgent.getEventBroadcaster().addEventListener(listener);
- if (mockUtil) {
- this.pdfUtil = mock(PDFRenderingUtil.class);
- when(((PDFDocumentHandler) docHandler).getPDFUtil()).thenReturn(pdfUtil);
- } else {
- setUpDocumentHandler();
- }
- sut = createConfigurator();
- sut.configure(docHandler);
- }
-
- private void parseConfigMockUtil(RendererConfBuilder builder)
- throws SAXException, IOException {
- parseConfigWithUtil(builder, null, true);
- }
-
- /**
- * Non-multiple of 8 should be rounded.
- *
- * @throws Exception if an error occurs
- */
- @Test
- public void testRoundUp() throws Exception {
- testEncryptionAndEvent(55, 56);
- }
-
- /**
- * Non-multiple of 8 should be rounded.
- *
- * @throws Exception if an error occurs
- */
- @Test
- public void testRoundDown() throws Exception {
- testEncryptionAndEvent(67, 64);
- }
-
- /**
- * Encryption length must be at least 40.
- *
- * @throws Exception if an error occurs
- */
- @Test
- public void testBelow40() throws Exception {
- testEncryptionAndEvent(32, 40);
- }
-
- /**
- * Encryption length must be at most 128.
- *
- * @throws Exception if an error occurs
- */
- @Test
- public void testAbove128() throws Exception {
- testEncryptionAndEvent(233, 128);
- }
-
- /**
- * A correct value must be properly set up.
- *
- * @throws Exception if an error occurs
- */
- @Test
- public void testCorrectValue() throws Exception {
- runEncryptionTest(128, 128);
- }
-
- private void testEncryptionAndEvent(int specifiedEncryptionLength,
- int actualEncryptionLength) throws Exception {
- runEncryptionTest(specifiedEncryptionLength, actualEncryptionLength);
- assertTrue(eventTriggered);
- }
-
- private void runEncryptionTest(int specifiedEncryptionLength, int actualEncryptionLength)
- throws Exception {
- parseConfig(createBuilder().startEncryptionParams()
- .setEncryptionLength(specifiedEncryptionLength)
- .endEncryptionParams(),
- new EncryptionEventFilter(specifiedEncryptionLength, actualEncryptionLength));
- thenEncryptionLengthShouldBe(actualEncryptionLength);
- }
-
- private void thenEncryptionLengthShouldBe(int expectedEncryptionLength) {
- PDFEncryptionParams encryptionParams = pdfUtil.getEncryptionParams();
- assertEquals(expectedEncryptionLength, encryptionParams.getEncryptionLengthInBits());
- }
-
- private class EncryptionEventFilter implements EventListener {
-
- private final int specifiedEncryptionLength;
-
- private final int correctedEncryptionLength;
-
- EncryptionEventFilter(int specifiedEncryptionLength, int correctedEncryptionLength) {
- this.specifiedEncryptionLength = specifiedEncryptionLength;
- this.correctedEncryptionLength = correctedEncryptionLength;
- }
-
- public void processEvent(Event event) {
- assertEquals(PDFEventProducer.class.getName() + ".incorrectEncryptionLength",
- event.getEventID());
- assertEquals(specifiedEncryptionLength, event.getParam("originalValue"));
- assertEquals(correctedEncryptionLength, event.getParam("correctedValue"));
- eventTriggered = true;
- }
- }
-
- @Test
- public void testFilterMaps() throws Exception {
- parseConfig(createBuilder().createFilterList("image", "flate", "ascii-85"));
- OutputStream outStream = mock(OutputStream.class);
- Map<String, List<String>> filterMap = pdfUtil.setupPDFDocument(outStream).getFilterMap();
- assertEquals("flate", filterMap.get("image").get(0));
- assertEquals("ascii-85", filterMap.get("image").get(1));
- }
-
- @Test
- public void testPDFAMode() throws Exception {
- parseConfigMockUtil(createBuilder().setPDFAMode(PDFAMode.DISABLED.getName()));
- // DISABLED is the default setting, it doesn't need to be set
- verify(pdfUtil, times(0)).setAMode(PDFAMode.DISABLED);
-
- parseConfigMockUtil(createBuilder().setPDFAMode(PDFAMode.PDFA_1A.getName()));
- verify(pdfUtil, times(1)).setAMode(PDFAMode.PDFA_1A);
-
- parseConfigMockUtil(createBuilder().setPDFAMode(PDFAMode.PDFA_1B.getName()));
- verify(pdfUtil, times(1)).setAMode(PDFAMode.PDFA_1B);
- }
-
- @Test
- public void testPDFXMode() throws Exception {
- parseConfigMockUtil(createBuilder().setPDFXMode(PDFXMode.DISABLED.getName()));
- // DISABLED is the default setting, it doesn't need to be set
- verify(pdfUtil, times(0)).setXMode(PDFXMode.DISABLED);
-
- parseConfigMockUtil(createBuilder().setPDFXMode(PDFXMode.PDFX_3_2003.getName()));
- verify(pdfUtil, times(1)).setXMode(PDFXMode.PDFX_3_2003);
- }
-
- @Test
- public void testSetProfile() throws Exception {
- String testString = "this.uri.is.purely.for.testing.and.has.no.contextual.meaning";
- parseConfigMockUtil(createBuilder().setOutputProfile(testString));
- verify(pdfUtil).setOutputProfileURI(URI.create(testString));
- }
-
- @Test
- public void testDisableSRGBColourspace() throws Exception {
- parseConfigMockUtil(createBuilder().disableSRGBColorSpace(true));
- verify(pdfUtil).setDisableSRGBColorSpace(true);
-
- parseConfigMockUtil(createBuilder().disableSRGBColorSpace(false));
- verify(pdfUtil, times(0)).setDisableSRGBColorSpace(false);
- }
-
- @Test
- public void testPDFVersion() throws Exception {
- for (Version version : Version.values()) {
- parseConfigMockUtil(createBuilder().setPDFVersion(version.toString()));
- verify(pdfUtil).setPDFVersion(version);
- }
- }
-}
diff --git a/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java b/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java
new file mode 100644
index 000000000..489d4dc96
--- /dev/null
+++ b/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.pdf;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+
+import org.apache.fop.pdf.PDFAMode;
+import org.apache.fop.pdf.PDFEncryptionParams;
+import org.apache.fop.pdf.PDFXMode;
+import org.apache.fop.pdf.Version;
+
+import static org.apache.fop.render.pdf.PDFRendererOption.DISABLE_SRGB_COLORSPACE;
+import static org.apache.fop.render.pdf.PDFRendererOption.FILTER_LIST;
+import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE;
+import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE;
+import static org.apache.fop.render.pdf.PDFRendererOption.PDF_X_MODE;
+import static org.apache.fop.render.pdf.PDFRendererOption.VERSION;
+import static org.junit.Assert.assertEquals;
+
+public class PDFRendererOptionsConfigTestCase {
+
+ private static final Map<PDFRendererOption, Object> DEFAULT_OPTIONS;
+
+ private static final PDFEncryptionParams DEFAULT_ENCRYPTION_PARAMS = null;
+
+ static {
+ final EnumMap<PDFRendererOption, Object> props
+ = new EnumMap<PDFRendererOption, Object>(PDFRendererOption.class);
+ for(PDFRendererOption option : PDFRendererOption.values()) {
+ props.put(option, option.getDefaultValue());
+ }
+ DEFAULT_OPTIONS = Collections.unmodifiableMap(props);
+ }
+
+ @Test
+ public void testDefaults() {
+ assertConfigEquals(DEFAULT_OPTIONS, DEFAULT_ENCRYPTION_PARAMS, PDFRendererOptionsConfig.DEFAULT);
+ }
+
+ @Test
+ public void testConstructor() throws URISyntaxException {
+ final Map<PDFRendererOption, Object> options = createNonDefaultOptions();
+ final PDFEncryptionParams encryptionParams = new PDFEncryptionParams();
+ assertConfigEquals(options, encryptionParams, new PDFRendererOptionsConfig(options, encryptionParams));
+ }
+
+ @Test
+ public void testMerge() throws URISyntaxException {
+ final PDFRendererOptionsConfig defaults = PDFRendererOptionsConfig.DEFAULT;
+ final PDFEncryptionParams encryptionParams = new PDFEncryptionParams();
+ final Map<PDFRendererOption, Object> options = createNonDefaultOptions();
+ final PDFRendererOptionsConfig otherConfig = new PDFRendererOptionsConfig(options, encryptionParams);
+ assertConfigEquals(options, encryptionParams, defaults.merge(otherConfig));
+ assertEquals(defaults, defaults.merge(null));
+ }
+
+ private Map<PDFRendererOption, Object> createNonDefaultOptions() throws URISyntaxException {
+ final EnumMap<PDFRendererOption, Object> options
+ = new EnumMap<PDFRendererOption, Object>(PDFRendererOption.class);
+ options.put(DISABLE_SRGB_COLORSPACE, Boolean.TRUE);
+ options.put(FILTER_LIST, new HashMap<String, List<String>>());
+ options.put(OUTPUT_PROFILE, new URI("xxx"));
+ options.put(PDF_A_MODE, PDFAMode.PDFA_1A);
+ options.put(PDF_X_MODE, PDFXMode.PDFX_3_2003);
+ options.put(VERSION, Version.V1_0);
+ return Collections.unmodifiableMap(options);
+ }
+
+ private static void assertConfigEquals(Map<PDFRendererOption, Object> expectedOptions,
+ PDFEncryptionParams expectedEncryptionParams, PDFRendererOptionsConfig actual) {
+ assertEquals((Boolean) expectedOptions.get(DISABLE_SRGB_COLORSPACE), actual.getDisableSRGBColorSpace());
+ assertEquals((Map) expectedOptions.get(FILTER_LIST), actual.getFilterMap());
+ assertEquals((URI) expectedOptions.get(OUTPUT_PROFILE), actual.getOutputProfileURI());
+ assertEquals((PDFAMode) expectedOptions.get(PDF_A_MODE), actual.getPDFAMode());
+ assertEquals((PDFXMode) expectedOptions.get(PDF_X_MODE), actual.getPDFXMode());
+ assertEquals((Version) expectedOptions.get(VERSION), actual.getPDFVersion());
+ assertEncryptionParamsEquals(expectedEncryptionParams, actual.getEncryptionParameters());
+ }
+
+ private static void assertEncryptionParamsEquals(PDFEncryptionParams expected,
+ PDFEncryptionParams actual) {
+ assertEquals(expected == null, actual == null);
+ if (actual != null) {
+ assertEquals(expected.getEncryptionLengthInBits(), actual.getEncryptionLengthInBits());
+ assertEquals(expected.getOwnerPassword(), actual.getOwnerPassword());
+ assertEquals(expected.getUserPassword(), actual.getUserPassword());
+ assertEquals(expected.isAllowAccessContent(), actual.isAllowAccessContent());
+ assertEquals(expected.isAllowAssembleDocument(), actual.isAllowAssembleDocument());
+ assertEquals(expected.isAllowCopyContent(), actual.isAllowCopyContent());
+ assertEquals(expected.isAllowEditAnnotations(), actual.isAllowEditAnnotations());
+ assertEquals(expected.isAllowEditContent(), actual.isAllowEditContent());
+ assertEquals(expected.isAllowFillInForms(), actual.isAllowFillInForms());
+ assertEquals(expected.isAllowPrint(), actual.isAllowPrint());
+ assertEquals(expected.isAllowPrintHq(), actual.isAllowPrintHq());
+ }
+ }
+
+}
diff --git a/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java b/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java
index 2279e4fcc..f41520bf3 100644
--- a/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java
+++ b/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java
@@ -28,6 +28,8 @@ import org.junit.runners.Suite.SuiteClasses;
* A test suite for org.apache.fop.render.pdf.*
*/
@RunWith(Suite.class)
-@SuiteClasses({ PDFRendererConfiguratorTestCase.class })
+@SuiteClasses({
+ PDFRendererConfigParserTestCase.class
+})
public final class RenderPDFTestSuite {
}
diff --git a/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java
index 1b8370787..a7ae52c65 100644
--- a/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java
+++ b/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java
@@ -24,7 +24,7 @@ import org.junit.Test;
import org.apache.fop.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.TxtRendererConfBuilder;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigOption;
+import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption;
import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigParser;
import static org.junit.Assert.assertEquals;
@@ -47,7 +47,7 @@ public class TxtRendererConfigParserTestCase
// Check the default behaviour is expected
parseConfig(createRenderer());
- assertEquals(TxtRendererConfigOption.ENCODING.getDefaultValue(), conf.getEncoding());
+ assertEquals(TxtRendererOption.ENCODING.getDefaultValue(), conf.getEncoding());
}
}
diff --git a/test/java/org/apache/fop/svg/PDFGraphics2DTestCase.java b/test/java/org/apache/fop/svg/PDFGraphics2DTestCase.java
new file mode 100644
index 000000000..3f610c56f
--- /dev/null
+++ b/test/java/org/apache/fop/svg/PDFGraphics2DTestCase.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.svg;
+
+import java.awt.BasicStroke;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class PDFGraphics2DTestCase {
+
+ @Test
+ public void testApplyStrokeNullDash() {
+ PDFGraphics2D g2d = new PDFGraphics2D(false);
+ BasicStroke stroke = new BasicStroke();
+ g2d.applyStroke(stroke);
+ assertTrue(g2d.getString().contains("[] 0 d\n"));
+ }
+
+ @Test
+ public void testApplyStrokeNonNullDash() {
+ PDFGraphics2D g2d = new PDFGraphics2D(false);
+ float[] dashArray = {3.0f, 5.0f};
+ BasicStroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f,
+ dashArray, 0.0f);
+ g2d.applyStroke(stroke);
+ assertTrue(g2d.getString().contains("[3 5] 0 d\n"));
+ }
+
+}