1<?php 2 3class TestInputText extends GenericTest { 4 function TestInputText1() { 5 $tree = $this->runPipeline(' 6<style type="text/css"> 7.input1 { 8 font-size: 10px; 9} 10 11.input2 { 12 font-size: 20px; 13} 14</style> 15 16<input id="i1" class="input1" type="text" size="0"/><br/> 17<div style="width: 122px; height: 10px; background: green;"> </div> 18 19<input id="i2" class="input1" type="text" size="1"/><br/> 20<div style="width: 27px; height: 10px; background: green;"> </div> 21 22<input id="i3" class="input1" type="text" size="2"/><br/> 23<div style="width: 32px; height: 10px; background: green;"> </div> 24 25<input id="i4" class="input1" type="text" size="3"/><br/> 26<div style="width: 37px; height: 10px; background: green;"> </div> 27 28<input id="i5" class="input1" type="text" size="4"/><br/> 29<div style="width: 42px; height: 10px; background: green;"> </div> 30 31<input id="i6" class="input1" type="text" size="5"/><br/> 32<div style="width: 47px; height: 10px; background: green;"> </div> 33 34<input id="i7" class="input1" type="text" size="10"/><br/> 35<div style="width: 72px; height: 10px; background: green;"> </div> 36 37<input id="i8" class="input1" type="text" size="15"/><br/> 38<div style="width: 97px; height: 10px; background: green;"> </div> 39 40<input id="i9" class="input1" type="text" size="20"/><br/> 41<div style="width: 122px; height: 10px; background: green;"> </div> 42 43<input id="i10" class="input1" type="text" size="25"/><br/> 44<div style="width: 147px; height: 10px; background: green;"> </div> 45 46<input id="i11" class="input2" type="text" size="0"/><br/> 47<div style="width: 219px; height: 10px; background: green;"> </div> 48 49<input id="i12" class="input2" type="text" size="1"/><br/> 50<div style="width: 48px; height: 10px; background: green;"> </div> 51 52<input id="i13" class="input2" type="text" size="2"/><br/> 53<div style="width: 57px; height: 10px; background: green;"> </div> 54 55<input id="i14" class="input2" type="text" size="3"/><br/> 56<div style="width: 66px; height: 10px; background: green;"> </div> 57 58<input id="i15" class="input2" type="text" size="4"/><br/> 59<div style="width: 75px; height: 10px; background: green;"> </div> 60 61<input id="i16" class="input2" type="text" size="5"/><br/> 62<div style="width: 84px; height: 10px; background: green;"> </div> 63 64<input id="i17" class="input2" type="text" size="10"/><br/> 65<div style="width: 129px; height: 10px; background: green;"> </div> 66 67<input id="i18" class="input2" type="text" size="15"/><br/> 68<div style="width: 174px; height: 10px; background: green;"> </div> 69 70<input id="i19" class="input2" type="text" size="20"/><br/> 71<div style="width: 219px; height: 10px; background: green;"> </div> 72 73<input id="i20" class="input2" type="text" size="25"/><br/> 74<div style="width: 264px; height: 10px; background: green;"> </div> 75'); 76 77 $widths = array(122, 78 27, 79 32, 80 37, 81 42, 82 47, 83 72, 84 97, 85 122, 86 147, 87 219, 88 48, 89 57, 90 66, 91 75, 92 84, 93 129, 94 174, 95 219, 96 264); 97 98 for ($i=0; $i<20; $i++) { 99 $element =& $tree->get_element_by_id(sprintf('i%d', $i+1)); 100 $this->assertEqual($element->get_full_width(), 101 px2pt($widths[$i]), 102 sprintf('Invalid input No %i width [%%s]', $i+1)); 103 }; 104 } 105} 106 107?>