You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/07/11 14:33:57 UTC

svn commit: r1801619 - /pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/PDFDocEncodingTest.java

Author: tilman
Date: Tue Jul 11 14:33:57 2017
New Revision: 1801619

URL: http://svn.apache.org/viewvc?rev=1801619&view=rev
Log:
PDFBOX-3864: add test

Modified:
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/PDFDocEncodingTest.java

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/PDFDocEncodingTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/PDFDocEncodingTest.java?rev=1801619&r1=1801618&r2=1801619&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/PDFDocEncodingTest.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/PDFDocEncodingTest.java Tue Jul 11 14:33:57 2017
@@ -17,11 +17,11 @@
 
 package org.apache.pdfbox.cos;
 
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
 
 /**
  * Test for PDFDocEncoding.
@@ -89,5 +89,22 @@ public class PDFDocEncodingTest
             assertEquals(cosString.getString(), deviation);
         }
     }
-}
 
+    /**
+     * PDFBOX-3864: Test that chars smaller than 256 which are NOT part of PDFDocEncoding are
+     * handled correctly.
+     *
+     * @throws IOException
+     */
+    @Test
+    public void testPDFBox3864() throws IOException
+    {
+        for (int i = 0; i < 256; i++)
+        {
+            String hex = String.format("FEFF%04X", i);
+            COSString cs1 = COSString.parseHex(hex);
+            COSString cs2 = new COSString(cs1.getString());
+            assertEquals(cs1, cs2);
+        }
+    }
+}