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:04 UTC
svn commit: r1841794 -
/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java
Author: tilman
Date: Mon Sep 24 04:52:04 2018
New Revision: 1841794
URL: http://svn.apache.org/viewvc?rev=1841794&view=rev
Log:
PDFBOX-4252: add test, adjust comments and test type
Modified:
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java
Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java?rev=1841794&r1=1841793&r2=1841794&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java Mon Sep 24 04:52:04 2018
@@ -73,15 +73,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
@@ -117,7 +117,7 @@ public class TestListBox extends TestCas
String defaultAppearanceString = "/Helv 0 Tf 0 g";
form.setDefaultAppearance(defaultAppearanceString);
- PDChoice choice = new PDListBox(form);
+ PDListBox choice = new PDListBox(form);
choice.setDefaultAppearance("/Helv 12 Tf 0g");
@@ -146,6 +146,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));