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:34:30 UTC
svn commit: r1660492 - in /pdfbox/trunk/pdfbox/src/test:
java/org/apache/pdfbox/pdmodel/ resources/org/apache/pdfbox/pdmodel/
Author: msahyoun
Date: Tue Feb 17 20:34:30 2015
New Revision: 1660492
URL: http://svn.apache.org/r1660492
Log:
PDFBOX-2687 add unit test
Added:
pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm (with props)
pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt (with props)
Modified:
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java?rev=1660492&r1=1660491&r2=1660492&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java Tue Feb 17 20:34:30 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 {
@@ -87,4 +92,57 @@ 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.getResourceAsStream("test.unc.pdf"));
+ PDDocumentCatalog catalog = doc.getDocumentCatalog();
+
+ // retrieve OutputIntents
+ List<PDOutputIntent> outputIntents = catalog.getOutputIntents();
+ 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.getOutputIntents();
+ assertEquals(1,outputIntents.size());
+
+ // set OutputIntents
+ catalog.setOutputIntents(outputIntents);
+ outputIntents = catalog.getOutputIntents();
+ assertEquals(1,outputIntents.size());
+
+ }
+ finally
+ {
+ if(doc != null)
+ {
+ doc.close();
+ }
+
+ if (colorProfile != null)
+ {
+ colorProfile.close();
+ }
+ }
+ }
}
Added: pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB%20Color%20Space%20Profile.icm?rev=1660492&view=auto
==============================================================================
Binary file - no diff available.
Propchange: pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB%20Color%20Space%20Profile.icm.LICENSE.txt?rev=1660492&view=auto
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt (added)
+++ pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt Tue Feb 17 20:34:30 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/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pdfbox/trunk/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/sRGB Color Space Profile.icm.LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain