]> source.dussan.org Git - poi.git/commitdiff
Test which seems to show that bug #44996 is invalid, but not completely sure
authorNick Burch <nick@apache.org>
Tue, 20 May 2008 16:51:49 +0000 (16:51 +0000)
committerNick Burch <nick@apache.org>
Tue, 20 May 2008 16:51:49 +0000 (16:51 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@658336 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java

index a2e8bd3baab451b0c7e3f3eb226f995ab98b6434..7f4375847780648e714b0a41c86921bcf8edb68d 100644 (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.
      */