mirror of https://github.com/apache/poi.git
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:
parent
71d226437c
commit
15e082cd9b
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue