ASF Bugzilla – Attachment 15062 Details for
Bug 34944
[PATCH] Add test case to TestFormulaParser for 3D refs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Test case to test parsing 3D refs in formulas.
FormulaParserTest.patch (text/plain), 2.69 KB, created by
Eric Ladner
on 2005-05-17 23:03:35 UTC
(
hide
)
Description:
Test case to test parsing 3D refs in formulas.
Filename:
MIME Type:
Creator:
Eric Ladner
Created:
2005-05-17 23:03:35 UTC
Size:
2.69 KB
patch
obsolete
>Index: jakarta-poi/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java >=================================================================== >RCS file: /home/cvspublic/jakarta-poi/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java,v >retrieving revision 1.15 >diff -r1.15 TestFormulaParser.java >19a20,23 >> import java.io.File; >> import java.io.FileInputStream; >> import java.io.FileOutputStream; >> import java.io.IOException; >42a47 >> import org.apache.poi.util.TempFile; >380a386,442 >> /** bug 21923, testcase by Eric Ladner */ >> public void test3dRefs() >> throws IOException >> { >> String filename = System.getProperty("HSSF.testdata.path"); >> >> File file = TempFile.createTempFile("testSheetFormula",".xls"); >> FileOutputStream out = new FileOutputStream(file); >> HSSFWorkbook wb = new HSSFWorkbook(); >> HSSFSheet s = wb.createSheet("A"); >> HSSFRow r = null; >> HSSFCell c = null; >> r = s.createRow((short)0); >> c = r.createCell((short)0);c.setCellValue(1); >> c = r.createCell((short)1);c.setCellValue(2); >> c = r.createCell((short)2);c.setCellFormula("A1+B1"); >> >> s = wb.createSheet("B"); >> r = s.createRow((short)0); >> c = r.createCell((short)0); c.setCellFormula("A!A1+A!B1"); >> wb.write(out); >> out.close(); >> >> assertTrue("file exists",file.exists()); >> >> FileInputStream in = new FileInputStream(file); >> wb = new HSSFWorkbook(in); >> s = wb.getSheet("A"); >> r = s.getRow(0); >> c = r.getCell((short)2); >> >> FormulaParser fp = new FormulaParser(c.getCellFormula(), null); >> fp.parse(); >> >> Ptg[] ptgs = fp.getRPNPtg(); >> >> fp.toFormulaString(null, ptgs); >> assertTrue("expected A1+B1 got: "+fp.toFormulaString(null, ptgs), ("A1+B1").equals(fp.toFormulaString(null, ptgs))); >> >> s = wb.getSheet("B"); >> r = s.getRow(0); >> c = r.getCell((short)0); >> >> fp = new FormulaParser(c.getCellFormula(),null); >> fp.parse(); >> >> ptgs = fp.getRPNPtg(); >> >> fp.toFormulaString(null, ptgs); >> assertTrue("expected A!A1+A!B1 got: "+fp.toFormulaString(null, ptgs), ("A!A1+A!B1").equals(fp.toFormulaString(null, ptgs))); >> >> //assertTrue("expected: A!A1+A!B1 got: "+c.getCellFormula(), ("AVERAGE(A!A1:B1)").equals(c.getCellFormula())); >> //c = r.getCell((short)1); >> //assertTrue("expected: A!A1+A!B1 got: "+c.getCellFormula(), ("A!A1+A!B1").equals(c.getCellFormula())); >> in.close(); >> } >>
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 34944
: 15062