Test which seems to show that bug #44996 is invalid, but not completely sure

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@658336 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-05-20 16:51:49 +00:00
parent 748647c9c0
commit a4f9eb9543

View File

@ -58,6 +58,30 @@ public final class TestHSSFCell extends TestCase {
} }
} }
public void testSetValues() throws Exception {
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet("test");
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell((short)0);
cell.setCellValue(1.2);
assertEquals(1.2, cell.getNumericCellValue(), 0.0001);
assertEquals(HSSFCell.CELL_TYPE_NUMERIC, cell.getCellType());
cell.setCellValue(false);
assertEquals(false, cell.getBooleanCellValue());
assertEquals(HSSFCell.CELL_TYPE_BOOLEAN, cell.getCellType());
cell.setCellValue(new HSSFRichTextString("Foo"));
assertEquals("Foo", cell.getRichStringCellValue().getString());
assertEquals(HSSFCell.CELL_TYPE_STRING, cell.getCellType());
cell.setCellValue(new HSSFRichTextString("345"));
assertEquals("345", cell.getRichStringCellValue().getString());
assertEquals(HSSFCell.CELL_TYPE_STRING, cell.getCellType());
}
/** /**
* test that Boolean and Error types (BoolErrRecord) are supported properly. * test that Boolean and Error types (BoolErrRecord) are supported properly.
*/ */