]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-3117: Allow creating a PDF 2.0 document
authorSimon Steiner <ssteiner@apache.org>
Fri, 3 Feb 2023 08:49:20 +0000 (08:49 +0000)
committerSimon Steiner <ssteiner@apache.org>
Fri, 3 Feb 2023 08:49:20 +0000 (08:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1907234 13f79535-47bb-0310-9956-ffa450edef68

fop-core/src/main/java/org/apache/fop/pdf/Version.java
fop-core/src/test/java/org/apache/fop/pdf/VersionTestCase.java

index 4bdc7a1b431d983fa686c994e80be90a46d7d417..f94959a93f3dc945ec23468aa13455844ba9ffc8 100644 (file)
@@ -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;
 
index dd2731d8b5581751f28d1e66ebefa5b900d6d688..ef01b648978a24c0a7ef4c5548dcdf1f6eb5d713 100644 (file)
@@ -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]));
         }
     }