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 2015/05/14 22:16:02 UTC

svn commit: r1679450 - /pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java

Author: tilman
Date: Thu May 14 20:16:01 2015
New Revision: 1679450

URL: http://svn.apache.org/r1679450
Log:
PDFBOX-2792: add exact test

Modified:
    pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java

Modified: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java?rev=1679450&r1=1679449&r2=1679450&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java Thu May 14 20:16:01 2015
@@ -438,6 +438,24 @@ public class TestTextStripper extends Te
         String textFull = stripper.getText(doc);
         assertFalse(textFull.isEmpty());
         
+        String expectedTextFull = 
+                "First level 1\n"
+                + "First level 2\n"
+                + "Fist level 3\n"
+                + "Some content\r\n"
+                + "Some other content\r\n"
+                + "Second at level 1\n"
+                + "Second level 2\n"
+                + "Content\r\n"
+                + "Third level 1\n"
+                + "Third level 2\n"
+                + "Third level 3\n"
+                + "Content\r\n"
+                + "Fourth level 1\n"
+                + "Content\r\n"
+                + "Content\r\n";
+        assertEquals(expectedTextFull, textFull);
+        
         // this should grab 0-based pages 2 and 3, i.e. 1-based pages 3 and 4
         // by their bookmarks
         stripper.setStartBookmark(oi2);
@@ -446,6 +464,16 @@ public class TestTextStripper extends Te
         assertFalse(textoi23.isEmpty());
         assertFalse(textoi23.equals(textFull));
         
+        String expectedTextoi23 = 
+                "Second at level 1\n"
+                + "Second level 2\n"
+                + "Content\r\n"
+                + "Third level 1\n"
+                + "Third level 2\n"
+                + "Third level 3\n"
+                + "Content\r\n";
+        assertEquals(expectedTextoi23, textoi23);
+        
         // this should grab 0-based pages 2 and 3, i.e. 1-based pages 3 and 4
         // by their page numbers
         stripper.setStartBookmark(null);
@@ -466,6 +494,13 @@ public class TestTextStripper extends Te
         assertFalse(textoi2.isEmpty());
         assertFalse(textoi2.equals(textoi23));
         assertFalse(textoi23.equals(textFull));
+        
+        String expectedTextoi2 = 
+                "Second at level 1\n"
+                + "Second level 2\n"
+                + "Content\r\n";        
+        assertEquals(expectedTextoi2, textoi2);
+        
          
         // this should grab 0-based page 2, i.e. 1-based page 3
         // by the page number