Author: nick
Date: Thu Mar 27 11:24:39 2008
New Revision: 641934

URL: http://svn.apache.org/viewvc?rev=641934&view=rev
Log:
Add failing (but disabled) test from bug #44691

Added:
    
poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug44691.java
   (with props)

Added: 
poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug44691.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug44691.java?rev=641934&view=auto
==============================================================================
--- 
poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug44691.java
 (added)
+++ 
poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug44691.java
 Thu Mar 27 11:24:39 2008
@@ -0,0 +1,70 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+package org.apache.poi.hssf.usermodel;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.poi.hssf.util.CellReference;
+
+/**
+ * The PMT formula seems to be giving some grief
+ */
+public final class TestBug44691 extends TestCase {
+       String dirname;
+
+       protected void setUp() throws Exception {
+               super.setUp();
+               dirname = System.getProperty("HSSF.testdata.path");
+       }
+
+       public void DISABLEDtestBug44691() throws Exception {
+               HSSFWorkbook outWorkbook = new HSSFWorkbook();
+               HSSFSheet outPMTSheet = outWorkbook.createSheet("PMT Sheet");
+               HSSFRow row = outPMTSheet.createRow((short) 0);
+               HSSFCell cell = row.createCell((short) 0);
+               cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
+               cell.setCellFormula("PMT(0.09/12,48,-10000)");
+
+               ByteArrayOutputStream baos = new ByteArrayOutputStream();
+               outWorkbook.write(baos);
+               ByteArrayInputStream bais = new 
ByteArrayInputStream(baos.toByteArray());
+
+               HSSFWorkbook inWorkbook = new HSSFWorkbook(bais);
+
+               HSSFSheet inPMTSheet = inWorkbook.getSheet("PMT Sheet");
+               HSSFFormulaEvaluator evaluator = new
+               HSSFFormulaEvaluator(inPMTSheet, inWorkbook);
+               CellReference cellReference = new CellReference("A1");
+               HSSFRow inRow = inPMTSheet.getRow(cellReference.getRow());
+               HSSFCell inCell = inRow.getCell(cellReference.getCol());
+               
+               assertEquals("PMT(0.09/12,48,-10000)", 
+                               inCell.getCellFormula());
+               assertEquals(HSSFCell.CELL_TYPE_FORMULA, inCell.getCellType());
+               
+               evaluator.setCurrentRow(inRow);
+               HSSFFormulaEvaluator.CellValue inCellValue =
+                       evaluator.evaluate(inCell);
+               
+               assertEquals(0, inCellValue.getErrorValue());
+               assertEquals(HSSFCell.CELL_TYPE_NUMERIC, 
inCellValue.getCellType());
+               assertEquals(248.85, inCellValue.getNumberValue(), 0.0001);
+       }
+}

Propchange: 
poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug44691.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to