pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1835045 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
Date Wed, 04 Jul 2018 06:32:38 GMT
Author: msahyoun
Date: Wed Jul  4 06:32:37 2018
New Revision: 1835045

URL: http://svn.apache.org/viewvc?rev=1835045&view=rev
Log:
PDFBOX-4256: use Off as the default value for a button field in case there is no value set
-> see PDF spec

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java?rev=1835045&r1=1835044&r2=1835045&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
Wed Jul  4 06:32:37 2018
@@ -136,7 +136,9 @@ public abstract class PDButton extends P
         }
         else
         {
-            return "";
+            // Off is the default value if there is nothing else set.
+            // See PDF Spec.
+            return "Off";
         }
     }
 

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java?rev=1835045&r1=1835044&r2=1835045&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
Wed Jul  4 06:32:37 2018
@@ -178,7 +178,7 @@ public class PDButtonTest
     public void testAcrobatCheckBoxProperties() throws IOException
     {
         PDCheckBox checkbox = (PDCheckBox) acrobatAcroForm.getField("Checkbox");
-        assertEquals(checkbox.getValue(), "");
+        assertEquals(checkbox.getValue(), "Off");
         assertEquals(checkbox.isChecked(), false);
 
         checkbox.check();
@@ -222,7 +222,7 @@ public class PDButtonTest
     public void testAcrobatCheckBoxGroupProperties() throws IOException
     {
         PDCheckBox checkbox = (PDCheckBox) acrobatAcroForm.getField("CheckboxGroup");
-        assertEquals(checkbox.getValue(), "");
+        assertEquals(checkbox.getValue(), "Off");
         assertEquals(checkbox.isChecked(), false);
 
         checkbox.check();



Mime
View raw message