Browse Source

Add test from bug 49423 to verify that the problem was fixed in the meantime

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1668481 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_12_FINAL
Dominik Stadler 9 years ago
parent
commit
642ba72872

+ 33
- 0
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java View File

import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
private void expectName(HSSFWorkbook wb, String name, String expect) { private void expectName(HSSFWorkbook wb, String name, String expect) {
assertEquals(expect, wb.getName(name).getRefersToFormula()); assertEquals(expect, wb.getName(name).getRefersToFormula());
} }

@Test
public void test49423() throws Exception
{
HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("49423.xls");
boolean found = false;
int numSheets = workbook.getNumberOfSheets();
for (int i = 0; i < numSheets; i++) {
HSSFSheet sheet = workbook.getSheetAt(i);
List<HSSFShape> shapes = sheet.getDrawingPatriarch().getChildren();
for(HSSFShape shape : shapes){
HSSFAnchor anchor = shape.getAnchor();
if(anchor instanceof HSSFClientAnchor){
// absolute coordinates
HSSFClientAnchor clientAnchor = (HSSFClientAnchor)anchor;
assertNotNull(clientAnchor);
//System.out.println(clientAnchor.getRow1() + "," + clientAnchor.getRow2());
found = true;
} else if (anchor instanceof HSSFChildAnchor){
// shape is grouped and the anchor is expressed in the coordinate system of the group
HSSFChildAnchor childAnchor = (HSSFChildAnchor)anchor;
assertNotNull(childAnchor);
//System.out.println(childAnchor.getDy1() + "," + childAnchor.getDy2());
found = true;
}
}
}
assertTrue("Should find some images via Client or Child anchors, but did not find any at all", found);
}
} }

BIN
test-data/spreadsheet/49423.xls View File


Loading…
Cancel
Save