diff options
author | Dominik Stadler <centic@apache.org> | 2016-01-02 21:11:28 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2016-01-02 21:11:28 +0000 |
commit | 911c821e4ccffd99a8816c4bcc271cc710e00d18 (patch) | |
tree | dab664b489d1511c103fc632b2847f9e82b57157 | |
parent | 98627f20c2f22e29df6dc17ced6c55903745ab39 (diff) | |
download | poi-911c821e4ccffd99a8816c4bcc271cc710e00d18.tar.gz poi-911c821e4ccffd99a8816c4bcc271cc710e00d18.zip |
Add test which reproduces bug 58325, seems the file uses AlternateContent which POI does not support (yet)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722665 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java | 38 | ||||
-rw-r--r-- | test-data/spreadsheet/58325_db.xlsx | bin | 0 -> 2698159 bytes | |||
-rw-r--r-- | test-data/spreadsheet/58325_lt.xlsx | bin | 0 -> 934572 bytes |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java index 642c8ffbe1..9b6b20e71b 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java @@ -31,6 +31,8 @@ import java.io.OutputStream; import java.nio.charset.Charset;
import java.util.Calendar;
import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.ss.usermodel.Cell;
@@ -391,4 +393,40 @@ public final class TestUnfixedBugs { assertEquals("Did not have expected contents at rownum " + rowNum,
contents + ".0", cell.toString());
}
+
+ @Test
+ public void test58325_one() {
+ check58325(XSSFTestDataSamples.openSampleWorkbook("58325_lt.xlsx"), 1);
+ }
+
+ @Test
+ public void test58325_three() {
+ check58325(XSSFTestDataSamples.openSampleWorkbook("58325_db.xlsx"), 3);
+ }
+
+ private void check58325(XSSFWorkbook wb, int expectedShapes) {
+ XSSFSheet sheet = wb.getSheet("MetasNM001");
+ assertNotNull(sheet);
+
+ StringBuilder str = new StringBuilder();
+ str.append("sheet " + sheet.getSheetName() + " - ");
+
+ XSSFDrawing drawing = sheet.getDrawingPatriarch();
+ //drawing = ((XSSFSheet)sheet).createDrawingPatriarch();
+
+ List<XSSFShape> shapes = drawing.getShapes();
+ str.append("drawing.getShapes().size() = " + shapes.size());
+ Iterator<XSSFShape> it = shapes.iterator();
+ while(it.hasNext()) {
+ XSSFShape shape = it.next();
+ str.append(", " + shape.toString());
+ str.append(", Col1:"+((XSSFClientAnchor)shape.getAnchor()).getCol1());
+ str.append(", Col2:"+((XSSFClientAnchor)shape.getAnchor()).getCol2());
+ str.append(", Row1:"+((XSSFClientAnchor)shape.getAnchor()).getRow1());
+ str.append(", Row2:"+((XSSFClientAnchor)shape.getAnchor()).getRow2());
+ }
+
+ assertEquals("Having shapes: " + str,
+ expectedShapes, shapes.size());
+ }
}
diff --git a/test-data/spreadsheet/58325_db.xlsx b/test-data/spreadsheet/58325_db.xlsx Binary files differnew file mode 100644 index 0000000000..8b85089c86 --- /dev/null +++ b/test-data/spreadsheet/58325_db.xlsx diff --git a/test-data/spreadsheet/58325_lt.xlsx b/test-data/spreadsheet/58325_lt.xlsx Binary files differnew file mode 100644 index 0000000000..342ad0388d --- /dev/null +++ b/test-data/spreadsheet/58325_lt.xlsx |