Lines 77-82
Link Here
|
77 |
* Tests various functionity having to do with HSSFCell. For instance support for |
77 |
* Tests various functionity having to do with HSSFCell. For instance support for |
78 |
* paticular datatypes, etc. |
78 |
* paticular datatypes, etc. |
79 |
* @author Andrew C. Oliver (andy at superlinksoftware dot com) |
79 |
* @author Andrew C. Oliver (andy at superlinksoftware dot com) |
|
|
80 |
* @author Dan Sherman (dsherman at isisph.com) |
80 |
*/ |
81 |
*/ |
81 |
|
82 |
|
82 |
public class TestHSSFCell |
83 |
public class TestHSSFCell |
Lines 137-142
Link Here
|
137 |
assertTrue("boolean value 0,2 = 1",c.getErrorCellValue() == 1); |
138 |
assertTrue("boolean value 0,2 = 1",c.getErrorCellValue() == 1); |
138 |
|
139 |
|
139 |
in.close(); |
140 |
in.close(); |
|
|
141 |
} |
142 |
|
143 |
/** |
144 |
* Checks that the recognition of files using 1904 date windowing |
145 |
* is working properly. Conversion of the date is also an issue, |
146 |
* but there's a separate unit test for that. |
147 |
*/ |
148 |
public void testDateWindowing() throws Exception { |
149 |
GregorianCalendar cal = new GregorianCalendar(2000,0,1); // Jan. 1, 2000 |
150 |
Date date = cal.getTime(); |
151 |
String path = System.getProperty("HSSF.testdata.path"); |
152 |
|
153 |
// first check a file with 1900 Date Windowing |
154 |
String filename = path + "/1900DateWindowing.xls"; |
155 |
FileInputStream stream = new FileInputStream(filename); |
156 |
POIFSFileSystem fs = new POIFSFileSystem(stream); |
157 |
HSSFWorkbook workbook = new HSSFWorkbook(fs); |
158 |
HSSFSheet sheet = workbook.getSheetAt(0); |
159 |
|
160 |
assertEquals("Date from file using 1900 Date Windowing", |
161 |
date.getTime(), |
162 |
sheet.getRow(0).getCell((short)0) |
163 |
.getDateCellValue().getTime()); |
164 |
stream.close(); |
165 |
|
166 |
// now check a file with 1904 Date Windowing |
167 |
filename = path + "/1904DateWindowing.xls"; |
168 |
stream = new FileInputStream(filename); |
169 |
fs = new POIFSFileSystem(stream); |
170 |
workbook = new HSSFWorkbook(fs); |
171 |
sheet = workbook.getSheetAt(0); |
172 |
|
173 |
assertEquals("Date from file using 1904 Date Windowing", |
174 |
date.getTime(), |
175 |
sheet.getRow(0).getCell((short)0) |
176 |
.getDateCellValue().getTime()); |
177 |
stream.close(); |
140 |
} |
178 |
} |
141 |
|
179 |
|
142 |
public static void main(String [] args) { |
180 |
public static void main(String [] args) { |