acoliver    02/04/29 17:18:47

  Modified:    src/testcases/org/apache/poi/hssf/usermodel
                        TestFormulas.java
  Log:
  More work from avik
  
  Revision  Changes    Path
  1.8       +39 -0     
jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
  
  Index: TestFormulas.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestFormulas.java 28 Apr 2002 20:51:55 -0000      1.7
  +++ TestFormulas.java 30 Apr 2002 00:18:47 -0000      1.8
  @@ -75,6 +75,7 @@
   
   /**
    * @author Andrew C. Oliver (acoliver at apache dot org)
  + * @author Avik Sengupta
    */
   
   public class TestFormulas
  @@ -475,6 +476,44 @@
           in.close();
           assertTrue("file exists",file.exists());
       }
  +
  +    /**
  +     * Tests creating a file with floating point in a formula.
  +     *
  +     */
  +    public void testFloat()
  +        throws Exception {
  +            String operator = "+";
  +            short            rownum = 0;
  +            File file = File.createTempFile("testFormulaFloat",".xls");
  +            FileOutputStream out    = new FileOutputStream(file);
  +            HSSFWorkbook     wb     = new HSSFWorkbook();
  +            HSSFSheet        s      = wb.createSheet();
  +            HSSFRow          r      = null;
  +            HSSFCell         c      = null;
  +
  +                for (short x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2)) {
  +                r = s.createRow((short) x);
  +
  +                for (short y = 1; y < 256 && y > 0; y++) {
  +
  +                    c = r.createCell((short) y);
  +                    c.setCellFormula("" + (100*x)+"."+y + operator + (10000*y) + 
  +                                     "."+x);
  +    
  +
  +                }
  +            }
  +
  +            wb.write(out);
  +            out.close();
  +            assertTrue("file exists",file.exists());
  +
  +
  +        }
  +
  +
  +    
       
       
       
  
  
  


Reply via email to