pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r908631 - in /pdfbox/trunk/src/test: java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java resources/org/apache/pdfbox/pdmodel/ resources/org/apache/pdfbox/pdmodel/test_pagelabels.pdf
Date Wed, 10 Feb 2010 19:00:12 GMT
Author: jukka
Date: Wed Feb 10 18:59:58 2010
New Revision: 908631

URL: http://svn.apache.org/viewvc?rev=908631&view=rev
Log:
PDFBOX-532: getPageLabels method for PDocumentCatalog class.

Test case for PDFBOX-90, based on patch by Navendu Garg.

Added:
    pdfbox/trunk/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java   (with
props)
    pdfbox/trunk/src/test/resources/org/apache/pdfbox/pdmodel/
    pdfbox/trunk/src/test/resources/org/apache/pdfbox/pdmodel/test_pagelabels.pdf   (with
props)

Added: pdfbox/trunk/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java?rev=908631&view=auto
==============================================================================
--- pdfbox/trunk/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java (added)
+++ pdfbox/trunk/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java Wed Feb
10 18:59:58 2010
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel;
+
+import junit.framework.TestCase;
+
+public class TestPDDocumentCatalog extends TestCase {
+
+    /**
+     * Test case for
+     * <a href="https://issues.apache.org/jira/browse/PDFBOX-90"
+     *   >PDFBOX-90</a> - Support explicit retrieval of page labels.
+     */
+    public void testPageLabels() throws Exception {
+        PDDocument doc = PDDocument.load(
+                TestPDDocumentCatalog.class.getResourceAsStream(
+                        "test_pagelabels.pdf"));
+        try {
+            PDDocumentCatalog cat = doc.getDocumentCatalog();
+            String[] labels = cat.getPageLabels().getLabelsByPageIndices();
+            assertEquals(12, labels.length);
+            assertEquals("A1", labels[0]);
+            assertEquals("A2", labels[1]);
+            assertEquals("A3", labels[2]);
+            assertEquals("i", labels[3]);
+            assertEquals("ii", labels[4]);
+            assertEquals("iii", labels[5]);
+            assertEquals("iv", labels[6]);
+            assertEquals("v", labels[7]);
+            assertEquals("vi", labels[8]);
+            assertEquals("vii", labels[9]);
+            assertEquals("Appendix I", labels[10]);
+            assertEquals("Appendix II", labels[11]);
+        } finally {
+            doc.close();
+        }
+    }
+
+}

Propchange: pdfbox/trunk/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/src/test/resources/org/apache/pdfbox/pdmodel/test_pagelabels.pdf
URL: http://svn.apache.org/viewvc/pdfbox/trunk/src/test/resources/org/apache/pdfbox/pdmodel/test_pagelabels.pdf?rev=908631&view=auto
==============================================================================
Binary file - no diff available.

Propchange: pdfbox/trunk/src/test/resources/org/apache/pdfbox/pdmodel/test_pagelabels.pdf
------------------------------------------------------------------------------
    svn:mime-type = application/pdf



Mime
View raw message