]> source.dussan.org Git - poi.git/commitdiff
Tests to show that bugs 44891 and 44861 were both already fixed
authorNick Burch <nick@apache.org>
Wed, 30 Apr 2008 11:10:49 +0000 (11:10 +0000)
committerNick Burch <nick@apache.org>
Wed, 30 Apr 2008 11:10:49 +0000 (11:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@652329 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/data/44840.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/data/44861.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/data/44891.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java

diff --git a/src/testcases/org/apache/poi/hssf/data/44840.xls b/src/testcases/org/apache/poi/hssf/data/44840.xls
new file mode 100644 (file)
index 0000000..66dd918
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/44840.xls differ
diff --git a/src/testcases/org/apache/poi/hssf/data/44861.xls b/src/testcases/org/apache/poi/hssf/data/44861.xls
new file mode 100644 (file)
index 0000000..bab82b3
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/44861.xls differ
diff --git a/src/testcases/org/apache/poi/hssf/data/44891.xls b/src/testcases/org/apache/poi/hssf/data/44891.xls
new file mode 100644 (file)
index 0000000..30082aa
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/44891.xls differ
index 7e9aeff5f760ba39f58445272d57da07e5467ed5..4ba81c409823ed42b790d1798b9ddfeb324a4aaa 100644 (file)
@@ -882,10 +882,20 @@ public final class TestBugs extends TestCase {
      * Bug 28774: Excel will crash when opening xls-files with images.
      */
     public void test28774() {
-
         HSSFWorkbook wb = openSample("28774.xls");
         assertTrue("no errors reading sample xls", true);
         writeOutAndReadBack(wb);
         assertTrue("no errors writing sample xls", true);
     }
+    
+    /**
+     * Had a problem apparently, not sure what as it
+     *  works just fine...
+     */
+    public void test44891() throws Exception {
+       HSSFWorkbook wb = openSample("44891.xls");
+        assertTrue("no errors reading sample xls", true);
+        writeOutAndReadBack(wb);
+        assertTrue("no errors writing sample xls", true);
+    }
 }
index 19069d32b25f645d7ad00ed7772a46c116b44d5d..0ef642917349eab49a6891ea9746dec298bb139d 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.hssf.usermodel;
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.util.Iterator;
 import java.util.List;
 
 import junit.framework.TestCase;
@@ -252,4 +253,29 @@ public final class TestFormulaEvaluatorBugs extends TestCase {
                }
                assertEquals(true, cell.getBooleanCellValue());
        }
-}
+       
+       public void testClassCast_bug44861() throws Exception {
+               HSSFWorkbook wb = HSSFTestDataSamples.
+                       openSampleWorkbook("44861.xls");
+               
+               // Check direct
+               HSSFFormulaEvaluator.evaluateAllFormulaCells(wb);
+               
+               // And via calls
+               int numSheets = wb.getNumberOfSheets();
+               for(int i=0; i<numSheets; i++) {
+                       HSSFSheet s = wb.getSheetAt(i);
+                       HSSFFormulaEvaluator eval = new HSSFFormulaEvaluator(s,wb);
+                       
+                       for(Iterator rows = s.rowIterator(); rows.hasNext();) {
+                       HSSFRow r = (HSSFRow)rows.next();
+                       eval.setCurrentRow(r);
+                       
+                       for(Iterator cells = r.cellIterator(); cells.hasNext();) {
+                               HSSFCell c = (HSSFCell)cells.next();
+                               eval.evaluateFormulaCell(c);
+                       }
+                       }
+               }
+       }
+}
\ No newline at end of file