From: Simon Steiner Date: Fri, 3 Feb 2023 08:49:20 +0000 (+0000) Subject: FOP-3117: Allow creating a PDF 2.0 document X-Git-Tag: 2_9~36 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3cbbfc433707d869a0d407ca9c264ee46a1aab06;p=xmlgraphics-fop.git 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 --- 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])); } }