avik        2004/01/01 11:12:46

  Modified:    src/testcases/org/apache/poi/hssf/usermodel TestBugs.java
  Added:       src/testcases/org/apache/poi/hssf/data 25695.xls
  Log:
  On HEAD, checking in testcase for 25695. But it doesnt work for reason's unknown. 
And its not this particular issue thats the culprit. getStringValue returns blank..:(
  
  Revision  Changes    Path
  1.2       +17 -0     jakarta-poi/src/testcases/org/apache/poi/hssf/data/25695.xls
  
        <<Binary file>>
  
  
  1.14      +56 -0     
jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
  
  Index: TestBugs.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestBugs.java     30 Oct 2003 17:20:39 -0000      1.13
  +++ TestBugs.java     1 Jan 2004 19:12:46 -0000       1.14
  @@ -407,6 +407,62 @@
           HSSFCell cell = row.getCell((short)0);
           System.out.println(cell.getStringCellValue());
       }
  +    
  +    /*Tests read and write of Unicode strings in formula results
  +     * bug and testcase submitted by Sompop Kumnoonsate
  +     * The file contains THAI unicode characters. 
  +     */
  +     public void testUnicodeStringFormulaRead() throws Exception {
  +             
  +             String filename = System.getProperty("HSSF.testdata.path");
  +             filename=filename+"/25695.xls";
  +             FileInputStream in = new FileInputStream(filename);
  +             HSSFWorkbook w;
  +             w = new HSSFWorkbook(in);
  +             in.close();
  +
  +             HSSFCell a1 = w.getSheetAt(0).getRow(0).getCell((short) 0);
  +             HSSFCell a2 = w.getSheetAt(0).getRow(0).getCell((short) 1);
  +             HSSFCell b1 = w.getSheetAt(0).getRow(1).getCell((short) 0);
  +             HSSFCell b2 = w.getSheetAt(0).getRow(1).getCell((short) 1);
  +             HSSFCell c1 = w.getSheetAt(0).getRow(2).getCell((short) 0);
  +             HSSFCell c2 = w.getSheetAt(0).getRow(2).getCell((short) 1);
  +             HSSFCell d1 = w.getSheetAt(0).getRow(3).getCell((short) 0);
  +             HSSFCell d2 = w.getSheetAt(0).getRow(3).getCell((short) 1);
  +
  +             assertEquals("String Cell value", a1.getStringCellValue(), 
a2.getStringCellValue());
  +             assertEquals("String Cell value", b1.getStringCellValue(), 
b2.getStringCellValue());
  +             assertEquals("String Cell value", c1.getStringCellValue(), 
c2.getStringCellValue());
  +             assertEquals("String Cell value", d1.getStringCellValue(), 
d2.getStringCellValue());
  +
  +             File xls = File.createTempFile("testFormulaUnicode", ".xls");
  +             FileOutputStream out = new FileOutputStream(xls);
  +             w.write(out);
  +             out.close();
  +             in = new FileInputStream(xls);
  +
  +             HSSFWorkbook rw = new HSSFWorkbook(in);
  +             in.close();
  +
  +             HSSFCell ra1 = rw.getSheetAt(0).getRow(0).getCell((short) 0);
  +             HSSFCell ra2 = rw.getSheetAt(0).getRow(0).getCell((short) 1);
  +             HSSFCell rb1 = rw.getSheetAt(0).getRow(1).getCell((short) 0);
  +             HSSFCell rb2 = rw.getSheetAt(0).getRow(1).getCell((short) 1);
  +             HSSFCell rc1 = rw.getSheetAt(0).getRow(2).getCell((short) 0);
  +             HSSFCell rc2 = rw.getSheetAt(0).getRow(2).getCell((short) 1);
  +             HSSFCell rd1 = rw.getSheetAt(0).getRow(3).getCell((short) 0);
  +             HSSFCell rd2 = rw.getSheetAt(0).getRow(3).getCell((short) 1);
  +
  +             assertEquals("Re-Written String Cell value", a1.getStringCellValue(), 
ra1.getStringCellValue());
  +             assertEquals("Re-Written String Cell value", b1.getStringCellValue(), 
rb1.getStringCellValue());
  +             assertEquals("Re-Written String Cell value", c1.getStringCellValue(), 
rc1.getStringCellValue());
  +             assertEquals("Re-Written String Cell value", d1.getStringCellValue(), 
rd1.getStringCellValue());
  +             assertEquals("Re-Written Formula String Cell value", 
a1.getStringCellValue(), ra2.getStringCellValue());
  +             assertEquals("Re-Written Formula String Cell value", 
b1.getStringCellValue(), rb2.getStringCellValue());
  +             assertEquals("Re-Written Formula String Cell value", 
c1.getStringCellValue(), rc2.getStringCellValue());
  +             assertEquals("Re-Written Formula String Cell value", 
d1.getStringCellValue(), rd2.getStringCellValue());
  +
  +     }
   }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to