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 2018/09/17 16:24:22 UTC

svn commit: r1841087 - /pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java

Author: tilman
Date: Mon Sep 17 16:24:22 2018
New Revision: 1841087

URL: http://svn.apache.org/viewvc?rev=1841087&view=rev
Log:
PDFBOX-4318: add test inspired by bug reproducing code of Daniel Wildschut

Modified:
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java?rev=1841087&r1=1841086&r2=1841087&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java Mon Sep 17 16:24:22 2018
@@ -190,6 +190,32 @@ public class PDFontTest
         doc.close();
     }
 
+    /**
+     * Test whether bug from PDFBOX-4318 is fixed, which had the wrong cache key.
+     * @throws java.io.IOException
+     */
+    @Test
+    public void testPDFox4318() throws IOException
+    {
+        try
+        {
+            PDType1Font.HELVETICA_BOLD.encode("\u0080");
+            Assert.fail("should have thrown IllegalArgumentException");
+        }
+        catch (IllegalArgumentException ex)
+        {
+        }
+        PDType1Font.HELVETICA_BOLD.encode("€");
+        try
+        {
+            PDType1Font.HELVETICA_BOLD.encode("\u0080");
+            Assert.fail("should have thrown IllegalArgumentException");
+        }
+        catch (IllegalArgumentException ex)
+        {
+        }
+    }
+
     private void testPDFBox3826checkFonts(byte[] byteArray, File fontFile) throws IOException
     {
         PDDocument doc = PDDocument.load(byteArray);