unit test for bug #19172

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@729456 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2008-12-26 06:55:08 +00:00
parent 177533e23b
commit 9c4fe5d1bc
1 changed files with 26 additions and 0 deletions

View File

@ -448,4 +448,30 @@ public final class TestHSSFDateUtil extends TestCase {
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());
}
}