Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D5CC617C97 for ; Tue, 17 Feb 2015 20:23:47 +0000 (UTC) Received: (qmail 73477 invoked by uid 500); 17 Feb 2015 20:23:38 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 73452 invoked by uid 500); 17 Feb 2015 20:23:38 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 73439 invoked by uid 99); 17 Feb 2015 20:23:38 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Feb 2015 20:23:38 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 3B54DAC006E for ; Tue, 17 Feb 2015 20:23:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1660490 - in /pdfbox/branches/1.8/pdfbox/src/test: java/org/apache/pdfbox/pdmodel/ resources/org/apache/pdfbox/pdmodel/ Date: Tue, 17 Feb 2015 20:23:38 -0000 To: commits@pdfbox.apache.org From: msahyoun@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150217202338.3B54DAC006E@hades.apache.org> 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 + * PDFBOX-2687 + * 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 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