Tests to show that bugs 44891 and 44861 were both already fixed

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@652329 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-04-30 11:10:49 +00:00
parent ee9a91198b
commit d0ca2bfeb7
5 changed files with 38 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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);
}
}

View 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);
}
}
}
}
}