make sure workbook can be written out and read back for all TestXSSFPivotTable tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1760811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
16acf81b9e
commit
39752a5643
@ -19,13 +19,17 @@ package org.apache.poi.xssf.usermodel;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.SpreadsheetVersion;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellType;
|
import org.apache.poi.ss.usermodel.CellType;
|
||||||
import org.apache.poi.ss.usermodel.DataConsolidateFunction;
|
import org.apache.poi.ss.usermodel.DataConsolidateFunction;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.apache.poi.ss.util.AreaReference;
|
import org.apache.poi.ss.util.AreaReference;
|
||||||
import org.apache.poi.ss.util.CellReference;
|
import org.apache.poi.ss.util.CellReference;
|
||||||
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageField;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageField;
|
||||||
@ -35,14 +39,16 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableDefinitio
|
|||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataConsolidateFunction;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataConsolidateFunction;
|
||||||
|
|
||||||
public class TestXSSFPivotTable {
|
public class TestXSSFPivotTable {
|
||||||
|
private static final XSSFITestDataProvider _testDataProvider = XSSFITestDataProvider.instance;
|
||||||
|
private XSSFWorkbook wb;
|
||||||
private XSSFPivotTable pivotTable;
|
private XSSFPivotTable pivotTable;
|
||||||
private XSSFPivotTable offsetPivotTable;
|
private XSSFPivotTable offsetPivotTable;
|
||||||
private Cell offsetOuterCell;
|
private Cell offsetOuterCell;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp(){
|
public void setUp(){
|
||||||
Workbook wb = new XSSFWorkbook();
|
wb = new XSSFWorkbook();
|
||||||
XSSFSheet sheet = (XSSFSheet) wb.createSheet();
|
XSSFSheet sheet = wb.createSheet();
|
||||||
|
|
||||||
Row row1 = sheet.createRow(0);
|
Row row1 = sheet.createRow(0);
|
||||||
// Create a cell and put a value in it.
|
// Create a cell and put a value in it.
|
||||||
@ -75,10 +81,10 @@ public class TestXSSFPivotTable {
|
|||||||
Cell cell12 = row1.createCell(3);
|
Cell cell12 = row1.createCell(3);
|
||||||
cell12.setCellValue(12.12);
|
cell12.setCellValue(12.12);
|
||||||
|
|
||||||
AreaReference source = new AreaReference("A1:C2");
|
AreaReference source = new AreaReference("A1:C2", _testDataProvider.getSpreadsheetVersion());
|
||||||
pivotTable = sheet.createPivotTable(source, new CellReference("H5"));
|
pivotTable = sheet.createPivotTable(source, new CellReference("H5"));
|
||||||
|
|
||||||
XSSFSheet offsetSheet = (XSSFSheet) wb.createSheet();
|
XSSFSheet offsetSheet = wb.createSheet();
|
||||||
|
|
||||||
Row tableRow_1 = offsetSheet.createRow(1);
|
Row tableRow_1 = offsetSheet.createRow(1);
|
||||||
offsetOuterCell = tableRow_1.createCell(1);
|
offsetOuterCell = tableRow_1.createCell(1);
|
||||||
@ -118,6 +124,13 @@ public class TestXSSFPivotTable {
|
|||||||
offsetPivotTable = offsetSheet.createPivotTable(offsetSource, new CellReference("C6"));
|
offsetPivotTable = offsetSheet.createPivotTable(offsetSource, new CellReference("C6"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws IOException {
|
||||||
|
XSSFWorkbook wb2 = _testDataProvider.writeOutAndReadBack(wb);
|
||||||
|
wb.close();
|
||||||
|
wb2.close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that when creating a row label it's created on the correct row
|
* Verify that when creating a row label it's created on the correct row
|
||||||
* and the count is increased by one.
|
* and the count is increased by one.
|
||||||
|
Loading…
Reference in New Issue
Block a user