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
This commit is contained in:
Dominik Stadler 2016-01-02 21:11:28 +00:00
parent 98627f20c2
commit 911c821e4c
3 changed files with 38 additions and 0 deletions

View File

@ -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());
}
}

Binary file not shown.

Binary file not shown.