1 31 package test.pdfbox.pdmodel.interactive.form; 32 33 import java.io.IOException ; 34 35 import junit.framework.Test; 36 import junit.framework.TestCase; 37 import junit.framework.TestSuite; 38 39 import org.pdfbox.pdmodel.PDDocument; 40 import org.pdfbox.pdmodel.interactive.form.PDAcroForm; 41 import org.pdfbox.pdmodel.interactive.form.PDTextbox; 42 43 49 public class TestFields extends TestCase 50 { 51 53 58 public TestFields( String name ) 59 { 60 super( name ); 61 } 62 63 68 public static Test suite() 69 { 70 return new TestSuite( TestFields.class ); 71 } 72 73 78 public static void main( String [] args ) 79 { 80 String [] arg = {TestFields.class.getName() }; 81 junit.textui.TestRunner.main( arg ); 82 } 83 84 89 public void testFlags() throws IOException 90 { 91 PDDocument doc = null; 92 try 93 { 94 doc = new PDDocument(); 95 PDAcroForm form = new PDAcroForm( doc ); 96 PDTextbox textBox = new PDTextbox(form); 97 98 assertFalse( textBox.shouldComb() ); 100 101 textBox.setComb( true ); 103 assertTrue( textBox.shouldComb() ); 104 textBox.setComb( false ); 105 assertFalse( textBox.shouldComb() ); 106 107 textBox.setComb( true ); 109 textBox.setDoNotScroll( true ); 110 assertTrue( textBox.shouldComb() ); 111 assertTrue( textBox.doNotScroll() ); 112 113 textBox.setComb( false ); 114 textBox.setDoNotScroll( false ); 115 assertFalse( textBox.shouldComb() ); 116 assertFalse( textBox.doNotScroll() ); 117 118 textBox.setComb( false ); 120 assertFalse( textBox.shouldComb() ); 121 textBox.setComb( false ); 122 assertFalse( textBox.shouldComb() ); 123 124 textBox.setComb( true ); 126 assertTrue( textBox.shouldComb() ); 127 textBox.setComb( true ); 128 assertTrue( textBox.shouldComb() ); 129 130 131 132 133 134 } 135 finally 136 { 137 if( doc != null ) 138 { 139 doc.close(); 140 } 141 } 142 } 143 144 } | Popular Tags |