Add unit tests to verify that bug 51626 and bug 51451 are fixed
Conflicts: src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1701132 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fcfe2e2a71
commit
4b8c20a7ca
@ -29,9 +29,10 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@ -66,6 +67,7 @@ import org.apache.poi.ss.usermodel.CellValue;
|
||||
import org.apache.poi.ss.usermodel.ClientAnchor;
|
||||
import org.apache.poi.ss.usermodel.Comment;
|
||||
import org.apache.poi.ss.usermodel.CreationHelper;
|
||||
import org.apache.poi.ss.usermodel.DataFormat;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.ss.usermodel.Drawing;
|
||||
@ -2571,4 +2573,47 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test51626() throws Exception {
|
||||
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("51626.xlsx");
|
||||
assertNotNull(wb);
|
||||
wb.close();
|
||||
|
||||
InputStream stream = HSSFTestDataSamples.openSampleFileStream("51626.xlsx");
|
||||
wb = WorkbookFactory.create(stream);
|
||||
stream.close();
|
||||
wb.close();
|
||||
|
||||
wb = XSSFTestDataSamples.openSampleWorkbook("51626_contact.xlsx");
|
||||
assertNotNull(wb);
|
||||
wb.close();
|
||||
|
||||
stream = HSSFTestDataSamples.openSampleFileStream("51626_contact.xlsx");
|
||||
wb = WorkbookFactory.create(stream);
|
||||
stream.close();
|
||||
wb.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test51451() throws IOException {
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sh = wb.createSheet();
|
||||
|
||||
Row row = sh.createRow(0);
|
||||
Cell cell = row.createCell(0);
|
||||
cell.setCellValue(239827342);
|
||||
|
||||
CellStyle style = wb.createCellStyle();
|
||||
//style.setHidden(false);
|
||||
DataFormat excelFormat = wb.createDataFormat();
|
||||
style.setDataFormat(excelFormat.getFormat("#,##0"));
|
||||
sh.setDefaultColumnStyle(0, style);
|
||||
|
||||
// FileOutputStream out = new FileOutputStream("/tmp/51451.xlsx");
|
||||
// wb.write(out);
|
||||
// out.close();
|
||||
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
BIN
test-data/spreadsheet/51626.xlsx
Normal file
BIN
test-data/spreadsheet/51626.xlsx
Normal file
Binary file not shown.
BIN
test-data/spreadsheet/51626_contact.xlsx
Normal file
BIN
test-data/spreadsheet/51626_contact.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user