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 2018/09/24 04:52:09 UTC

svn commit: r1841795 - /pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java

Author: tilman
Date: Mon Sep 24 04:52:09 2018
New Revision: 1841795

URL: http://svn.apache.org/viewvc?rev=1841795&view=rev
Log:
PDFBOX-4252: add test, adjust comments and test type

Modified:
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java?rev=1841795&r1=1841794&r2=1841795&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java Mon Sep 24 04:52:09 2018
@@ -67,15 +67,15 @@ public class TestListBox extends TestCas
     }
 
     /**
-     * This will test the radio button PDModel.
+     * This will test the list box PDModel.
      *
      * @throws IOException If there is an error creating the field.
      */
-    public void testChoicePDModel() throws IOException
+    public void testListboxPDModel() throws IOException
     {
 
         /*
-         * Set up two data list which will be used for the tests
+         * Set up two data lists which will be used for the tests
          */
 
         // export values
@@ -96,7 +96,7 @@ public class TestListBox extends TestCas
         {
             doc = new PDDocument();
             PDAcroForm form = new PDAcroForm( doc );
-            PDChoice choice = new PDListBox(form);
+            PDListBox choice = new PDListBox(form);
             
             // appearance construction is not implemented, so turn on NeedAppearances
             form.setNeedAppearances(true);
@@ -115,6 +115,12 @@ public class TestListBox extends TestCas
             assertEquals(exportValues,choice.getOptionsDisplayValues());
             assertEquals(exportValues,choice.getOptionsExportValues());
 
+            // Test bug 1 of PDFBOX-4252 when top index is not null
+            choice.setTopIndex(1);
+            choice.setValue(exportValues.get(2));
+            assertEquals(exportValues.get(2), choice.getValue().get(0));
+            choice.setTopIndex(null); // reset
+
             // assert that the option values have been correctly set
             COSArray optItem = (COSArray) choice.getCOSObject().getItem(COSName.OPT);
             assertNotNull(choice.getCOSObject().getItem(COSName.OPT));