From: Nick Burch Date: Tue, 20 May 2008 16:51:49 +0000 (+0000) Subject: Test which seems to show that bug #44996 is invalid, but not completely sure X-Git-Tag: REL_3_2_FINAL~325 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9b5e20d769ef575984213936c0bed785af93987d;p=poi.git 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 --- diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java index a2e8bd3baa..7f43758477 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java @@ -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. */