acoliver 2002/10/23 19:14:29
Modified: src/testcases/org/apache/poi/hssf/usermodel
TestFormulas.java
Log:
unit test for date formula
Revision Changes Path
1.26 +37 -0
jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
Index: TestFormulas.java
===================================================================
RCS file:
/home/cvs/jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TestFormulas.java 1 Oct 2002 17:37:47 -0000 1.25
+++ TestFormulas.java 24 Oct 2002 02:14:29 -0000 1.26
@@ -857,6 +857,43 @@
in.close();
}
+ public void testDateFormulas()
+ throws java.io.IOException
+ {
+ String readFilename = System.getProperty("HSSF.testdata.path");
+
+ File file = File.createTempFile("testDateFormula",".xls");
+ FileOutputStream out = new FileOutputStream(file);
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet s = wb.createSheet("Sheet1");
+ HSSFRow r = null;
+ HSSFCell c = null;
+
+ r = s.createRow( (short)0 );
+ c = r.createCell( (short)0 );
+
+ HSSFCellStyle cellStyle = wb.createCellStyle();
+ cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));
+ c.setCellValue(new Date());
+ c.setCellStyle(cellStyle);
+
+ // assertEquals("Checking hour = " + hour, date.getTime().getTime(),
+ // HSSFDateUtil.getJavaDate(excelDate).getTime());
+
+ for (int k=1; k < 100; k++) {
+ r=s.createRow((short)k);
+ c=r.createCell((short)0);
+ c.setCellFormula("A"+(k)+"+1");
+ c.setCellStyle(cellStyle);
+ }
+
+ wb.write(out);
+ out.close();
+
+ assertTrue("file exists",file.exists());
+
+ }
+
/*
public void testIfFormulas()
throws java.io.IOException
--
To unsubscribe, e-mail: <mailto:poi-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:poi-dev-help@;jakarta.apache.org>