poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r729456 - /poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
Date Fri, 26 Dec 2008 06:55:08 GMT
Author: yegor
Date: Thu Dec 25 22:55:08 2008
New Revision: 729456

URL: http://svn.apache.org/viewvc?rev=729456&view=rev
Log:
unit test for bug #19172

Modified:
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java?rev=729456&r1=729455&r2=729456&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java Thu Dec 25
22:55:08 2008
@@ -448,4 +448,30 @@
         Date expected = createDate(1982, 1, 18, 16, 48, 0);
         assertEquals(expected, actual);
     }
+
+    /**
+     * User reported a datetime issue in POI-2.5:
+     *  Setting Cell's value to Jan 1, 1900 without a time doesn't return the same value
set to
+     */
+    public void testBug19172()
+    {
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        HSSFSheet sheet = workbook.createSheet();
+        HSSFCell cell = sheet.createRow(0).createCell(0);
+
+        Calendar cal = Calendar.getInstance();
+
+        // A pseduo special Excel dates
+        cal.set(1900, 0, 1);
+
+        Date valueToTest = cal.getTime();
+
+        cell.setCellValue(valueToTest);
+
+        Date returnedValue = cell.getDateCellValue();
+
+        assertEquals(valueToTest.getTime(), returnedValue.getTime());
+    }
+
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message