You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2015/02/17 21:23:38 UTC

svn commit: r1660490 - in /pdfbox/branches/1.8/pdfbox/src/test: java/org/apache/pdfbox/pdmodel/ resources/org/apache/pdfbox/pdmodel/

Author: msahyoun
Date: Tue Feb 17 20:23:37 2015
New Revision: 1660490

URL: http://svn.apache.org/r1660490
Log:
PDFBOX-2687 add unit test

Added:
    pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm   (with props)
    pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt   (with props)
Modified:
    pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java

Modified: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java?rev=1660490&r1=1660489&r2=1660490&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java Tue Feb 17 20:23:37 2015
@@ -16,6 +16,11 @@
  */
 package org.apache.pdfbox.pdmodel;
 
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent;
+
 import junit.framework.TestCase;
 
 public class TestPDDocumentCatalog extends TestCase {
@@ -84,4 +89,53 @@ public class TestPDDocumentCatalog exten
                 doc.close();
         }
     }
+    
+    /**
+     * Test case for
+     * <a https://issues.apache.org/jira/browse/PDFBOX-2687">PDFBOX-2687</a>
+     * ClassCastException when trying to get OutputIntents or add to it
+     */
+    public void testOutputIntents() throws Exception {
+        PDDocument doc = null;
+        InputStream colorProfile = null;
+        try {
+            
+            doc = PDDocument.load(TestPDDocumentCatalog.class.getResource("test.unc.pdf"));
+            PDDocumentCatalog catalog = doc.getDocumentCatalog();
+
+            // retrieve OutputIntents
+            List<PDOutputIntent> outputIntents = catalog.getOutputIntent();
+            assertTrue(outputIntents.isEmpty());
+            
+            // add an OutputIntent
+            colorProfile = TestPDDocumentCatalog.class.getResourceAsStream("sRGB Color Space Profile.icm");
+            // create output intent
+            PDOutputIntent oi = new PDOutputIntent(doc, colorProfile); 
+            oi.setInfo("sRGB IEC61966-2.1"); 
+            oi.setOutputCondition("sRGB IEC61966-2.1"); 
+            oi.setOutputConditionIdentifier("sRGB IEC61966-2.1"); 
+            oi.setRegistryName("http://www.color.org"); 
+            doc.getDocumentCatalog().addOutputIntent(oi);
+            
+            // retrieve OutputIntents
+            outputIntents = catalog.getOutputIntent();
+            assertEquals(1,outputIntents.size());
+            
+            // set OutputIntents
+            catalog.setOutputIntents(outputIntents);
+            outputIntents = catalog.getOutputIntent();
+            assertEquals(1,outputIntents.size());            
+            
+        } finally {
+            if(doc != null)
+            {
+                doc.close();
+            }
+            
+            if (colorProfile != null)
+            {
+                colorProfile.close();
+            }
+        }
+    }
 }

Added: pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB%20Color%20Space%20Profile.icm?rev=1660490&view=auto
==============================================================================
Binary file - no diff available.

Propchange: pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB%20Color%20Space%20Profile.icm.LICENSE.txt?rev=1660490&view=auto
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt (added)
+++ pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt Tue Feb 17 20:23:37 2015
@@ -0,0 +1,14 @@
+Obtained from: http://www.srgb.com/usingsrgb.html
+
+The file "sRGB Color Space Profile.icm" is:
+Copyright (c) 1998 Hewlett-Packard Company
+
+To anyone who acknowledges that the file "sRGB Color Space Profile.icm" 
+is provided "AS IS" WITH NO EXPRESS OR IMPLIED WARRANTY:
+permission to use, copy and distribute this file for any purpose is hereby 
+granted without fee, provided that the file is not changed including the HP 
+copyright notice tag, and that the name of Hewlett-Packard Company not be 
+used in advertising or publicity pertaining to distribution of the software 
+without specific, written prior permission.  Hewlett-Packard Company makes 
+no representations about the suitability of this software for any purpose.
+

Propchange: pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: pdfbox/branches/1.8/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain