poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1704186 - in /poi/trunk/src: ooxml/testcases/org/apache/poi/xssf/streaming/ ooxml/testcases/org/apache/poi/xssf/usermodel/ testcases/org/apache/poi/hssf/usermodel/ testcases/org/apache/poi/ss/usermodel/
Date Sun, 20 Sep 2015 20:16:23 GMT
Author: centic
Date: Sun Sep 20 20:16:17 2015
New Revision: 1704186

URL: http://svn.apache.org/viewvc?rev=1704186&view=rev
Log:
Bug 58333: Apply patch to verify behavior on row-index before and after the limits set by
the specification

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java?rev=1704186&r1=1704185&r2=1704186&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java Sun Sep
20 20:16:17 2015
@@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
 
 import java.io.IOException;
 
+import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.usermodel.BaseTestSheet;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -146,6 +147,10 @@ public class TestSXSSFSheet extends Base
         } finally {
             wb.close();
         }
+    }
 
+    @Test
+    public void createRowAfterLastRow() {
+        createRowAfterLastRow(SpreadsheetVersion.EXCEL2007);
     }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java?rev=1704186&r1=1704185&r2=1704186&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java Sun Sep
20 20:16:17 2015
@@ -33,6 +33,7 @@ import org.apache.poi.POIXMLException;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.poifs.crypt.CryptoFunctions;
 import org.apache.poi.poifs.crypt.HashAlgorithm;
+import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.usermodel.AutoFilter;
 import org.apache.poi.ss.usermodel.BaseTestSheet;
 import org.apache.poi.ss.usermodel.Cell;
@@ -994,6 +995,11 @@ public final class TestXSSFSheet extends
         assertEquals(3, xrow[2].getR());
 
     }
+    
+    @Test
+    public void createRowAfterLastRow() {
+        createRowAfterLastRow(SpreadsheetVersion.EXCEL2007);
+    }
 
     @Test
     public void setAutoFilter() {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java?rev=1704186&r1=1704185&r2=1704186&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java Sun Sep 20 20:16:17
2015
@@ -57,6 +57,7 @@ import org.apache.poi.hssf.record.WSBool
 import org.apache.poi.hssf.record.WindowTwoRecord;
 import org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock;
 import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
+import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.formula.ptg.Area3DPtg;
 import org.apache.poi.ss.formula.ptg.Ptg;
 import org.apache.poi.ss.usermodel.AutoFilter;
@@ -84,7 +85,11 @@ public final class TestHSSFSheet extends
     public TestHSSFSheet() {
         super(HSSFITestDataProvider.instance);
     }
-
+    
+    @Test
+    public void createRowAfterLastRow() {
+        createRowAfterLastRow(SpreadsheetVersion.EXCEL97);
+    }
 
     /**
      * Test for Bugzilla #29747.

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java?rev=1704186&r1=1704185&r2=1704186&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java Sun Sep 20 20:16:17
2015
@@ -87,6 +87,31 @@ public abstract class BaseTestSheet {
         assertSame(row2_ovrewritten, row2_ovrewritten_ref);
         assertEquals(100.0, row2_ovrewritten_ref.getCell(0).getNumericCellValue(), 0.0);
     }
+    
+    @Test
+    public void createRowBeforeFirstRow() {
+        final Workbook workbook = _testDataProvider.createWorkbook();
+        final Sheet sh = workbook.createSheet();
+        sh.createRow(0);
+        try {
+            sh.createRow(-1);
+            fail("Negative rows not allowed");
+        } catch (final IllegalArgumentException e) {
+            // expected
+        }
+    }
+    
+    protected void createRowAfterLastRow(SpreadsheetVersion version) {
+        final Workbook workbook = _testDataProvider.createWorkbook();
+        final Sheet sh = workbook.createSheet();
+        sh.createRow(version.getLastRowIndex());
+        try {
+            sh.createRow(version.getLastRowIndex() + 1);
+            fail("Row number must be between 0 and " + version.getLastColumnIndex());
+        } catch (final IllegalArgumentException e) {
+            // expected
+        }
+    }
 
 
     @Test



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


Mime
View raw message