ASF Bugzilla – Attachment 35294 Details for
Bug 61474
Adjusting of formulas in context of column shifting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
partial test case for CompleteFormulaShifter
TestCompleteFormulaShifter.java.patch (text/plain), 2.34 KB, created by
Dragan Jovanović
on 2017-09-05 09:50:31 UTC
(
hide
)
Description:
partial test case for CompleteFormulaShifter
Filename:
MIME Type:
Creator:
Dragan Jovanović
Created:
2017-09-05 09:50:31 UTC
Size:
2.34 KB
patch
obsolete
>Index: TestCompleteFormulaShifter.java >=================================================================== >--- TestCompleteFormulaShifter.java (nonexistent) >+++ TestCompleteFormulaShifter.java (working copy) >@@ -0,0 +1,53 @@ >+package org.apache.poi.ss.formula; >+ >+import org.apache.poi.ss.usermodel.Cell; >+import org.apache.poi.ss.usermodel.CellType; >+import org.apache.poi.ss.usermodel.Sheet; >+import org.apache.poi.ss.usermodel.Workbook; >+import org.apache.poi.xssf.usermodel.XSSFRow; >+import org.apache.poi.xssf.usermodel.XSSFWorkbook; >+import org.junit.Before; >+import org.junit.Test; >+ >+import static org.junit.Assert.assertEquals; >+ >+public class TestCompleteFormulaShifter { >+ private Sheet sheet1; >+ private Workbook wb07; >+ >+ @Before >+ public void init() >+ { >+ wb07 = new XSSFWorkbook(); >+ sheet1 = wb07.createSheet("sheet1"); >+ XSSFRow row = (XSSFRow)sheet1.createRow(0); >+ row.createCell(0, CellType.NUMERIC).setCellValue(1); >+ row.createCell(1, CellType.NUMERIC).setCellValue(2); >+ row.createCell(2, CellType.FORMULA).setCellFormula("A1+B1"); >+ } >+ >+ @Test >+ public void testFormula(){ >+ String originalFormula = "A1+B1"; >+ >+ CompleteFormulaShifter verticalFormulaShifter = new CompleteFormulaShifter(sheet1, true); >+ verticalFormulaShifter.configureForItemShifting(0, 2, 1); >+ String adjustedFormula = verticalFormulaShifter.getShiftedFormulaForXSSF(originalFormula, 0); >+ assertEquals("A2+B2", adjustedFormula); >+ >+ CompleteFormulaShifter horizontalFormulaShifter = new CompleteFormulaShifter(sheet1, false); >+ horizontalFormulaShifter.configureForItemShifting(0, 2, 1); >+ adjustedFormula = horizontalFormulaShifter.getShiftedFormulaForXSSF(originalFormula, 0); >+ assertEquals("B1+C1", adjustedFormula); >+ } >+ @Test >+ public void testFormulaCell(){ >+ CompleteFormulaShifter horizontalFormulaShifter = new CompleteFormulaShifter(sheet1, false); >+ horizontalFormulaShifter.configureForItemShifting(0, 2, 1); >+ Cell formulaCell = sheet1.getRow(0).getCell(2); >+ //System.out.println(formulaCell.getCellFormula()); >+ horizontalFormulaShifter.shiftFormula(formulaCell); >+ assertEquals("B1+C1", formulaCell.getCellFormula()); >+ } >+ >+ }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 61474
:
35287
|
35294
|
35382
|
35383
|
35384
|
35385
|
35386
|
35417
|
35454