You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2021/04/25 16:04:55 UTC

svn commit: r1889177 - /pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParserTest.java

Author: lehmi
Date: Sun Apr 25 16:04:55 2021
New Revision: 1889177

URL: http://svn.apache.org/viewvc?rev=1889177&view=rev
Log:
PDFBOX-5177: improve test

Modified:
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParserTest.java

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParserTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParserTest.java?rev=1889177&r1=1889176&r2=1889177&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParserTest.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParserTest.java Sun Apr 25 16:04:55 2021
@@ -18,9 +18,12 @@ package org.apache.pdfbox.pdfparser;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.List;
+
 import org.apache.pdfbox.cos.COSBoolean;
 import org.apache.pdfbox.cos.COSInteger;
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.cos.COSObject;
 import org.apache.pdfbox.cos.COSStream;
 import org.junit.Assert;
 import org.junit.Test;
@@ -34,13 +37,16 @@ public class PDFObjectStreamParserTest
     public void testOffsetParsing() throws IOException
     {
         COSStream stream = new COSStream();
-        stream.setItem(COSName.N, COSInteger.ONE);
-        stream.setItem(COSName.FIRST, COSInteger.ZERO);
+        stream.setItem(COSName.N, COSInteger.TWO);
+        stream.setItem(COSName.FIRST, COSInteger.get(8));
         OutputStream outputStream = stream.createOutputStream();
-        outputStream.write("0 7 -1 true".getBytes());
+        outputStream.write("1 0 2 5 true false".getBytes());
         outputStream.close();
         PDFObjectStreamParser objectStreamParser = new PDFObjectStreamParser(stream, null);
         objectStreamParser.parse();
-        Assert.assertEquals(COSBoolean.TRUE, objectStreamParser.getObjects().get(0).getObject());
+        List<COSObject> objects = objectStreamParser.getObjects();
+        Assert.assertEquals(2, objects.size());
+        Assert.assertEquals(COSBoolean.TRUE, objects.get(0).getObject());
+        Assert.assertEquals(COSBoolean.FALSE, objects.get(1).getObject());
     }
 }