mirror of https://github.com/apache/poi.git
remove new test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891769 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca93275431
commit
3b98b7d8c2
|
@ -23,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
||||||
import org.apache.poi.ss.tests.usermodel.BaseTestXRow;
|
import org.apache.poi.ss.tests.usermodel.BaseTestXRow;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellCopyPolicy;
|
import org.apache.poi.ss.usermodel.CellCopyPolicy;
|
||||||
|
@ -154,102 +153,6 @@ public final class TestXSSFRow extends BaseTestXRow {
|
||||||
workbook.close();
|
workbook.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testCopyRowFromHssfExternalSheet() throws IOException {
|
|
||||||
final XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
|
|
||||||
final HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
|
|
||||||
final Sheet srcSheet = hssfWorkbook.createSheet("src");
|
|
||||||
final XSSFSheet destSheet = xssfWorkbook.createSheet("dest");
|
|
||||||
xssfWorkbook.createSheet("other");
|
|
||||||
|
|
||||||
final Row srcRow = srcSheet.createRow(0);
|
|
||||||
int col = 0;
|
|
||||||
//Test 2D and 3D Ref Ptgs (Pxg for OOXML Workbooks)
|
|
||||||
srcRow.createCell(col++).setCellFormula("B5");
|
|
||||||
srcRow.createCell(col++).setCellFormula("src!B5");
|
|
||||||
srcRow.createCell(col++).setCellFormula("dest!B5");
|
|
||||||
srcRow.createCell(col++).setCellFormula("other!B5");
|
|
||||||
|
|
||||||
//Test 2D and 3D Ref Ptgs with absolute row
|
|
||||||
srcRow.createCell(col++).setCellFormula("B$5");
|
|
||||||
srcRow.createCell(col++).setCellFormula("src!B$5");
|
|
||||||
srcRow.createCell(col++).setCellFormula("dest!B$5");
|
|
||||||
srcRow.createCell(col++).setCellFormula("other!B$5");
|
|
||||||
|
|
||||||
//Test 2D and 3D Area Ptgs (Pxg for OOXML Workbooks)
|
|
||||||
srcRow.createCell(col++).setCellFormula("SUM(B5:D$5)");
|
|
||||||
srcRow.createCell(col++).setCellFormula("SUM(src!B5:D$5)");
|
|
||||||
srcRow.createCell(col++).setCellFormula("SUM(dest!B5:D$5)");
|
|
||||||
srcRow.createCell(col++).setCellFormula("SUM(other!B5:D$5)");
|
|
||||||
|
|
||||||
//////////////////
|
|
||||||
|
|
||||||
final XSSFRow destRow = destSheet.createRow(1);
|
|
||||||
destRow.copyRowFrom(srcRow, new CellCopyPolicy());
|
|
||||||
|
|
||||||
//////////////////
|
|
||||||
|
|
||||||
//Test 2D and 3D Ref Ptgs (Pxg for OOXML Workbooks)
|
|
||||||
col = 0;
|
|
||||||
Cell cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("B6", cell.getCellFormula(), "RefPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("src!B6", cell.getCellFormula(), "Ref3DPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("dest!B6", cell.getCellFormula(), "Ref3DPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("other!B6", cell.getCellFormula(), "Ref3DPtg");
|
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
|
||||||
|
|
||||||
//Test 2D and 3D Ref Ptgs with absolute row (Ptg row number shouldn't change)
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("B$5", cell.getCellFormula(), "RefPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("src!B$5", cell.getCellFormula(), "Ref3DPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("dest!B$5", cell.getCellFormula(), "Ref3DPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("other!B$5", cell.getCellFormula(), "Ref3DPtg");
|
|
||||||
|
|
||||||
//////////////////////////////////////////
|
|
||||||
|
|
||||||
//Test 2D and 3D Area Ptgs (Pxg for OOXML Workbooks)
|
|
||||||
// Note: absolute row changes from last cell to first cell in order
|
|
||||||
// to maintain topLeft:bottomRight order
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("SUM(B$5:D6)", cell.getCellFormula(), "Area2DPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(cell);
|
|
||||||
assertEquals("SUM(src!B$5:D6)", cell.getCellFormula(), "Area3DPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(destRow.getCell(6));
|
|
||||||
assertEquals("SUM(dest!B$5:D6)", cell.getCellFormula(), "Area3DPtg");
|
|
||||||
|
|
||||||
cell = destRow.getCell(col++);
|
|
||||||
assertNotNull(destRow.getCell(7));
|
|
||||||
assertEquals("SUM(other!B$5:D6)", cell.getCellFormula(), "Area3DPtg");
|
|
||||||
|
|
||||||
xssfWorkbook.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCopyRowOverwritesExistingRow() throws IOException {
|
void testCopyRowOverwritesExistingRow() throws IOException {
|
||||||
final XSSFWorkbook workbook = new XSSFWorkbook();
|
final XSSFWorkbook workbook = new XSSFWorkbook();
|
||||||
|
|
Loading…
Reference in New Issue