From aa6c62ee8bb739c4f1b886aadcb523e6bb02e17a Mon Sep 17 00:00:00 2001 From: "Andrew C. Oliver" Date: Mon, 2 Sep 2002 16:13:48 +0000 Subject: [PATCH] Added (test first) test case for if formulas PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352833 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/data/IfFormulaTest.xls | Bin 0 -> 13824 bytes .../poi/hssf/usermodel/TestFormulas.java | 33 ++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/testcases/org/apache/poi/hssf/data/IfFormulaTest.xls diff --git a/src/testcases/org/apache/poi/hssf/data/IfFormulaTest.xls b/src/testcases/org/apache/poi/hssf/data/IfFormulaTest.xls new file mode 100644 index 0000000000000000000000000000000000000000..d307bee12c6eb0f3e3774a4ed8ebd7712856fdab GIT binary patch literal 13824 zcmeHOYiwM_75?_+wXtKb~S!GNP$LqC{gOvF~I>R8?S4- zQc8iE5~}=2+Y}_IDj+1yk0PYD2+{UOg`6NnegLIZl$UBb78R7bDsMsS#Qnaxd%e4E zjNGa%w3@S;nKR!xGv~~iyR&!Z-hJWM4jv*uH>f8-`NV{( zL3tT@LXQ52B2ZMwi7bfWw~1%tt(-s2_gRGTv*;=2z$jBYdJzSBIuCRu|68=q`p_AY z4{JjO2(cc)1I$Z#4GNuY^9q~))aw1p*QNxh#F1?Wmo<_D+wKS(tM?t7SJ}Ljc?iF- zZC^7TCUYCrCi7afpbl5%8}mnyZ_m1xW3r_sYjh=+ za+b12gZ7hlgT~f$w&e)s*xCMYB56xM8%he-g<$ay0@0`Ax-u`MKOL@KFQotfjE9ia z@G=y{bEzMPkEh}_)8KW};I-4>MgM@`8;&9|7@1I6K3HJO*@IDARt&~%i9y(M&R}d} zH`j^~?&b<~N0GcNz?NIOx(4cn>?_Ve8id?jl7p-`!WA^c&p5w+0Zrhq5nJODtTK69 z|60iw&+pDF1O1^tG#l}4Z>G%YuNIM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On4}lIa?o zuf{sIzn#4~auIM5a1n43a1n43a1n43a1n43a1n43a1oek1hkLUzEyi$KAyMF=JkAE zduIKwL;HH|X|*lZ{#^TUz44_zzU1XB^~_&;`rutM?d!Gom;4-)N=Kj12y8~0p8+I! zx}f(<`|x$n+|20`{zoDhnXaQ`p>n=YXLBB1mhY{A!XfS*n~_6>}}Uh9*P0si+RO=NnirhR>f^!=Hsefw(k ar2RHp*kgV0-|+qC{Av6b#&1n$?Ef7#q%q+D literal 0 HcmV?d00001 diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java b/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java index 6ca51ddb5f..c15c54843c 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java @@ -858,6 +858,39 @@ extends TestCase { } + public void testIfFormulas() + throws java.io.IOException + { + String readFilename = System.getProperty("HSSF.testdata.path"); + + File file = File.createTempFile("testIfFormula",".xls"); + FileOutputStream out = new FileOutputStream(file); + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet s = wb.createSheet("Sheet1"); + HSSFRow r = null; + HSSFCell c = null; + r = s.createRow((short)0); + c=r.createCell((short)1); c.setCellValue(1); + c=r.createCell((short)2); c.setCellValue(2); + c=r.createCell((short)3); c.setCellFormula("MAX(A1:B1)"); + c=r.createCell((short)4); c.setCellFormula("IF(A1=D1,\"A1\",\"B1\")"); + + wb.write(out); + out.close(); + + assertTrue("file exists",file.exists()); + + FileInputStream in = new FileInputStream(readFilename+File.separator+"IfFormulaTest.xls"); + wb = new HSSFWorkbook(in); + s = wb.getSheetAt(0); + r = s.getRow(3); + c = r.getCell((short)0); + assertTrue("expected: IF(A3=A1,\"A1\",\"B1\") got "+c.getCellFormula(), ("IF(A3=A1,\"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(); + } + public static void main(String [] args) { System.out .println("Testing org.apache.poi.hssf.usermodel.TestFormulas"); -- 2.39.5