aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2023-02-03 08:49:20 +0000
committerSimon Steiner <ssteiner@apache.org>2023-02-03 08:49:20 +0000
commit3cbbfc433707d869a0d407ca9c264ee46a1aab06 (patch)
treefca9b26b35f13e488c7e8212947b6367adac054d
parenta7c2b429051a08ffc65a331a618c859339bb7421 (diff)
downloadxmlgraphics-fop-3cbbfc433707d869a0d407ca9c264ee46a1aab06.tar.gz
xmlgraphics-fop-3cbbfc433707d869a0d407ca9c264ee46a1aab06.zip
FOP-3117: Allow creating a PDF 2.0 document
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1907234 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/Version.java4
-rw-r--r--fop-core/src/test/java/org/apache/fop/pdf/VersionTestCase.java17
2 files changed, 15 insertions, 6 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/Version.java b/fop-core/src/main/java/org/apache/fop/pdf/Version.java
index 4bdc7a1b4..f94959a93 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/Version.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/Version.java
@@ -39,7 +39,9 @@ public enum Version {
/** PDF v1.6 */
V1_6("1.6"),
/** PDF v1.7 */
- V1_7("1.7");
+ V1_7("1.7"),
+ /** PDF v2.0 */
+ V2_0("2.0");
private String version;
diff --git a/fop-core/src/test/java/org/apache/fop/pdf/VersionTestCase.java b/fop-core/src/test/java/org/apache/fop/pdf/VersionTestCase.java
index dd2731d8b..ef01b6489 100644
--- a/fop-core/src/test/java/org/apache/fop/pdf/VersionTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/pdf/VersionTestCase.java
@@ -37,7 +37,11 @@ public class VersionTestCase {
public void testGetValue() {
int index = 0;
for (Version version : Version.values()) {
- assertEquals(version, Version.getValueOf("1." + index++));
+ if (index > 7) {
+ assertEquals(version, Version.getValueOf("2.0"));
+ } else {
+ assertEquals(version, Version.getValueOf("1." + index++));
+ }
}
}
@@ -55,7 +59,11 @@ public class VersionTestCase {
// Test all the normal values
int index = 0;
for (Version version : Version.values()) {
- assertTrue(version.toString().equals("1." + index++));
+ if (index > 7) {
+ assertTrue(version.toString().equals("2.0"));
+ } else {
+ assertTrue(version.toString().equals("1." + index++));
+ }
}
}
@@ -73,16 +81,15 @@ public class VersionTestCase {
Version.V1_4,
Version.V1_5,
Version.V1_6,
- Version.V1_7
+ Version.V1_7,
+ Version.V2_0
};
Version[] actual = Version.values();
for (int i = 0; i < actual.length - 1; i++) {
assertEquals(-1, actual[i].compareTo(expected[i + 1]));
-
assertEquals(0, actual[i].compareTo(expected[i]));
-
assertEquals(1, actual[i + 1].compareTo(expected[i]));
}
}