You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by av...@apache.org on 2007/01/16 10:23:19 UTC
svn commit: r496633 - in
/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf: data/ usermodel/
Author: avik
Date: Tue Jan 16 01:23:18 2007
New Revision: 496633
URL: http://svn.apache.org/viewvc?view=rev&rev=496633
Log:
Testcases for bugs. Thanks Yegor
Added:
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/25183.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/26100.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/27933.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29675.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29942.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29982.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/30540.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31749.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31979.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35564.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35565.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/37376.xls (with props)
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/40285.xls (with props)
Modified:
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/25183.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/25183.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/25183.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/26100.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/26100.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/26100.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/27933.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/27933.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/27933.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29675.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29675.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29675.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29942.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29942.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29942.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29982.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29982.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/29982.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/30540.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/30540.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/30540.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31749.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31749.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31749.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31979.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31979.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/31979.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35564.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35564.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35564.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35565.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35565.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/35565.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/37376.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/37376.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/37376.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/40285.xls
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/40285.xls?view=auto&rev=496633
==============================================================================
Binary file - no diff available.
Propchange: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/data/40285.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?view=diff&rev=496633&r1=496632&r2=496633
==============================================================================
--- jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Tue Jan 16 01:23:18 2007
@@ -24,6 +24,7 @@
import org.apache.poi.util.TempFile;
import java.io.*;
+import java.util.Iterator;
@@ -31,6 +32,7 @@
* Testcases for bugs entered in bugzilla
* the Test name contains the bugzilla bug id
* @author Avik Sengupta
+ * @author Yegor Kozlov
*/
public class TestBugs
@@ -537,7 +539,335 @@
assertTrue("Read book fine!" , true);
}
-
+ protected String cwd = System.getProperty("HSSF.testdata.path");
+
+ /**
+ * Bug 25183: org.apache.poi.hssf.usermodel.HSSFSheet.setPropertiesFromSheet
+ */
+ public void test25183() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "25183.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 26100: 128-character message in IF statement cell causes HSSFWorkbook open failure
+ */
+ public void test26100() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "26100.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+ assertTrue("No Exceptions while reading file", true);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 27933: Unable to use a template (xls) file containing a wmf graphic
+ */
+ public void test27933() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "27933.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 29206: NPE on HSSFSheet.getRow for blank rows
+ */
+ public void test29206() throws Exception {
+ //the first check with blank workbook
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet sheet = wb.createSheet();
+
+ for(int i = 1; i < 400; i++) {
+ HSSFRow row = sheet.getRow(i);
+ if(row != null) {
+ HSSFCell cell = row.getCell((short)0);
+ }
+ }
+
+ //now check on an existing xls file
+ FileInputStream in = new FileInputStream(new File(cwd, "Simple.xls"));
+ wb = new HSSFWorkbook(in);
+ in.close();
+
+ for(int i = 1; i < 400; i++) {
+ HSSFRow row = sheet.getRow(i);
+ if(row != null) {
+ HSSFCell cell = row.getCell((short)0);
+ }
+ }
+
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 29675: POI 2.5 final corrupts output when starting workbook has a graphic
+ */
+ public void test29675() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "29675.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 29942: Importing Excel files that have been created by Open Office on Linux
+ */
+ public void test29942() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "29942.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ HSSFSheet sheet = wb.getSheetAt(0);
+ int count = 0;
+ for (int i = sheet.getFirstRowNum(); i <= sheet.getLastRowNum(); i++) {
+ HSSFRow row = sheet.getRow(i);
+ if (row != null) {
+ HSSFCell cell = row .getCell((short)0);
+ assertEquals(HSSFCell.CELL_TYPE_STRING, cell.getCellType());
+ count++;
+ }
+ }
+ assertEquals(85, count); //should read 85 rows
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 29982: Unable to read spreadsheet when dropdown list cell is selected -
+ * Unable to construct record instance
+ */
+ public void test29982() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "29982.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 30540: HSSFSheet.setRowBreak throws NullPointerException
+ */
+ public void test30540() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "30540.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ HSSFSheet s = wb.getSheetAt(0);
+ s.setRowBreak(1);
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 31749: {Need help urgently}[This is critical] workbook.write() corrupts the file......?
+ */
+ public void test31749() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "31749.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
+ /**
+ * Bug 31979: {urgent help needed .....}poi library does not support form objects properly.
+ */
+ public void test31979() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "31979.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ //wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+
+ }
+
+ /**
+ * Bug 35564: HSSFCell.java: NullPtrExc in isGridsPrinted() and getProtect()
+ * when HSSFWorkbook is created from file
+ */
+ public void test35564() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "35564.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ HSSFSheet sheet = wb.getSheetAt( 0 );
+ assertEquals(false, sheet.isGridsPrinted());
+ assertEquals(false, sheet.getProtect());
+
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+
+ }
+
+ /**
+ * Bug 35565: HSSFCell.java: NullPtrExc in getColumnBreaks() when HSSFWorkbook is created from file
+ */
+ public void test35565() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "35565.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ HSSFSheet sheet = wb.getSheetAt( 0 );
+ assertNotNull(sheet);
+
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+
+ }
+
+ /**
+ * Bug 37376: Cannot open the saved Excel file if checkbox controls exceed certain limit
+ */
+ public void test37376() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "37376.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ assertTrue("No Exceptions while reading file", true);
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+
+ }
+
+ /**
+ * Bug 40285: CellIterator Skips First Column
+ */
+ public void test40285() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "40285.xls"));
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ HSSFSheet sheet = wb.getSheetAt( 0 );
+ int rownum = 0;
+ for (Iterator it = sheet.rowIterator(); it.hasNext(); rownum++) {
+ HSSFRow row = (HSSFRow)it.next();
+ assertEquals(rownum, row.getRowNum());
+ int cellNum = 0;
+ for (Iterator it2 = row.cellIterator(); it2.hasNext(); cellNum++) {
+ HSSFCell cell = (HSSFCell)it2.next();
+ assertEquals(cellNum, cell.getCellNum());
+ }
+ }
+ }
+
+ /**
+ * Bug 40296: HSSFCell.setCellFormula throws
+ * ClassCastException if cell is created using HSSFRow.createCell(short column, int type)
+ */
+ public void test40296() throws Exception {
+ HSSFWorkbook wb = new HSSFWorkbook();
+
+ HSSFWorkbook workBook = new HSSFWorkbook();
+ HSSFSheet workSheet = workBook.createSheet("Sheet1");
+ HSSFCell cell;
+ HSSFRow row;
+
+ row = workSheet.createRow(0);
+ cell = row.createCell((short)0, HSSFCell.CELL_TYPE_NUMERIC);
+ cell.setCellValue(1.0);
+ cell = row.createCell((short)1, HSSFCell.CELL_TYPE_NUMERIC);
+ cell.setCellValue(2.0);
+ cell = row.createCell((short)2, HSSFCell.CELL_TYPE_FORMULA);
+ cell.setCellFormula("SUM(A1:B1)");
+
+ //serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ wb.write(out);
+ out.close();
+
+ wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+ assertTrue("No Exceptions while reading file", true);
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/